diff options
author | David Robillard <d@drobilla.net> | 2008-02-20 23:24:51 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-20 23:24:51 +0000 |
commit | 68bfed0a461635e3f5c05651f755dca6e22df5d9 (patch) | |
tree | 3fa77689b44505c6189a212e6db57d6c9ba612d1 /libs | |
parent | a2a6cc0404757f445bd753d69f34d8bc2c0e87a9 (diff) |
Some work towards MIDI plugins (LV2 plugins with (MIDI supporting) event ports shown in plugin selector).
git-svn-id: svn://localhost/ardour2/branches/3.0@3092 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 12 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 27 |
2 files changed, 34 insertions, 5 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 777f285e9d..d20ece65bd 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -95,6 +95,7 @@ class LV2Plugin : public ARDOUR::Plugin bool parameter_is_audio(uint32_t) const; bool parameter_is_control(uint32_t) const; + bool parameter_is_midi(uint32_t) const; bool parameter_is_input(uint32_t) const; bool parameter_is_output(uint32_t) const; bool parameter_is_toggled(uint32_t) const; @@ -138,11 +139,12 @@ struct LV2World { ~LV2World(); SLV2World world; - SLV2Value input_class; - SLV2Value output_class; - SLV2Value audio_class; - SLV2Value control_class; - SLV2Value event_class; + SLV2Value input_class; ///< Input port + SLV2Value output_class; ///< Output port + SLV2Value audio_class; ///< Audio port + SLV2Value control_class; ///< Control port + SLV2Value event_class; ///< Event port + SLV2Value midi_class; ///< MIDI event SLV2Value in_place_broken; SLV2Value integer; SLV2Value toggled; diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index e58e5ed140..4553458831 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -389,6 +389,23 @@ LV2Plugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_i bufs.get_audio(index).data(nframes, offset)); out_index++; } + } else if (parameter_is_midi(port_index)) { + // FIXME: Switch MIDI buffer format to LV2 event buffer + if (parameter_is_input(port_index)) { + //const size_t index = min(in_index, nbufs - 1); + //slv2_instance_connect_port(_instance, port_index, + // bufs.get_midi(index).data(nframes, offset)); + // FIXME: hope it's connection optional... + slv2_instance_connect_port(_instance, port_index, NULL); + in_index++; + } else if (parameter_is_output(port_index)) { + //const size_t index = min(out_index,nbufs - 1); + //slv2_instance_connect_port(_instance, port_index, + // bufs.get_midi(index).data(nframes, offset)); + // FIXME: hope it's connection optional... + slv2_instance_connect_port(_instance, port_index, NULL); + out_index++; + } } port_index++; } @@ -415,6 +432,14 @@ LV2Plugin::parameter_is_audio (uint32_t param) const } bool +LV2Plugin::parameter_is_midi (uint32_t param) const +{ + SLV2Port port = slv2_plugin_get_port_by_index(_plugin, param); + return slv2_port_is_a(_plugin, port, _world.event_class) + && slv2_port_supports_event(_plugin, port, _world.midi_class); +} + +bool LV2Plugin::parameter_is_output (uint32_t param) const { SLV2Port port = slv2_plugin_get_port_by_index(_plugin, param); @@ -505,6 +530,7 @@ LV2World::LV2World() control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL); audio_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_AUDIO); event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT); + midi_class = slv2_value_new_uri(world, SLV2_EVENT_CLASS_MIDI); in_place_broken = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "inPlaceBroken"); integer = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "integer"); toggled = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "toggled"); @@ -518,6 +544,7 @@ LV2World::~LV2World() slv2_value_free(control_class); slv2_value_free(audio_class); slv2_value_free(event_class); + slv2_value_free(midi_class); slv2_value_free(in_place_broken); } |