I have a Metronome class built around Vinn’s lovely metronome which nicely chuggs along. I have another class called TransportControl which sets up a global transport bar (play/record buttons and a bpm TextEditor which broadcasts changes to the Metronome class when changed). The Transport bar also has a Label which is supposed to display the current Bar.Beat info.
So Metronome has a ListenerList which the TransportControl registers with and is notified each beat. In the notification callback in TransportControl, I get passed the current beat number, and use that to increment my beat/bar label using setText. If I don’t call MessageManagerLock before setText however, the program crash’s saying that “// if component methods are being called from threads other than the message thread, you’ll need to use a MessageManagerLock object to make sure it’s thread-safe.
If I lock the MessageManager before setText() then I get really unexpected results and stability issues in my program. Audio writing for example goes haywire… is this completely the wrong approach in trying to have my metronome notify and update my display (in another class) that it should update itself? Thanks!