Hello all,
I am new in Juce and my english is not really good. I'll do my best to be clear.
I try to write a Midi generator using juce.
In my AudioProcessor constructor, I create a thread and I open a midioutput:
midioutput = MidiOutput::openDevice(MidiOutput::getDefaultDeviceIndex());
timerThread = new TimerThread("Midi Player", this);
timerThread->startThread();
In this thread, for test, I make a loop:
MidiMessage instance;
MidiMessage myNote = instance.noteOn((int)1, (int)36, (float)127);
MidiMessage myNoteOff = instance.noteOff((int)1, (int)36, (float)127);
while (1)
{
out->sendMessageNow(myNote);
out->sendMessageNow(myNoteOff);
usleep(500);
}
So I open ableton live, create an instance of my plugin, and I hear a every half second (usleep(500)) a piano note.
I do not know where it comes from, but not from ableton. Its like its was going out of a defaulft midi synth on my OS (windows7)
I did some test writing midimessages in ProcessBlock's MidiBuffer, and then the midi come out of my plugin and goes to ableton, so its ok.
But when I write midimessages on the midioutput, I dont know how to stream the output in ableton live.
So my question are:
-Am I on the good way to write a midigenerator (thread, ...) ?
-How can I have my midioutput like if I was writting on the ProcessBlock's midiBuffer ?
I hope my questions means something, and my english can be understood.
Thank you very much,
Mat