I'm trying to write a GUI controller for the Roland JD-08 and I have come across a problem.
The JD-08 uses CC 111 to enable/disable each of the 4 Tone Bank layers by bit masking 4 buttons (Tone A = bit 0, Tone B = bit 1, Tone C = bit 2 and Tone D = bit 3). I have coded the GUI so the 4 button 'On' values are the same as the bit position (1,2,4 & 8).
To enable Tones B & D you would send MIDI Channel, 111, 10 to the JD-08. Likewise selecting Tone A only on the JD-08 would send MIDI Channel number, 111, 1 from the JD-08.
To try and get this to work I set up a variable to behave like a conventional bit register updated by the incoming MIDI and its 'onValue' routine then updates the 4 button states in the GUI by bit masking with the new CC 111 value and setting the button state to match. This works OK and responds correctly to the data incoming from the JD-08 - the button states change as expected.
For a GUI button press, an 'onValue' event is sent from the button clicked to the bit register variable with an XOR toggle with the previous value. The bit register appears to send out the correct MIDI CC 111 xxxx value to the JD-08. The 'onValue' event should then update all the button states as above, but this does not happen. All the buttons update correctly except for the one that generated the event. It only gets correctly updated when a second event is triggered by another subsequent button press causing a new 'onValue' event.
Is there some 'safety' feature that prevents the event originator from receiving an update in its own event loop? If so, is there a way around this?
All suggestions gratefully received.