MIDI learn


#1

I'm trying to build a MIDI learn class to assign CCs to several sliders. 

The problem is that the MIDI buffer is always empty when I use it on effect plugins. I also tried the example from the tutorial:

    MidiBuffer processedMidi;
    int time;
    MidiMessage m;

    
    for (MidiBuffer::Iterator i (midiMessages); i.getNextEvent (m, time);)
    {
        if (m.isNoteOn())
        {
            DBG(m.getNoteNumber())
        }
        else if (m.isNoteOff())
        {
        }
        else if (m.isAftertouch())
        {
        }
        else if (m.isPitchWheel())
        {
        }
        
        processedMidi.addEvent (m, time);
    }

This doesn't work on effect plugin even if I enable the "Plugin wants MIDI input" option from Introjucer.

However it does work if I compile a synth.

What am I doing wrong? What's the best way for adding MIDI learn capability to my controls? 


#2

Hi lapsang,

which host did you use for testing?
Maybe the host does not supported an effect as you expect. (I know such problems e.g. with Live or Renoise.)

What's the best way for adding MIDI learn capability to my controls? 

Maybe a MVC-Design or by sending commands with the ui-component-names which you can save and restore to/from xml?
NOTE: do not handle any MIDI IN event from the ui, this will not work if the plugin ui is closed (I've done this mistake my first time :-)) !