diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Engine.cpp | 4 | ||||
-rw-r--r-- | src/server/Engine.hpp | 6 | ||||
-rw-r--r-- | src/server/events/Get.cpp | 15 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 23 | ||||
-rw-r--r-- | src/server/wscript | 12 |
5 files changed, 45 insertions, 15 deletions
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 5d27ae2e..9ba52c88 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -179,6 +179,8 @@ Engine::activate() in_properties.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); in_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort)); in_properties.insert(make_pair(uris.lv2_index, 0)); + in_properties.insert(make_pair(uris.lv2_portProperty, + uris.lv2_connectionOptional)); in_properties.insert(make_pair(uris.ingenui_canvas_x, Resource::Property(32.0f, Resource::EXTERNAL))); in_properties.insert(make_pair(uris.ingenui_canvas_y, @@ -193,6 +195,8 @@ Engine::activate() out_properties.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort)); out_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort)); out_properties.insert(make_pair(uris.lv2_index, 1)); + in_properties.insert(make_pair(uris.lv2_portProperty, + uris.lv2_connectionOptional)); out_properties.insert(make_pair(uris.ingenui_canvas_x, Resource::Property(128.0f, Resource::EXTERNAL))); out_properties.insert(make_pair(uris.ingenui_canvas_y, diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index b3cf6688..d4f39bd8 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -70,11 +70,11 @@ public: virtual bool main_iteration(); - void set_driver(SharedPtr<Driver> driver); + virtual void set_driver(SharedPtr<Driver> driver); - void add_event_source(SharedPtr<EventSource> source); + virtual void add_event_source(SharedPtr<EventSource> source); - void process_events(ProcessContext& context); + virtual void process_events(ProcessContext& context); Ingen::Shared::World* world() const { return _world; } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 27bdef92..ae649e1f 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -64,15 +64,20 @@ Get::post_process() { if (_uri == "ingen:plugins") { _request->respond_ok(); - _engine.broadcaster()->send_plugins_to(_request->client(), _plugins); + if (_request->client()) { + _engine.broadcaster()->send_plugins_to(_request->client(), _plugins); + } } else if (!_object && !_plugin) { _request->respond_error("Unable to find object requested."); } else if (_request->client()) { _request->respond_ok(); - if (_object) - ObjectSender::send_object(_request->client(), _object, true); - else if (_plugin) - _request->client()->put(_uri, _plugin->properties()); + if (_request->client()) { + if (_object) { + ObjectSender::send_object(_request->client(), _object, true); + } else if (_plugin) { + _request->client()->put(_uri, _plugin->properties()); + } + } } else { _request->respond_error("Unable to find client to send object."); } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index c8ea9fbe..02eed484 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -17,6 +17,7 @@ */ #include <stdlib.h> +#include <time.h> #include <string> #include <vector> @@ -230,8 +231,25 @@ lv2_descriptor(uint32_t index) return index < lib.patches.size() ? &lib.patches[index]->descriptor : NULL; } +class MainThread : public Raul::Thread +{ +public: + MainThread(SharedPtr<Engine> engine) : _engine(engine) {} + +private: + virtual void _run() { + static const timespec main_rate = { 0, 125000000 }; // 1/8 second + while (_engine->main_iteration()) { + nanosleep(&main_rate, NULL); + } + } + + SharedPtr<Engine> _engine; +}; + struct IngenPlugin { Ingen::Shared::World* world; + MainThread* main; }; static LV2_Handle @@ -264,6 +282,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor, SharedPtr<Server::Engine> engine(new Server::Engine(plugin->world)); plugin->world->set_local_engine(engine); + plugin->main = new MainThread(engine); + plugin->main->set_name("Main"); SharedPtr<Server::QueuedEngineInterface> interface( new Server::QueuedEngineInterface(*engine.get())); @@ -302,6 +322,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->deactivate(); + plugin->world->load_module("osc"); + return (LV2_Handle)plugin; } @@ -326,6 +348,7 @@ ingen_activate(LV2_Handle instance) { IngenPlugin* me = (IngenPlugin*)instance; me->world->local_engine()->activate(); + me->main->start(); } static void diff --git a/src/server/wscript b/src/server/wscript index dd0dfa8f..e0c7a7d1 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -69,8 +69,6 @@ def build(bld): if bld.is_defined('HAVE_SOUP'): obj = bld(features = 'cxx cxxshlib') obj.source = ''' - EventSource.cpp - QueuedEngineInterface.cpp HTTPClientSender.cpp HTTPEngineReceiver.cpp ingen_http.cpp @@ -79,13 +77,12 @@ def build(bld): obj.name = 'libingen_http' obj.target = 'ingen_http' obj.install_path = '${LIBDIR}' + obj.use = 'libingen_server' autowaf.use_lib(bld, obj, core_libs + ' SOUP') if bld.is_defined('HAVE_LIBLO'): obj = bld(features = 'cxx cxxshlib') obj.source = ''' - EventSource.cpp - QueuedEngineInterface.cpp OSCClientSender.cpp OSCEngineReceiver.cpp ingen_osc.cpp @@ -95,6 +92,7 @@ def build(bld): obj.name = 'libingen_osc' obj.target = 'ingen_osc' obj.install_path = '${LIBDIR}' + obj.use = 'libingen_server' autowaf.use_lib(bld, obj, core_libs + ' LIBLO') if bld.is_defined('HAVE_JACK'): @@ -115,7 +113,7 @@ def build(bld): obj.includes = ['.', '..', '../..', '../../include'] obj.name = 'libingen_lv2' obj.target = 'ingen_lv2' - obj.install_path = '${LIBDIR}' - obj.use = 'libingen_shared' - obj.add_objects = 'libingen_server' + #obj.install_path = '${LIBDIR}' + obj.install_path = '${LV2DIR}/ingen.lv2/' + obj.use = 'libingen_server libingen_shared' autowaf.use_lib(bld, obj, core_libs) |