diff options
author | David Robillard <d@drobilla.net> | 2012-09-16 16:59:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-09-16 16:59:35 +0000 |
commit | 86709c5f5345f3a481a28ed378d303331297a466 (patch) | |
tree | 3b8509970ce8e6ca7a436ea26f99886e35605b73 | |
parent | 6f7651bbc136dedc303f435648ff13880cd2b505 (diff) | |
download | ingen-86709c5f5345f3a481a28ed378d303331297a466.tar.gz ingen-86709c5f5345f3a481a28ed378d303331297a466.tar.bz2 ingen-86709c5f5345f3a481a28ed378d303331297a466.zip |
Support latest options and morph extensions.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4776 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | ingen/URIs.hpp | 1 | ||||
-rw-r--r-- | src/URIs.cpp | 2 | ||||
-rw-r--r-- | src/server/LV2Block.cpp | 49 | ||||
-rw-r--r-- | src/server/LV2Options.hpp | 14 | ||||
-rw-r--r-- | wscript | 2 |
5 files changed, 44 insertions, 24 deletions
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index 66107079..6b11d0dc 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -129,6 +129,7 @@ public: const Quark midi_NoteOn; const Quark midi_controllerNumber; const Quark midi_noteNumber; + const Quark morph_currentType; const Quark patch_Delete; const Quark patch_Get; const Quark patch_Move; diff --git a/src/URIs.cpp b/src/URIs.cpp index df02099d..796f45e9 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -20,6 +20,7 @@ #include "lv2/lv2plug.in/ns/ext/buf-size/buf-size.h" #include "lv2/lv2plug.in/ns/ext/log/log.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" +#include "lv2/lv2plug.in/ns/ext/morph/morph.h" #include "lv2/lv2plug.in/ns/ext/patch/patch.h" #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -115,6 +116,7 @@ URIs::URIs(Forge& f, URIMap* map) , midi_NoteOn (forge, map, LV2_MIDI__NoteOn) , midi_controllerNumber (forge, map, LV2_MIDI__controllerNumber) , midi_noteNumber (forge, map, LV2_MIDI__noteNumber) + , morph_currentType (forge, map, LV2_MORPH__currentType) , patch_Delete (forge, map, LV2_PATCH__Delete) , patch_Get (forge, map, LV2_PATCH__Get) , patch_Move (forge, map, LV2_PATCH__Move) diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index b7c1275e..d63f9ae7 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -19,8 +19,9 @@ #include <cassert> #include <cmath> -#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "lv2/lv2plug.in/ns/ext/morph/morph.h" +#include "lv2/lv2plug.in/ns/ext/options/options.h" +#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "raul/Maid.hpp" #include "raul/Array.hpp" @@ -84,8 +85,8 @@ LV2Block::make_instance(URIs& uris, return SharedPtr<LilvInstance>(); } - const LV2_Morph_Interface* morph_iface = (const LV2_Morph_Interface*) - lilv_instance_get_extension_data(inst, LV2_MORPH__interface); + const LV2_Options_Interface* options_iface = (const LV2_Options_Interface*) + lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface); for (uint32_t p = 0; p < num_ports(); ++p) { PortImpl* const port = _ports->at(p); @@ -93,9 +94,14 @@ LV2Block::make_instance(URIs& uris, ? port->prepared_buffer(voice).get() : port->buffer(voice).get(); if (port->is_morph() && port->is_a(PortType::CV)) { - if (morph_iface) { - morph_iface->morph_port( - inst->lv2_handle, p, uris.lv2_CVPort, NULL); + if (options_iface) { + const LV2_URID port_type = uris.lv2_CVPort; + const LV2_Options_Option options[] = { + { LV2_OPTIONS_PORT, p, uris.morph_currentType, + sizeof(LV2_URID), uris.atom_URID, &port_type }, + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL } + }; + options_iface->set(inst->lv2_handle, options); } } @@ -108,21 +114,32 @@ LV2Block::make_instance(URIs& uris, } } - if (morph_iface) { + if (options_iface) { for (uint32_t p = 0; p < num_ports(); ++p) { PortImpl* const port = _ports->at(p); if (port->is_auto_morph()) { - LV2_URID type = morph_iface->port_type( - inst->lv2_handle, p, NULL); - if (type == _uris.lv2_ControlPort) { - port->set_type(PortType::CONTROL, 0); - } else if (type == _uris.lv2_CVPort) { - port->set_type(PortType::CV, 0); + LV2_Options_Option options[] = { + { LV2_OPTIONS_PORT, p, uris.morph_currentType, 0, 0, NULL }, + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, 0 } + }; + + options_iface->get(inst->lv2_handle, options); + if (options[0].value) { + LV2_URID type = *(LV2_URID*)options[0].value; + if (type == _uris.lv2_ControlPort) { + port->set_type(PortType::CONTROL, 0); + } else if (type == _uris.lv2_CVPort) { + port->set_type(PortType::CV, 0); + } else { + parent_graph()->engine().log().error( + Raul::fmt("%1% auto-morphed to unknown type %2%\n") + % port->path().c_str() % type); + return SharedPtr<LilvInstance>(); + } } else { parent_graph()->engine().log().error( - Raul::fmt("%1% auto-morphed to unknown type %2%\n") - % port->path().c_str() % type); - return SharedPtr<LilvInstance>(); + Raul::fmt("Failed to get auto-morphed type of %1%\n") + % port->path().c_str()); } } } diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index fd3801f1..ee8e3ee6 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -57,13 +57,13 @@ struct LV2Options : public Ingen::LV2Features::Feature { Engine& engine = block->parent_graph()->engine(); URIs& uris = engine.world()->uris(); const LV2_Options_Option options[] = { - { uris.bufsz_minBlockLength, sizeof(int32_t), uris.atom_Int, - &_block_length }, - { uris.bufsz_maxBlockLength, sizeof(int32_t), uris.atom_Int, - &_block_length }, - { uris.bufsz_sequenceSize, sizeof(int32_t), uris.atom_Int, - &_seq_size }, - { 0, 0, 0, NULL } + { LV2_OPTIONS_INSTANCE, 0, uris.bufsz_minBlockLength, + sizeof(int32_t), uris.atom_Int, &_block_length }, + { LV2_OPTIONS_INSTANCE, 0, uris.bufsz_maxBlockLength, + sizeof(int32_t), uris.atom_Int, &_block_length }, + { LV2_OPTIONS_INSTANCE, 0, uris.bufsz_sequenceSize, + sizeof(int32_t), uris.atom_Int, &_seq_size }, + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL } }; LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); @@ -37,7 +37,7 @@ def configure(conf): autowaf.display_header('Ingen Configuration') autowaf.check_pkg(conf, 'lv2', uselib_store='LV2', - atleast_version='1.0.13', mandatory=True) + atleast_version='1.0.15', mandatory=True) autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=True) autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', |