Nobody has successfully answered my post here:
http://www.rawmaterialsoftware.com/viewtopic.php?f=8&t=9683
So, I wondered if I'm way off track and thought I'd try to use a MidiMessageCollector to transpose the MIDI by 5 semitones. Here is the code I tried, for more detail see the aforementioned post:
- Code: Select all
const int notenum = midi_message.getNoteNumber();
const uint8 velocity = midi_message.getVelocity();
const int channel = midi_message.getChannel();
//Transposing by 5 semitones:
int oldNote = notenum;
int newNote = notenum+5;
//_newNoteNumber = newNote;
MidiMessageCollector* collect = new MidiMessageCollector();
juce::MidiMessage noteOff(juce::MidiMessage::noteOff(channel, oldNote));
juce::MidiMessage noteOn(juce::MidiMessage::noteOn(channel, newNote, velocity));
collect->removeNextBlockOfMessages(output, buffer.getNumSamples());
collect->addMessageToQueue (noteOff);
collect->addMessageToQueue(noteOn);
I thought this would 'kill' the old note and replace it with the transposed note. It doesn't work. Which approach should I use for transposition/ why doesn't this code work? How do I 'add' the queue to midimessages or does this happen automatically?
I'd appreciate any helpful answer. Apologies for my NOOBish questions.
