diff options
-rw-r--r-- | src/libs/engine/LV2Info.hpp | 37 | ||||
-rw-r--r-- | src/libs/engine/LV2Node.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Makefile.am | 1 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 8 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.hpp | 2 | ||||
-rw-r--r-- | src/libs/gui/ingen_gui.glade | 18 |
6 files changed, 51 insertions, 17 deletions
diff --git a/src/libs/engine/LV2Info.hpp b/src/libs/engine/LV2Info.hpp index 7a9ad1cc..ad314d77 100644 --- a/src/libs/engine/LV2Info.hpp +++ b/src/libs/engine/LV2Info.hpp @@ -23,35 +23,40 @@ #error "This file requires SLV2, but HAVE_SLV2 is not defined. Please report." #endif -#include "module/global.hpp" +#include <map> +#include <string> #include <slv2/slv2.h> +#include "module/global.hpp" +#include "lv2/uri_map/lv2_uri_map.h" namespace Ingen { +/** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features). + */ class LV2Info { public: - LV2Info(SLV2World world) - : input_class(slv2_value_new_uri(world, SLV2_PORT_CLASS_INPUT)) - , output_class(slv2_value_new_uri(world, SLV2_PORT_CLASS_OUTPUT)) - , 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)) - {} - - ~LV2Info() { - slv2_value_free(input_class); - slv2_value_free(output_class); - slv2_value_free(control_class); - slv2_value_free(audio_class); - slv2_value_free(event_class); - } + LV2Info(SLV2World world); + ~LV2Info(); SLV2Value input_class; SLV2Value output_class; SLV2Value control_class; SLV2Value audio_class; SLV2Value event_class; + + LV2_Feature uri_map_feature; + LV2_URI_Map_Feature uri_map_feature_data; + + typedef std::map<std::string, uint32_t> URIMap; + URIMap uri_map; + uint32_t next_uri_id; + + static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, + const char* map, + const char* uri); + + LV2_Feature** lv2_features; }; diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 9b0fabeb..2fbd390f 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -137,7 +137,7 @@ LV2Node::instantiate() uint32_t port_buffer_size = 0; for (uint32_t i=0; i < _polyphony; ++i) { - (*_instances)[i] = slv2_plugin_instantiate(plug, _srate, NULL); + (*_instances)[i] = slv2_plugin_instantiate(plug, _srate, info->lv2_features); if ((*_instances)[i] == NULL) { cerr << "Failed to instantiate plugin!" << endl; return false; diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 9e1d3047..caa49560 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -67,6 +67,7 @@ libingen_engine_la_SOURCES = \ JackMidiDriver.hpp \ LADSPAPlugin.cpp \ LADSPAPlugin.hpp \ + LV2Info.cpp \ LV2Info.hpp \ LV2Plugin.cpp \ LV2Plugin.hpp \ diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index ecd97318..9764cdc0 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -68,6 +68,8 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) xml->get_widget("canvas_menu_add_midi_output", _menu_add_midi_output); xml->get_widget("canvas_menu_add_osc_input", _menu_add_osc_input); xml->get_widget("canvas_menu_add_osc_output", _menu_add_osc_output); + xml->get_widget("canvas_menu_add_event_input", _menu_add_event_input); + xml->get_widget("canvas_menu_add_event_output", _menu_add_event_output); xml->get_widget("canvas_menu_load_plugin", _menu_load_plugin); xml->get_widget("canvas_menu_load_patch", _menu_load_patch); xml->get_widget("canvas_menu_new_patch", _menu_new_patch); @@ -97,6 +99,12 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) _menu_add_osc_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), "osc_output", "ingen:OSCPort", true)); + _menu_add_event_input->signal_activate().connect( + sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), + "event_input", "ingen:EventPort", false)); + _menu_add_midi_output->signal_activate().connect( + sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), + "event_output", "ingen:EventPort", true)); // Add control menu items /*_menu_add_number_control->signal_activate().connect( diff --git a/src/libs/gui/PatchCanvas.hpp b/src/libs/gui/PatchCanvas.hpp index 1df3773f..98a1635d 100644 --- a/src/libs/gui/PatchCanvas.hpp +++ b/src/libs/gui/PatchCanvas.hpp @@ -127,6 +127,8 @@ private: Gtk::MenuItem* _menu_add_audio_output; Gtk::MenuItem* _menu_add_control_input; Gtk::MenuItem* _menu_add_control_output; + Gtk::MenuItem* _menu_add_event_input; + Gtk::MenuItem* _menu_add_event_output; Gtk::MenuItem* _menu_add_midi_input; Gtk::MenuItem* _menu_add_midi_output; Gtk::MenuItem* _menu_add_osc_input; diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index d604ee76..e4f11624 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -2568,6 +2568,15 @@ Contributors: </widget> </child> <child> + <widget class="GtkMenuItem" id="canvas_menu_add_event_input"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Add a generic event input to this patch</property> + <property name="label" translatable="yes">Event</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_canvas_menu_add_event_input_activate"/> + </widget> + </child> + <child> <widget class="GtkMenuItem" id="canvas_menu_add_osc_input"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -2622,6 +2631,15 @@ Contributors: </widget> </child> <child> + <widget class="GtkMenuItem" id="canvas_menu_add_event_output"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Add a generic event output to this patch</property> + <property name="label" translatable="yes">Event</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_canvas_menu_add_event_output_activate"/> + </widget> + </child> + <child> <widget class="GtkMenuItem" id="canvas_menu_add_osc_output"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> |