Hi. I´m relatively new to c++ and quite fresh with juce, so I´m facing some conceptual problems. Here´s a little background.
I want to create MIDI only plugins, step sequencer, controller managers, etc. I come from Kontakt scripts, which have a totally different input/output structure. It doesn´t force you to deal with buffers, it does it internally. The script system gets a MIDI message, triggers a callback and then allows me to manipulate the data in ´realtime´ so to speak. It makes is very easy to manipulate MIDI data.
I´m trying to translate my Kontakt approach to JUCE.
1) Kontakt script receives a note, it triggers a callback. I want to use keyswitches to trigger a MIDI sequence;
2) I ignore the incoming keyswitch (quite easy, using an ´ignore_midi´ command, which will bypass the incoming message). I use a ´wait(x)´ command (it suspends the processing for x microsseconds). Let´s say I want to send a note every 1/8 bAR, it has some internal variables that will give me, for instance, an eighth note in microsseconds ($DURATION_EIGHTH_NOTE). I wait this much and send the next note. It´s a serial process.
This is the step that is hard translating to the buffer paradigm. Reading input messages is easy, but I don´t get the best way to create rhythmic output messages, for the next message might be in the next buffer. Also, the distance bewteen notes converted to time is variable if there´s any tempo variation. In Kontakt, I get quite precise using the aforemetioned approach. My questions are:
a) Do I have to implement some sort of queue to handle outputting MIDI rhythmically?
b) Is there any class that handles this kind of conversion automatically?
Sorry if I missed some post that talks about it, in fact I´ve been reading many posts but I can´t find a not-so-complex solution. Maybe because of my lack of experience.
Any help, trully appreciated.
Thanks
Adriano