Midi in to poly midi out - no audio

Hey everyone,

I just succesfully created a standalone juce app that sends out sysex and midinote when receiving midi in notes. Everything works fine but now i want to create a poly device.
I’ve read a lot of examples but they all deal with audio oscilators and tailoff etc.
I just want my device to create 4 poly midiout messages but I’m quite confused. Can anyone point me in the right direction?

When you say “poly”, do you mean you want to send 4 notes? Because that is all you need to do. Send 4 note on msgs, followed by the 4 note offs at the appropriate time.

Correct, i want to send 4 notes at the same time, when the player holds 4. when he holds 2 send 2. when he holds 4 then holds a 5th one the first one should stop and the last note held should be added. (that’s the stealing part) I have little experience with c++ and never used vectors before.

This is my simplified “mono” synth code: *EDIT I have cleaned up my code, first I send a sysex message, then i send a midi note. Now these 2 functions need to become poly :smiley:

void process(MidiBuffer& midiMessages)
    
    {
        processedBuffer.clear();
        MidiBuffer::Iterator it(midiMessages);
        MidiMessage currentMessage;

        while (it.getNextEvent(currentMessage, samplePos))
               {

                   if (currentMessage.isNoteOnOrOff())
                   {
                       trackDialValueforArray = trackDialValue -1;
                       processedBuffer.addEvent(createSysexMessageForME(currentMessage), samplePos);
                       currentMessage.setNoteNumber(tracknotes[trackDialValueforArray]);
                       currentMessage.setChannel(5);
                       processedBuffer.addEvent(currentMessage, samplePos);
                   }
                   
               }
        
        midiMessages.swapWith(processedBuffer);
    }
    MidiBuffer processedBuffer;
};