Add initial bits for Qt6 support
[carla.git] / source / includes / vst3sdk / pluginterfaces / vst / ivstmidilearn.h
blob06cf43e4b447c0c04e98f1763a5aa81918f52669
1 //------------------------------------------------------------------------
2 // Project : VST SDK
3 //
4 // Category : Interfaces
5 // Filename : pluginterfaces/vst/ivstmidilearn.h
6 // Created by : Steinberg, 11/2018
7 // Description : VST MIDI Learn
8 //
9 //-----------------------------------------------------------------------------
10 // This file is part of a Steinberg SDK. It is subject to the license terms
11 // in the LICENSE file found in the top-level directory of this distribution
12 // and at www.steinberg.net/sdklicenses.
13 // No part of the SDK, including this file, may be copied, modified, propagated,
14 // or distributed except according to the terms contained in the LICENSE file.
15 //-----------------------------------------------------------------------------
17 #pragma once
19 #include "pluginterfaces/base/funknown.h"
20 #include "pluginterfaces/vst/vsttypes.h"
22 //------------------------------------------------------------------------
23 namespace Steinberg {
24 namespace Vst {
26 //------------------------------------------------------------------------
27 /** MIDI Learn interface: Vst::IMidiLearn
28 \ingroup vstIPlug vst3612
29 - [plug imp]
30 - [extends IEditController]
31 - [released: 3.6.12]
32 - [optional]
34 If this interface is implemented by the edit controller, the host will call this method whenever
35 there is live MIDI-CC input for the plug-in. This way, the plug-in can change its MIDI-CC parameter
36 mapping and inform the host via the IComponentHandler::restartComponent with the
37 kMidiCCAssignmentChanged flag.
38 Use this if you want to implement custom MIDI-Learn functionality in your plug-in.
40 \code{.cpp}
41 //------------------------------------------------
42 // in MyController class declaration
43 class MyController : public Vst::EditController, public Vst::IMidiLearn
45 // ...
46 //--- IMidiLearn ---------------------------------
47 tresult PLUGIN_API onLiveMIDIControllerInput (int32 busIndex, int16 channel,
48 CtrlNumber midiCC) SMTG_OVERRIDE;
49 // ...
51 OBJ_METHODS (MyController, Vst::EditController)
52 DEFINE_INTERFACES
53 // ...
54 DEF_INTERFACE (Vst::IMidiLearn)
55 END_DEFINE_INTERFACES (Vst::EditController)
56 //...
59 //------------------------------------------------
60 // in mycontroller.cpp
61 #include "pluginterfaces/vst/ivstmidilearn.h
63 namespace Steinberg {
64 namespace Vst {
65 DEF_CLASS_IID (IMidiLearn)
69 //------------------------------------------------------------------------
70 tresult PLUGIN_API MyController::onLiveMIDIControllerInput (int32 busIndex,
71 int16 channel, CtrlNumber midiCC)
73 // if we are not in doMIDILearn (triggered by a UI button for example)
74 // or wrong channel then return
75 if (!doMIDILearn || busIndex != 0 || channel != 0 || midiLearnParamID == InvalidParamID)
76 return kResultFalse;
78 // adapt our internal MIDICC -> parameterID mapping
79 midiCCMapping[midiCC] = midiLearnParamID;
81 // new mapping then inform the host that our MIDI assignment has changed
82 if (auto componentHandler = getComponentHandler ())
84 componentHandler->restartComponent (kMidiCCAssignmentChanged);
86 return kResultTrue;
88 \endcode
90 class IMidiLearn : public FUnknown
92 public:
93 /** Called on live input MIDI-CC change associated to a given bus index and MIDI channel */
94 virtual tresult PLUGIN_API onLiveMIDIControllerInput (int32 busIndex, int16 channel,
95 CtrlNumber midiCC) = 0;
97 //------------------------------------------------------------------------
98 static const FUID iid;
101 DECLARE_CLASS_IID (IMidiLearn, 0x6B2449CC, 0x419740B5, 0xAB3C79DA, 0xC5FE5C86)
104 //------------------------------------------------------------------------
105 } // namespace Vst
106 } // namespace Steinberg