I’m trying to get a simple plugin done, but since I’m a noob at C++ and Juce, I’m failing big time and could do with some help.
I managed to get a plugin up and running with Juicer in Xcode, testing in the JUCE AudioPluginHost which:
a) receives MIDI notes in the Processor thread and calculates the tempo from their distance, then write that to variable TempoProc and make it visible via DBG in the debug console. Check
b) has a scalable Editor window with a label that displays the variable TempoGUI. Check
c) has a Timer implemented which periodically checks if TempoGUI has changed and if so, refreshes the label with the correct value
However, I can’t seem to find a way to make TempoProc yell “Hey TempoGUI, yes, you, over in the other thread - I have changed to this new value, adjust yourself!”
What I have tried so far, to show you the scale of my ineptitude:
Tried to read up on the issue, but all I found was along the lines of “Oh, that’s easy, you just need to inflect a convoltation on the (mergoffled) backwibble in procrastic mode, but make sure you don’t overpledge the frobbleworth-constantation, its offlepoff conflictions can get nasty if you don’t frimbiffle them in time before the grenforth gramblination runs out. But no worries, you can fix this with an easy grek or two.” This, to be honest, makes my eyes glaze over, if anything.
Checked into Broadcasters and Listeners, however I guess these are designed to signal the change of GUI elements into the processor, not the other way round.
Created a function in the Editor, made it a friend of the Processor so it can access the Processor’s variables and tried to read Processor’s TempoProc from the Editor which ended in the compiler complaining about TempoProc not being declared in Editor. Of course it isn’t, Captain Obvious, it lives in the Processor thread, that’s the point of the exercise.
Created a function in the Processor to write TempoProc to TempoGUI which of course results in TempoGUI not being declared in the Processor. Well, I’m not surprised.
So how do I signal the new value of a variable in the processor thread to another variable in the Editor thread ?