UI thread callback servicing


#1

Hi, I’m a JUCE newbie, and although it’s probably somewhere here in the forums or the the demo code, I searched and can’t seem to find an answer to the following:

I have a subclass derived from MidiInputCallback and am successfully receiving the MIDI stream in handleIncomingMidiMessage. I then transfer the data to a thread safe buffer.

I expect the next step is to register some kind of callback pointer with the JUCE message pump, and whenever there is MIDI input, post a message from the MIDI input thread to the UI thread to trigger servicing of the callback. I just can’t find the details to accomplish this.

Thanks for any help pointing me in the right direction – Geoff


#2

you should make your background worker class an AsyncUpdater, or make both classes (background worker, and main ui receiver) ChangeBroadcaster and ChangeListener respectively.

This way you can post async messages from background threads to the main ui thread without blocking the message thread.


#3

Or even just use a MessageListener, and send Message objects to it containing the data.


#4