VST 3 Interfaces  VST 3.7
SDK for developing VST plug-in
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
IMidiLearn Class Referenceabstract

MIDI Learn interface: Vst::IMidiLearn. More...

#include <ivstmidilearn.h>

+ Inheritance diagram for IMidiLearn:

Public Member Functions

virtual tresult onLiveMIDIControllerInput (int32 busIndex, int16 channel, CtrlNumber midiCC)=0
 Called on live input MIDI-CC change associated to a given bus index and MIDI channel.
 
- Public Member Functions inherited from FUnknown
virtual tresult queryInterface (const TUID _iid, void **obj)=0
 
virtual uint32 addRef ()=0
 
virtual uint32 release ()=0
 

Static Public Attributes

static const FUID iid
 
- Static Public Attributes inherited from FUnknown
static const FUID iid
 

Detailed Description

MIDI Learn interface: Vst::IMidiLearn.

If this interface is implemented by the edit controller, the host will call this method whenever there is live MIDI-CC input for the plug-in. This way, the plug-in can change its MIDI-CC parameter mapping and inform the host via the IComponentHandler::restartComponent with the kMidiCCAssignmentChanged flag. Use this if you want to implement custom MIDI-Learn functionality in your plug-in.

//------------------------------------------------
// in MyController class declaration
class MyController : public Vst::EditController, public Vst::IMidiLearn
{
// ...
//--- IMidiLearn ---------------------------------
tresult PLUGIN_API onLiveMIDIControllerInput (int32 busIndex, int16 channel,
// ...
OBJ_METHODS (MyController, Vst::EditController)
DEFINE_INTERFACES
// ...
DEF_INTERFACE (Vst::IMidiLearn)
END_DEFINE_INTERFACES (Vst::EditController)
//...
}
//------------------------------------------------
// in mycontroller.cpp
#include "pluginterfaces/vst/ivstmidilearn.h
namespace Steinberg {
namespace Vst {
DEF_CLASS_IID (IMidiLearn)
}
}
//------------------------------------------------------------------------
tresult PLUGIN_API MyController::onLiveMIDIControllerInput (int32 busIndex,
int16 channel, CtrlNumber midiCC)
{
// if we are not in doMIDILearn (triggered by a UI button for example)
// or wrong channel then return
if (!doMIDILearn || busIndex != 0 || channel != 0 || midiLearnParamID == InvalidParamID)
return kResultFalse;
// adapt our internal MIDICC -> parameterID mapping
midiCCMapping[midiCC] = midiLearnParamID;
// new mapping then inform the host that our MIDI assignment has changed
if (auto componentHandler = getComponentHandler ())
{
componentHandler->restartComponent (kMidiCCAssignmentChanged);
}
return kResultTrue;
}

Member Function Documentation

virtual tresult onLiveMIDIControllerInput ( int32  busIndex,
int16  channel,
CtrlNumber  midiCC 
)
pure virtual

Called on live input MIDI-CC change associated to a given bus index and MIDI channel.

Member Data Documentation

const FUID iid
static
Empty

Copyright ©2022 Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.