I’m new to Juce, so this may prove beyond me. This is a slightly general request for advice, largely about communicating between the UI and the process thread.
To give context, I would like to make some tracks using essentially only my Mopho as the sound source. The Mopho is monophonic, so for things like polyphony or unison, I need to record it in multiple passes. Thus I want a VST that essentially functions as a Mopho so far as midi and sound are concerned. The audio it produces doesn’t need to be high quality since it’s audio won’t be used in any final product. Rather, it needs to do just enough that I can work out what I want my Mopho to do before going through the process of recording things in multiple passes.
If I use host automation, I would like the plugin to output MIDI notes and NRPNs that can be recorded so that I have MIDI data that can be played back through the real Mopho. The host I’ll be using is Reaper.
Internally, it’s edit buffer has 256 bytes of data, and the contents of that buffer control the two oscillators, each with a sub oscillator, a lowpass filter, four LFOs and four steppers (IIRC, something like that). So what I want my synth to do is to maintain a 256byte buffer of the config information, receive NRPNs/CCs, and also when changed from the host via automation, to output NRPNs. This will edit buffer will be contained in the audio thread.
The general question is: what is the right way to go about this?
- It makes sense for the UI thread to poll the data when it wants it, and to use the value tree state to send updates to the audio thread.
- If the plugin state changes via MIDI, the UI only needs to be notified that a change has happened, and then it can poll the data when it can.
- So from the point of view of the UI thread, the 256bytes of state are read-only (and written to via the value tree state). And from the point of view of the audio thread, the 256 bytes of state are read-write and it simply notifies the UI when changes occur. There should, I think, be a simple flag which is set when a change occurs, and cleared when the data is polled from the UI thread, so that the notification is only sent once.
Any thoughts welcome. (And I hope you don’t mind some beginner-level questions as to how to do things, or at least what to google for. I generally resort to posting in a forum once I’ve got as far as I can by googling and searching threads, but often I don’t know the right thing to search for, or else the information I find in a post assumes that I know something I don’t, or else assumes I know where to look up some topic.)