Please help me!
I´ve searched everywhere and tried a lot of things for the last two days now, but I´m stuck!
Basically I´m programming a step sequencer, that is supposed to fire a noteOn at every step (so far it has eight) and then automatically a noteOff after some (user adjustable) time has passed.
My approach so far has been:
- call startBackgroundThread() on my MidiOutput (I do this at init of the output)
For every step:
- add my Messages to a MidiBuffer (MidiBuffer::addEvent)
- send the buffer via MidiOutput::sendBlockOfMessages()
I get note output, but the problem now is, that I cannot really set the time between noteOn and noteOff. Where would I do this anyway? I tried giving my messages timeStamps (makes no difference, as somehow the note messages come out without timestamps at all), and also using a higher “sampleNumber” with the addEvent command. This works to some extent, but then fails an assertion if the time gets too big.
Do I have the right approch anyway? Or do I need a single thread for every note? (I don´t have much experience with threads yet)
Any help would be greatly appreciated!
Thanks in advance,