VST3: MIDI-learn, live input events
This commit is contained in:
parent
56b94b3fc4
commit
89a0258c31
@ -156,6 +156,7 @@ private:
|
||||
void set_parameter_internal (Vst::ParamID id, float& value, int32 sample_off, bool normalized);
|
||||
|
||||
bool midi_controller (int32_t, int16_t, Vst::CtrlNumber, Vst::ParamID &id);
|
||||
bool live_midi_cc (int32_t, int16_t, Vst::CtrlNumber);
|
||||
|
||||
boost::shared_ptr<ARDOUR::VST3PluginModule> _module;
|
||||
|
||||
|
@ -46,6 +46,7 @@ DEF_CLASS_IID (Vst::IEventList)
|
||||
DEF_CLASS_IID (Vst::IHostApplication)
|
||||
DEF_CLASS_IID (Vst::IMessage)
|
||||
DEF_CLASS_IID (Vst::IMidiMapping)
|
||||
DEF_CLASS_IID (Vst::IMidiLearn)
|
||||
DEF_CLASS_IID (Vst::IParameterChanges)
|
||||
DEF_CLASS_IID (Vst::IParamValueQueue)
|
||||
DEF_CLASS_IID (Vst::IPlugInterfaceSupport)
|
||||
@ -315,8 +316,8 @@ PlugInterfaceSupport::PlugInterfaceSupport ()
|
||||
addPlugInterfaceSupported (INoteExpressionPhysicalUIMapping::iid);
|
||||
|
||||
//---VST 3.6.12--------------------------------
|
||||
addPlugInterfaceSupported (IMidiLearn::iid);
|
||||
#endif
|
||||
addPlugInterfaceSupported (IMidiLearn::iid);
|
||||
}
|
||||
|
||||
tresult
|
||||
|
@ -316,6 +316,9 @@ VST3PI::evoral_to_vst3 (Vst::Event& e, Evoral::Event<samplepos_t> const& ev, int
|
||||
e.polyPressure.noteId = -1;
|
||||
return true;
|
||||
case MIDI_CMD_CONTROL:
|
||||
if (ev.is_live_midi ()/* live input -- no playback */) {
|
||||
live_midi_cc (bus, channel, data1);
|
||||
}
|
||||
if (midi_controller (bus, channel, data1, id)) {
|
||||
set_parameter_by_id (id, data2 / 127.f, ev.time ());
|
||||
}
|
||||
@ -1631,6 +1634,16 @@ VST3PI::get_parameter (uint32_t p) const
|
||||
return _controller->normalizedParamToPlain (id, _shadow_data[p]);
|
||||
}
|
||||
|
||||
bool
|
||||
VST3PI::live_midi_cc (int32_t bus, int16_t channel, Vst::CtrlNumber ctrl)
|
||||
{
|
||||
FUnknownPtr<Vst::IMidiLearn> midiLearn (_controller);
|
||||
if (!midiLearn) {
|
||||
return false;
|
||||
}
|
||||
return kResultOk == midiLearn->onLiveMIDIControllerInput (bus, channel, ctrl);
|
||||
}
|
||||
|
||||
bool
|
||||
VST3PI::midi_controller (int32_t bus, int16_t channel, Vst::CtrlNumber ctrl, Vst::ParamID &id)
|
||||
{
|
||||
@ -1653,7 +1666,7 @@ VST3PI::add_event (Evoral::Event<samplepos_t> const& ev, int32_t bus)
|
||||
{
|
||||
Vst::Event e;
|
||||
e.busIndex = bus;
|
||||
e.flags = Vst::Event::kIsLive;
|
||||
e.flags = ev.is_live_midi () ? Vst::Event::kIsLive : 0;
|
||||
e.sampleOffset = ev.time();
|
||||
e.ppqPosition = _context.projectTimeMusic;
|
||||
if (evoral_to_vst3 (e, ev, bus)) {
|
||||
|
@ -39,7 +39,7 @@
|
||||
//#include "pluginterfaces/vst/ivstinterappaudio.h"
|
||||
#include "pluginterfaces/vst/ivstmessage.h"
|
||||
#include "pluginterfaces/vst/ivstmidicontrollers.h"
|
||||
//#include "pluginterfaces/vst/ivstmidilearn.h"
|
||||
#include "pluginterfaces/vst/ivstmidilearn.h"
|
||||
//#include "pluginterfaces/vst/ivstnoteexpression.h"
|
||||
#include "pluginterfaces/vst/ivstparameterchanges.h"
|
||||
//#include "pluginterfaces/vst/ivstphysicalui.h"
|
||||
|
Loading…
Reference in New Issue
Block a user