diff options
41 files changed, 548 insertions, 1637 deletions
diff --git a/src/bindings/ingen_bindings.cpp b/src/bindings/ingen_bindings.cpp index 30edb8e1..82df3f90 100644 --- a/src/bindings/ingen_bindings.cpp +++ b/src/bindings/ingen_bindings.cpp @@ -4,15 +4,6 @@ #include "engine/Engine.hpp" #include "module/World.hpp" -using namespace std; - -namespace Ingen { -namespace Shared { - -Ingen::Shared::World* ingen_world = NULL; - -extern "C" { - bool run(Ingen::Shared::World* world, const char* filename) { @@ -20,17 +11,35 @@ run(Ingen::Shared::World* world, const char* filename) FILE* fd = fopen(filename, "r"); if (fd) { - cerr << "EXECUTING " << filename << endl; + cerr << "Executing script " << filename << endl; Py_Initialize(); PyRun_SimpleFile(fd, filename); Py_Finalize(); return true; } else { - cerr << "UNABLE TO OPEN FILE " << filename << endl; + cerr << "Unable to open script " << filename << endl; return false; } } +struct IngenBindingsModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + world->script_runners.insert(make_pair("application/x-python", &run)); + //lib->make_resident(); + } +}; + +static IngenBindingsModule* module = NULL; + +extern "C" { + +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenBindingsModule(); + + return module; +} void script_iteration(Ingen::Shared::World* world) @@ -39,8 +48,4 @@ script_iteration(Ingen::Shared::World* world) world->local_engine->main_iteration(); } - -} - -} // namespace Shared -} // namespace Ingen +} // extern "C" diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp index b8229998..879d648a 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/client/HTTPClientReceiver.cpp @@ -127,7 +127,7 @@ HTTPClientReceiver::close_session() void HTTPClientReceiver::update(const std::string& str) { - cout << _parser->parse_update(_world, _target.get(), str, _url); + cout << _world->parser->parse_update(_world, _target.get(), str, _url); } void @@ -185,7 +185,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi } else { Glib::Mutex::Lock lock(me->_mutex); me->_target->response_ok(0); - me->_parser->parse_string(me->_world, me->_target.get(), + me->_world->parser->parse_string(me->_world, me->_target.get(), Glib::ustring(msg->response_body->data), me->_url); } @@ -195,7 +195,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi } else { Glib::Mutex::Lock lock(me->_mutex); me->_target->response_ok(0); - me->_parser->parse_string(me->_world, me->_target.get(), + me->_world->parser->parse_string(me->_world, me->_target.get(), Glib::ustring(msg->response_body->data), Glib::ustring("/patch/")); } @@ -224,16 +224,9 @@ void HTTPClientReceiver::start(bool dump) { Glib::Mutex::Lock lock(_world->rdf_world->mutex()); - if (!_parser) { - if (!_world->serialisation_module) - _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - if (_world->serialisation_module) { - Parser* (*new_parser)() = NULL; - if (_world->serialisation_module->get_symbol("new_parser", (void*&)new_parser)) - _parser = SharedPtr<Parser>(new_parser()); - } - } + + if (!_world->parser) + _world->load("ingen_serialisation"); SoupMessage* msg = soup_message_new("GET", (_url + "/stream").c_str()); soup_session_queue_message(client_session, msg, message_callback, this); diff --git a/src/client/HTTPClientReceiver.hpp b/src/client/HTTPClientReceiver.hpp index 7cb42948..4916ddea 100644 --- a/src/client/HTTPClientReceiver.hpp +++ b/src/client/HTTPClientReceiver.hpp @@ -71,9 +71,8 @@ private: Glib::Mutex _mutex; SharedPtr<Shared::ClientInterface> _target; - Shared::World* _world; - const std::string _url; - SharedPtr<Serialisation::Parser> _parser; + Shared::World* _world; + const std::string _url; }; diff --git a/src/client/client.cpp b/src/client/client.cpp index 53d7810f..9512ba44 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -16,9 +16,9 @@ */ #include "ingen-config.h" - -#include <iostream> -#include "client.hpp" +#include "raul/SharedPtr.hpp" +#include "module/Module.hpp" +#include "module/World.hpp" #ifdef HAVE_LIBLO #include "OSCEngineSender.hpp" #endif @@ -26,39 +26,47 @@ #include "HTTPEngineSender.hpp" #endif +using namespace Ingen; -using namespace std; - -namespace Ingen { -namespace Client { - - +#ifdef HAVE_LIBLO SharedPtr<Ingen::Shared::EngineInterface> -new_remote_interface(Ingen::Shared::World* world, const std::string& url) +new_osc_interface(Ingen::Shared::World* world, const std::string& url) { - const string scheme = url.substr(0, url.find(":")); - -#ifdef HAVE_LIBLO - if (scheme == "osc.udp" || scheme == "osc.tcp") { - OSCEngineSender* oes = OSCEngineSender::create(url); - oes->attach(rand(), true); - return SharedPtr<Shared::EngineInterface>(oes); - } + Client::OSCEngineSender* oes = Client::OSCEngineSender::create(url); + oes->attach(rand(), true); + return SharedPtr<Shared::EngineInterface>(oes); +} #endif #ifdef HAVE_SOUP - if (scheme == "http") { - HTTPEngineSender* hes = new HTTPEngineSender(world, url); - hes->attach(rand(), true); - return SharedPtr<Shared::EngineInterface>(hes); - } +SharedPtr<Ingen::Shared::EngineInterface> +new_http_interface(Ingen::Shared::World* world, const std::string& url) +{ + Client::HTTPEngineSender* hes = new Client::HTTPEngineSender(world, url); + hes->attach(rand(), true); + return SharedPtr<Shared::EngineInterface>(hes); +} #endif - cerr << "WARNING: Unknown URI scheme '" << scheme << "'" << endl; - return SharedPtr<Shared::EngineInterface>(); -} +struct IngenClientModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + world->interface_factories.insert(make_pair("osc.udp", &new_osc_interface)); + world->interface_factories.insert(make_pair("osc.tcp", &new_osc_interface)); + world->interface_factories.insert(make_pair("http", &new_http_interface)); + } +}; +static IngenClientModule* module = NULL; + +extern "C" { + +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenClientModule(); + + return module; +} -} // namespace Client -} // namespace Ingen +} // extern "C" diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 07529caf..432b7afc 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -22,13 +22,13 @@ #include "raul/Deletable.hpp" #include "raul/Maid.hpp" #include "raul/SharedPtr.hpp" +#include "uri-map.lv2/uri-map.h" #include "common/interface/EventType.hpp" #include "events/CreatePatch.hpp" #include "module/World.hpp" #include "shared/LV2Features.hpp" #include "shared/LV2URIMap.hpp" #include "shared/Store.hpp" -#include "uri-map.lv2/uri-map.h" #include "AudioDriver.hpp" #include "BufferFactory.hpp" #include "ClientBroadcaster.hpp" @@ -44,6 +44,7 @@ #include "PostProcessor.hpp" #include "ProcessContext.hpp" #include "ProcessSlave.hpp" +#include "QueuedEngineInterface.hpp" #include "QueuedEventSource.hpp" #include "ThreadManager.hpp" #include "tuning.hpp" @@ -91,7 +92,6 @@ Engine::~Engine() delete _node_factory; delete _osc_driver; delete _post_processor; - //delete _lash_driver; delete _maid; @@ -166,6 +166,13 @@ Engine::main_iteration() } +Ingen::QueuedEngineInterface* +Engine::new_local_interface() +{ + return new Ingen::QueuedEngineInterface(*this, Ingen::event_queue_size); +} + + void Engine::add_event_source(SharedPtr<EventSource> source) { @@ -181,12 +188,14 @@ Engine::set_midi_driver(MidiDriver* driver) bool -Engine::activate(size_t parallelism) +Engine::activate() { assert(_audio_driver); _message_context->Thread::start(); + uint32_t parallelism = _world->conf->option("parallelism").get_int32(); + if (!_midi_driver) _midi_driver = new DummyMidiDriver(); diff --git a/src/engine/Engine.hpp b/src/engine/Engine.hpp index 5851e9a1..a8674c12 100644 --- a/src/engine/Engine.hpp +++ b/src/engine/Engine.hpp @@ -34,20 +34,21 @@ namespace Raul { class Maid; } namespace Ingen { class AudioDriver; -class MidiDriver; -class OSCDriver; -class NodeFactory; +class BufferFactory; class ClientBroadcaster; +class Driver; class EngineStore; +class Event; class EventSource; +class MessageContext; +class MidiDriver; +class NodeFactory; +class OSCDriver; class PostProcessor; -class Event; -class QueuedEvent; -class Driver; -class ProcessSlave; class ProcessContext; -class MessageContext; -class BufferFactory; +class ProcessSlave; +class QueuedEngineInterface; +class QueuedEvent; /** The main class for the Engine. @@ -74,22 +75,22 @@ public: * Note that it will take some time. */ virtual void quit() { _quit_flag = true; } - virtual bool activate(size_t parallelism); + virtual bool activate(); virtual void deactivate(); void process_events(ProcessContext& context); virtual bool activated() { return _activated; } - Raul::Maid* maid() const { return _maid; } - AudioDriver* audio_driver() const { return _audio_driver.get(); } - MidiDriver* midi_driver() const { return _midi_driver; } - OSCDriver* osc_driver() const { return _osc_driver; } - PostProcessor* post_processor() const { return _post_processor; } - ClientBroadcaster* broadcaster() const { return _broadcaster; } - NodeFactory* node_factory() const { return _node_factory; } - MessageContext* message_context() const { return _message_context; } - BufferFactory* buffer_factory() const { return _buffer_factory; } + Raul::Maid* maid() const { return _maid; } + AudioDriver* audio_driver() const { return _audio_driver.get(); } + MidiDriver* midi_driver() const { return _midi_driver; } + OSCDriver* osc_driver() const { return _osc_driver; } + PostProcessor* post_processor() const { return _post_processor; } + ClientBroadcaster* broadcaster() const { return _broadcaster; } + NodeFactory* node_factory() const { return _node_factory; } + MessageContext* message_context() const { return _message_context; } + BufferFactory* buffer_factory() const { return _buffer_factory; } SharedPtr<EngineStore> engine_store() const; @@ -102,6 +103,8 @@ public: virtual void add_event_source(SharedPtr<EventSource> source); + Ingen::QueuedEngineInterface* new_local_interface(); + Ingen::Shared::World* world() { return _world; } typedef std::vector<ProcessSlave*> ProcessSlaves; diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index 532a4371..ecb8d018 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -25,7 +25,6 @@ #include "interface/ClientInterface.hpp" #include "module/Module.hpp" #include "serialisation/Parser.hpp" -#include "serialisation/serialisation.hpp" #include "serialisation/Serialiser.hpp" #include "ClientBroadcaster.hpp" #include "Engine.hpp" @@ -55,20 +54,8 @@ HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine, uint16_t port) cout << "Started HTTP server on port " << soup_server_get_port(_server) << endl; Thread::set_name("HTTP Receiver"); - if (!engine.world()->serialisation_module) - engine.world()->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - if (engine.world()->serialisation_module) { - if (!engine.world()->serialiser) - engine.world()->serialiser = SharedPtr<Serialiser>( - Ingen::Serialisation::new_serialiser(engine.world(), engine.engine_store())); - - if (!engine.world()->parser) - engine.world()->parser = SharedPtr<Parser>( - Ingen::Serialisation::new_parser()); - } else { - cerr << "WARNING: Failed to load ingen_serialisation module, HTTP disabled." << endl; - } + if (!engine.world()->parser || !engine.world()->serialiser) + engine.world()->load("ingen_serialisation"); Thread::set_name("HTTP Receiver"); } @@ -242,14 +229,3 @@ HTTPEngineReceiver::ReceiveThread::_run() } // namespace Ingen - -extern "C" { - -Ingen::HTTPEngineReceiver* -new_http_receiver(Ingen::Engine& engine, uint16_t port) -{ - return new Ingen::HTTPEngineReceiver(engine, port); -} - -} // extern "C" - diff --git a/src/engine/HTTPEngineReceiver.hpp b/src/engine/HTTPEngineReceiver.hpp index db8dd0f7..79101e90 100644 --- a/src/engine/HTTPEngineReceiver.hpp +++ b/src/engine/HTTPEngineReceiver.hpp @@ -55,13 +55,6 @@ private: SoupServer* _server; }; - } // namespace Ingen -extern "C" { - /// Module interface - extern Ingen::HTTPEngineReceiver* new_http_receiver( - Ingen::Engine& engine, uint16_t port); -} - #endif // HTTPENGINERECEIVER_H diff --git a/src/engine/JackAudioDriver.cpp b/src/engine/JackAudioDriver.cpp index bb330435..05b0c45b 100644 --- a/src/engine/JackAudioDriver.cpp +++ b/src/engine/JackAudioDriver.cpp @@ -205,7 +205,8 @@ JackAudioDriver::activate() } if (!_client) - attach("", "ingen", NULL); + attach(_engine.world()->conf->option("jack-server").get_string(), + _engine.world()->conf->option("jack-client").get_string(), NULL); jack_set_process_callback(_client, process_cb, this); @@ -435,19 +436,3 @@ JackAudioDriver::_buffer_size_cb(jack_nframes_t nframes) } // namespace Ingen - -extern "C" { - -Ingen::JackAudioDriver* -new_jack_audio_driver( - Ingen::Engine& engine, - const std::string server_name, - const std::string client_name, - void* jack_client) -{ - Ingen::JackAudioDriver* driver = new Ingen::JackAudioDriver(engine); - driver->attach(server_name, client_name, jack_client); - return driver; -} - -} diff --git a/src/engine/JackAudioDriver.hpp b/src/engine/JackAudioDriver.hpp index 0e062b22..9681dd71 100644 --- a/src/engine/JackAudioDriver.hpp +++ b/src/engine/JackAudioDriver.hpp @@ -191,13 +191,4 @@ inline int JackAudioDriver::sample_rate_cb(jack_nframes_t nframes, void* jack_dr } // namespace Ingen -extern "C" { - /// Module interface - extern Ingen::JackAudioDriver* new_jack_audio_driver( - Ingen::Engine& engine, - std::string server_name = "", - std::string client_name = "", - void* jack_client = 0); -} - #endif // JACKAUDIODRIVER_H diff --git a/src/engine/MessageContext.hpp b/src/engine/MessageContext.hpp index 1195d7f5..c0813e69 100644 --- a/src/engine/MessageContext.hpp +++ b/src/engine/MessageContext.hpp @@ -47,7 +47,7 @@ class MessageContext : public Context, public Raul::Thread public: MessageContext(Engine& engine) : Context(engine, MESSAGE) - , Raul::Thread("message-context") + , Raul::Thread("MessageContext") , _sem(0) , _requests(message_context_queue_size) , _end_time(0) diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index 10e725c1..159397a0 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -764,14 +764,3 @@ OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv } // namespace Ingen - - -extern "C" { - -Ingen::OSCEngineReceiver* -new_osc_receiver(Ingen::Engine& engine, size_t queue_size, uint16_t port) -{ - return new Ingen::OSCEngineReceiver(engine, queue_size, port); -} - -} // extern "C" diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp index c1061792..8285652b 100644 --- a/src/engine/OSCEngineReceiver.hpp +++ b/src/engine/OSCEngineReceiver.hpp @@ -114,10 +114,4 @@ private: } // namespace Ingen -extern "C" { - /// Module interface - extern Ingen::OSCEngineReceiver* new_osc_receiver( - Ingen::Engine& engine, size_t queue_size, uint16_t port); -} - #endif // OSCENGINERECEIVER_H diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index d2ff74df..09e711cc 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -109,7 +109,7 @@ QueuedEngineInterface::activate() static bool in_activate = false; if (!in_activate) { in_activate = true; - _engine.activate(1); + _engine.activate(); } QueuedEventSource::activate_source(); push_queued(new Events::Ping(_engine, _responder, now())); diff --git a/src/engine/ingen.lv2/ingen_lv2.cpp b/src/engine/ingen.lv2/ingen_lv2.cpp index 2dd8cedc..9be7c30a 100644 --- a/src/engine/ingen.lv2/ingen_lv2.cpp +++ b/src/engine/ingen.lv2/ingen_lv2.cpp @@ -98,7 +98,7 @@ ingen_cleanup(LV2_Handle instance) { IngenPlugin* plugin = (IngenPlugin*)instance; plugin->engine.reset(); - Ingen::Shared::destroy_world(); + ingen_destroy_world(); free(instance); } @@ -120,7 +120,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, Shared::bundle_path = bundle_path; - plugin->world = Ingen::Shared::get_world(); + plugin->world = ingen_get_world(); plugin->engine = SharedPtr<Engine>(new Engine(plugin->world)); plugin->world->local_engine = plugin->engine; diff --git a/src/engine/ingen_engine.cpp b/src/engine/ingen_engine.cpp index 07d2c921..b5fe92a9 100644 --- a/src/engine/ingen_engine.cpp +++ b/src/engine/ingen_engine.cpp @@ -15,39 +15,35 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <cstdio> -#include <string> -#include "raul/Process.hpp" -#include "ingen_engine.hpp" +#include "module/Module.hpp" #include "Engine.hpp" -#include "tuning.hpp" +#include "QueuedEngineInterface.hpp" #include "util.hpp" +#include "tuning.hpp" -namespace Ingen { - -Engine* -new_engine(Ingen::Shared::World* world) -{ - set_denormal_flags(); - return new Engine(world); -} +using namespace Ingen; +struct IngenEngineModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + set_denormal_flags(); + world->local_engine = SharedPtr<Engine>(new Engine(world)); + SharedPtr<QueuedEngineInterface> interface( + new Ingen::QueuedEngineInterface(*world->local_engine, event_queue_size)); + world->engine = interface; + world->local_engine->add_event_source(interface); + } +}; -bool -launch_osc_engine(int port) -{ - char port_str[6]; - snprintf(port_str, 6, "%u", port); - const std::string cmd = std::string("ingen -e --engine-port=").append(port_str); +static IngenEngineModule* module = NULL; - if (Raul::Process::launch(cmd)) { - return true; - } else { - std::cerr << "Failed to launch engine process." << std::endl; - return false; - } -} +extern "C" { +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenEngineModule(); -} // namespace Ingen + return module; +} +} // extern "C" diff --git a/src/client/client.hpp b/src/engine/ingen_http.cpp index 9ad1423a..dade5bd3 100644 --- a/src/client/client.hpp +++ b/src/engine/ingen_http.cpp @@ -15,31 +15,35 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_CLIENT_H -#define INGEN_CLIENT_H - -#include "raul/SharedPtr.hpp" - -namespace Ingen { - -class Engine; - -namespace Shared { class EngineInterface; class World; } - -namespace Client { +#include <iostream> +#include "module/Module.hpp" +#include "module/World.hpp" +#include "HTTPEngineReceiver.hpp" +#include "Engine.hpp" +#include "tuning.hpp" + +using namespace std; +using namespace Ingen; + +struct IngenHTTPModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + SharedPtr<HTTPEngineReceiver> interface( + new Ingen::HTTPEngineReceiver(*world->local_engine.get(), + world->conf->option("engine-port").get_int32())); + world->local_engine->add_event_source(interface); + } +}; + +static IngenHTTPModule* module = NULL; extern "C" { - SharedPtr<Shared::EngineInterface> new_remote_interface( - Shared::World* world, const std::string& url); - - SharedPtr<Shared::EngineInterface> new_queued_interface(SharedPtr<Ingen::Engine> engine); +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenHTTPModule(); + return module; } - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_H - +} // extern "C" diff --git a/src/gui/gui.hpp b/src/engine/ingen_jack.cpp index 19eabe0b..a721383d 100644 --- a/src/gui/gui.hpp +++ b/src/engine/ingen_jack.cpp @@ -15,26 +15,34 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_GUI_H -#define INGEN_GUI_H - -namespace Ingen { - -namespace Shared { class World; } - -namespace GUI { - +#include <iostream> +#include "module/Module.hpp" +#include "module/World.hpp" +#include "JackAudioDriver.hpp" +#include "Engine.hpp" + +using namespace std; +using namespace Ingen; + +struct IngenJackModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + Ingen::JackAudioDriver* driver = new Ingen::JackAudioDriver(*world->local_engine.get()); + driver->attach(world->conf->option("jack-server").get_string(), + world->conf->option("jack-client").get_string(), NULL); + world->local_engine->set_driver(Shared::PortType::AUDIO, SharedPtr<Driver>(driver)); + } +}; + +static IngenJackModule* module = NULL; extern "C" { - void init(int argc, char** argv, Ingen::Shared::World* world); - void run(); +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenJackModule(); + return module; } - -} // namesace GUI -} // namespace Ingen - -#endif // INGEN_GUI_H - +} // extern "C" diff --git a/src/engine/ingen_engine.hpp b/src/engine/ingen_osc.cpp index c55b7809..0599adb8 100644 --- a/src/engine/ingen_engine.hpp +++ b/src/engine/ingen_osc.cpp @@ -15,28 +15,36 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_ENGINE_H -#define INGEN_ENGINE_H - -namespace Ingen { - -namespace Shared { class World; } - -class Engine; +#include <iostream> +#include "module/Module.hpp" +#include "module/World.hpp" +#include "OSCEngineReceiver.hpp" +#include "Engine.hpp" +#include "tuning.hpp" + +using namespace std; +using namespace Ingen; + +struct IngenOSCModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + cout << "FIXME: OSC port" << endl; + uint16_t port = 16180; + SharedPtr<OSCEngineReceiver> interface( + new Ingen::OSCEngineReceiver(*world->local_engine.get(), event_queue_size, port)); + world->local_engine->add_event_source(interface); + } +}; + +static IngenOSCModule* module = NULL; extern "C" { - /** Create a new engine in this process */ - Engine* new_engine(Ingen::Shared::World* world); +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenOSCModule(); - /** Launch an OSC engine as a completely separate process - * \return true if successful - */ - bool launch_osc_engine(int port); + return module; } - -} // namespace Ingen - -#endif // INGEN_ENGINE_H - +} // extern "C" diff --git a/src/engine/wscript b/src/engine/wscript index ee98b125..10478637 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -31,33 +31,8 @@ def build(bld): PortImpl.cpp PostProcessor.cpp ProcessSlave.cpp - QueuedEvent.cpp - events/SendPortActivity.cpp - events/SendPortValue.cpp - ingen_engine.cpp - internals/Controller.cpp - internals/Note.cpp - internals/Trigger.cpp - ''' - - obj = bld.new_task_gen('cxx', 'shlib') - obj.source = core_source - if bld.env['HAVE_LADSPA_H'] == 1: - obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp ' - if bld.env['HAVE_SLV2'] == 1: - obj.source += ' LV2Info.cpp LV2Plugin.cpp LV2Node.cpp ' - obj.export_incdirs = ['.'] - obj.includes = ['.', '..', '../..', '../common'] - obj.name = 'libingen_engine' - obj.target = 'ingen_engine' - obj.install_path = '${LIBDIR}/ingen' - obj.uselib_local = 'libingen_shared' - core_libs = 'GLIBMM GTHREAD LV2CORE SLV2 RAUL REDLANDMM' - autowaf.use_lib(bld, obj, core_libs) - - obj = bld.new_task_gen('cxx', 'shlib') - obj.source = ''' QueuedEngineInterface.cpp + QueuedEvent.cpp QueuedEventSource.cpp events/AllNotesOff.cpp events/ClearPatch.cpp @@ -77,15 +52,30 @@ def build(bld): events/RequestAllObjects.cpp events/RequestMetadata.cpp events/RequestPlugins.cpp + events/SendPortActivity.cpp + events/SendPortValue.cpp events/SetMetadata.cpp events/SetPortValue.cpp events/UnregisterClient.cpp + ingen_engine.cpp + internals/Controller.cpp + internals/Note.cpp + internals/Trigger.cpp ''' + + obj = bld.new_task_gen('cxx', 'shlib') + obj.source = core_source + if bld.env['HAVE_LADSPA_H'] == 1: + obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp ' + if bld.env['HAVE_SLV2'] == 1: + obj.source += ' LV2Info.cpp LV2Plugin.cpp LV2Node.cpp ' obj.export_incdirs = ['.'] - obj.includes = ['.', '..', '../..', '../common', '../engine'] - obj.name = 'libingen_engine_queued' - obj.target = 'ingen_engine_queued' + obj.includes = ['.', '..', '../..', '../common'] + obj.name = 'libingen_engine' + obj.target = 'ingen_engine' obj.install_path = '${LIBDIR}/ingen' + obj.uselib_local = 'libingen_shared' + core_libs = 'GLIBMM GTHREAD LV2CORE SLV2 RAUL REDLANDMM' autowaf.use_lib(bld, obj, core_libs) if bld.env['HAVE_SOUP'] == 1: @@ -95,10 +85,11 @@ def build(bld): QueuedEngineInterface.cpp HTTPClientSender.cpp HTTPEngineReceiver.cpp + ingen_http.cpp ''' obj.includes = ['.', '..', '../..', '../common', '../engine'] - obj.name = 'libingen_engine_http' - obj.target = 'ingen_engine_http' + obj.name = 'libingen__http' + obj.target = 'ingen_http' obj.install_path = '${LIBDIR}/ingen' autowaf.use_lib(bld, obj, core_libs + ' SOUP') @@ -109,21 +100,22 @@ def build(bld): QueuedEngineInterface.cpp OSCClientSender.cpp OSCEngineReceiver.cpp + ingen_osc.cpp ''' obj.export_incdirs = ['.'] obj.includes = ['.', '..', '../..', '../common', '../engine'] - obj.name = 'libingen_engine_osc' - obj.target = 'ingen_engine_osc' + obj.name = 'libingen_osc' + obj.target = 'ingen_osc' obj.install_path = '${LIBDIR}/ingen' autowaf.use_lib(bld, obj, core_libs + ' LIBLO') if bld.env['HAVE_JACK'] == 1: obj = bld.new_task_gen('cxx', 'shlib') - obj.source = 'JackAudioDriver.cpp JackMidiDriver.cpp' + obj.source = 'JackAudioDriver.cpp JackMidiDriver.cpp ingen_jack.cpp' obj.export_incdirs = ['.'] obj.includes = ['.', '..', '../..', '../common', '../engine'] - obj.name = 'libingen_engine_jack' - obj.target = 'ingen_engine_jack' + obj.name = 'libingen_jack' + obj.target = 'ingen_jack' obj.install_path = '${LIBDIR}/ingen' autowaf.use_lib(bld, obj, core_libs + ' JACK') diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 29b00283..f42ddcb4 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -30,7 +30,6 @@ #include "module/World.hpp" #include "engine/Engine.hpp" #include "interface/EngineInterface.hpp" -#include "serialisation/serialisation.hpp" #include "client/ObjectModel.hpp" #include "client/PatchModel.hpp" #include "client/ClientStore.hpp" @@ -102,10 +101,10 @@ App::~App() } void -App::init(int argc, char** argv, Ingen::Shared::World* world) +App::init(Ingen::Shared::World* world) { Gnome::Canvas::init(); - _main = new Gtk::Main(argc, argv); + _main = new Gtk::Main(world->argc, world->argv); if (!_instance) _instance = new App(world); @@ -121,19 +120,19 @@ App::init(int argc, char** argv, Ingen::Shared::World* world) // Set style for embedded node GUIs const string rc_style = - "style \"ingen_embedded_node_gui_style\" {" - " bg[NORMAL] = \"#212222\"" - " bg[ACTIVE] = \"#505050\"" - " bg[PRELIGHT] = \"#525454\"" - " bg[SELECTED] = \"#99A0A0\"" - " bg[INSENSITIVE] = \"#F03030\"" - " fg[NORMAL] = \"#FFFFFF\"" - " fg[ACTIVE] = \"#FFFFFF\"" - " fg[PRELIGHT] = \"#FFFFFF\"" - " fg[SELECTED] = \"#FFFFFF\"" - " fg[INSENSITIVE] = \"#FFFFFF\"" - "}\n" - "widget \"*ingen_embedded_node_gui_container*\" style \"ingen_embedded_node_gui_style\"\n"; + "style \"ingen_embedded_node_gui_style\" {\n" + "bg[NORMAL] = \"#212222\"\n" + "bg[ACTIVE] = \"#505050\"\n" + "bg[PRELIGHT] = \"#525454\"\n" + "bg[SELECTED] = \"#99A0A0\"\n" + "bg[INSENSITIVE] = \"#F03030\"\n" + "fg[NORMAL] = \"#FFFFFF\"\n" + "fg[ACTIVE] = \"#FFFFFF\"\n" + "fg[PRELIGHT] = \"#FFFFFF\"\n" + "fg[SELECTED] = \"#FFFFFF\"\n" + "fg[INSENSITIVE] = \"#FFFFFF\"\n" + "}\n" + "widget \"*ingen_embedded_node_gui_container*\" style \"ingen_embedded_node_gui_style\"\n"; Gtk::RC::parse_string(rc_style); @@ -168,7 +167,7 @@ App::attach(SharedPtr<SigClientInterface> client, _client = client; _handle = handle; - _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client)); + _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client)); _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine)); _patch_tree_window->init(*_store); @@ -197,17 +196,10 @@ App::detach() const SharedPtr<Serialiser>& App::serialiser() { - if (!_serialiser) { - if (!_world->serialisation_module) - _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); + if (!_world->serialiser) + _world->load("ingen_serialisation"); - if (_world->serialisation_module) - _serialiser = SharedPtr<Serialiser>(Ingen::Serialisation::new_serialiser(_world, _store)); - - if (!_serialiser) - cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl; - } - return _serialiser; + return _world->serialiser; } diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 0e21d423..bf55d51b 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -111,7 +111,7 @@ public: static inline App& instance() { assert(_instance); return *_instance; } - static void init(int argc, char** argv, Ingen::Shared::World* world); + static void init(Ingen::Shared::World* world); static void run(); Ingen::Shared::World* world() { return _world; } @@ -145,7 +145,6 @@ protected: SharedPtr<Client::SigClientInterface> _client; SharedPtr<Raul::Deletable> _handle; SharedPtr<Client::ClientStore> _store; - SharedPtr<Serialisation::Serialiser> _serialiser; SharedPtr<ThreadedLoader> _loader; Configuration* _configuration; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index c939f5ea..1416bf2c 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -24,6 +24,7 @@ #include "raul/Process.hpp" #include "ingen-config.h" #include "interface/EngineInterface.hpp" +#include "module/Module.hpp" #include "module/World.hpp" #include "engine/tuning.hpp" #include "engine/Engine.hpp" @@ -40,7 +41,6 @@ #include "client/ClientStore.hpp" #include "client/PatchModel.hpp" #include "client/ThreadedSigClientInterface.hpp" -#include "module/Module.hpp" #include "App.hpp" #include "WindowFactory.hpp" #include "ConnectWindow.hpp" @@ -55,9 +55,6 @@ namespace Ingen { namespace GUI { -// ConnectWindow - - ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Dialog(cobject) , _xml(xml) @@ -67,7 +64,6 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: , _finished_connecting(false) , _widgets_loaded(false) , _connect_stage(0) - , _new_engine(NULL) { } @@ -112,7 +108,7 @@ ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine) _connect_button->set_sensitive(true); _disconnect_button->set_sensitive(false); - if (_new_engine) + if (App::instance().world()->local_engine) _internal_radio->set_sensitive(true); else _internal_radio->set_sensitive(false); @@ -181,6 +177,8 @@ ConnectWindow::connect(bool existing) if (existing) uri = world->engine->uri().str(); + cout << "CONNECT EXISTING " << existing << " URI " << uri << endl; + // Create client-side listener SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); SharedPtr<Raul::Deletable> client; @@ -247,36 +245,15 @@ ConnectWindow::connect(bool existing) } else #endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP) if (_mode == INTERNAL) { - if ( ! world->local_engine) { - assert(_new_engine); - world->local_engine = SharedPtr<Engine>(_new_engine(world)); - } - - if ( ! world->engine) { - SharedPtr<QueuedEngineInterface> interface( - new QueuedEngineInterface(*world->local_engine, Ingen::event_queue_size)); - world->engine = interface; - world->local_engine->add_event_source(interface); - } + if (!world->local_engine) + world->load("ingen_engine"); SharedPtr<SigClientInterface> client(new SigClientInterface()); - Ingen::Driver* (*new_driver)( - Ingen::Engine& engine, - const std::string server_name, - const std::string client_name, - void* jack_client) = NULL; - - if (!world->local_engine->audio_driver()) { - bool found = _engine_jack_module->get_symbol( - "new_jack_audio_driver", (void*&)(new_driver)); - if (found) { - world->local_engine->set_driver(PortType::AUDIO, - SharedPtr<Driver>(new_driver(*world->local_engine, "default", "", 0))); - } - } + if (!world->local_engine->audio_driver()) + world->load("ingen_jack"); - world->local_engine->activate(1); // FIXME: parallelism + world->local_engine->activate(); App::instance().attach(client); App::instance().register_callbacks(); @@ -365,17 +342,6 @@ ConnectWindow::load_widgets() _progress_bar->set_pulse_step(0.01); _widgets_loaded = true; - _engine_module = Ingen::Shared::load_module("ingen_engine"); - if (!_engine_module) - cerr << "Unable to load ingen_engine module, internal engine unavailable." << endl; - bool found = _engine_module->get_symbol("new_engine", (void*&)_new_engine); - if (!found) { - cerr << "Unable to find module entry point, internal engine unavailable." << endl; - _engine_module.reset(); - } - - _engine_jack_module = Ingen::Shared::load_module("ingen_engine_jack"); - server_toggled(); } @@ -454,14 +420,8 @@ ConnectWindow::gtk_callback() } } - /* Connecting to engine */ if (_connect_stage == 0) { - _attached = false; - - assert(App::instance().engine()); - assert(App::instance().client()); - App::instance().client()->signal_response_ok.connect( sigc::mem_fun(this, &ConnectWindow::on_response)); diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 42332813..c94c287a 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -87,10 +87,6 @@ private: bool _widgets_loaded; int _connect_stage; - SharedPtr<Glib::Module> _engine_module; - SharedPtr<Glib::Module> _engine_jack_module; - Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world); - Gtk::Image* _icon; Gtk::ProgressBar* _progress_bar; Gtk::Label* _progress_label; diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index aaab8bdf..c83bc04c 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -306,7 +306,7 @@ PatchCanvas::show_port_names(bool b) { _show_port_names = b; for (ItemList::iterator i = _items.begin(); i != _items.end(); ++i) { - boost::shared_ptr<Module> m = boost::dynamic_pointer_cast<Module>(*i); + boost::shared_ptr<FlowCanvas::Module> m = boost::dynamic_pointer_cast<FlowCanvas::Module>(*i); if (m) m->set_show_port_labels(b); } diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 1a2a209e..ae5c995f 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -19,6 +19,7 @@ #include <string> #include "module/World.hpp" #include "module/Module.hpp" +#include "module/ingen_module.hpp" #include "App.hpp" #include "ThreadedLoader.hpp" #include "client/PatchModel.hpp" @@ -46,24 +47,12 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) SharedPtr<Parser> ThreadedLoader::parser() { - if (_parser) - return _parser; + Ingen::Shared::World* world = ingen_get_world(); - World* world = App::instance().world(); - if (!world->serialisation_module) - world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); + if (!world->parser) + world->load("ingen_serialisation"); - if (world->serialisation_module) { - Parser* (*new_parser)() = NULL; - - bool found = App::instance().world()->serialisation_module->get_symbol( - "new_parser", (void*&)new_parser); - - if (found) - _parser = SharedPtr<Parser>(new_parser()); - } - - return _parser; + return world->parser; } @@ -90,6 +79,8 @@ ThreadedLoader::load_patch(bool merge, { _mutex.lock(); + Ingen::Shared::World* world = ingen_get_world(); + Glib::ustring engine_base = ""; if (engine_parent) { if (merge) @@ -110,7 +101,7 @@ ThreadedLoader::load_patch(bool merge, false))); } else { _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document), + sigc::mem_fun(world->parser.get(), &Ingen::Serialisation::Parser::parse_document), App::instance().world(), App::instance().world()->engine.get(), document_uri, diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 6f7e331f..be86c95b 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -78,7 +78,6 @@ private: void _whipped(); SharedPtr<EngineInterface> _engine; - SharedPtr<Parser> _parser; DeprecatedLoader _deprecated_loader; Glib::Mutex _mutex; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ab6a1297..d1ad6c99 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -15,29 +15,27 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "gui.hpp" -#include "ConnectWindow.hpp" +#include "module/Module.hpp" #include "App.hpp" -#include "Configuration.hpp" -namespace Ingen { -namespace GUI { +struct IngenGUIModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + Ingen::GUI::App::init(world); + Ingen::GUI::App::run(); + } +}; +static IngenGUIModule* module = NULL; -void -init(int argc, char** argv, Ingen::Shared::World* world) -{ - App::init(argc, argv, world); -} +extern "C" { +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenGUIModule(); -void -run() -{ - App::run(); + return module; } - -} // namespace GUI -} // namespace Ingen +} // extern "C" diff --git a/src/ingen/cmdline.c b/src/ingen/cmdline.c deleted file mode 100644 index 5724160a..00000000 --- a/src/ingen/cmdline.c +++ /dev/null @@ -1,687 +0,0 @@ -/* - File autogenerated by gengetopt - generated with the following command: - gengetopt -g - - The developers of gengetopt consider the fixed text that goes in all - gengetopt output files to be in the public domain: - we make no copyright claims on it. -*/ - -/* If we use autoconf. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "getopt.h" - -#include "cmdline.h" - -const char *gengetopt_args_info_purpose = "A modular realtime audio processing system"; - -const char *gengetopt_args_info_usage = "Usage: ingen [OPTIONS]..."; - -const char *gengetopt_args_info_description = "Ingen can be run in various configurations. The engine can\nrun as a stand-alone server controlled by OSC, or internal to\nanother process (e.g. the GUI). The GUI can communicate with the engine\nvia either method, and many GUIs (or other things) may connect to an\nengine via OSC.\n\nExamples:\n\n ingen -e - Run an engine, listen for OSC \n ingen -g - Run a GUI, connect via OSC \n ingen -eg - Run an engine and a GUI in one process\n\nThe -l (load) option can be used in all cases:\n \n ingen -el patch.ingen.ttl - Run an engine and load a patch\n ingen -gl patch.ingen.ttl - Run a GUI and load a patch\n ingen -egl patch.ingen.ttl - Run an engine and a GUI and load a patch\n\nOptions:\n"; - -const char *gengetopt_args_info_help[] = { - " -h, --help Print help and exit", - " -V, --version Print version and exit", - " -C, --client-port=INT Client OSC port", - " -c, --connect=STRING Connect to existing engine at URI \n (default=`osc.udp://localhost:16180')", - " -e, --engine Run (JACK) engine (default=off)", - " -E, --engine-port=INT Engine listen port (default=`16180')", - " -n, --engine-name=STRING Engine JACK client name (default=`ingen')", - " -g, --gui Launch the GTK graphical interface (default=off)", - " -l, --load=STRING Load patch", - " -p, --parallelism=INT Number of concurrent process threads (default=`1')", - " -L, --path=STRING Target path for loaded patch", - " -r, --run=STRING Run script", - 0 -}; - -typedef enum {ARG_NO - , ARG_FLAG - , ARG_STRING - , ARG_INT -} cmdline_parser_arg_type; - -static -void clear_given (struct gengetopt_args_info *args_info); -static -void clear_args (struct gengetopt_args_info *args_info); - -static int -cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params, const char *additional_error); - - -static char * -gengetopt_strdup (const char *s); - -static -void clear_given (struct gengetopt_args_info *args_info) -{ - args_info->help_given = 0 ; - args_info->version_given = 0 ; - args_info->client_port_given = 0 ; - args_info->connect_given = 0 ; - args_info->engine_given = 0 ; - args_info->engine_port_given = 0 ; - args_info->engine_name_given = 0 ; - args_info->gui_given = 0 ; - args_info->load_given = 0 ; - args_info->parallelism_given = 0 ; - args_info->path_given = 0 ; - args_info->run_given = 0 ; -} - -static -void clear_args (struct gengetopt_args_info *args_info) -{ - args_info->client_port_orig = NULL; - args_info->connect_arg = gengetopt_strdup ("osc.udp://localhost:16180"); - args_info->connect_orig = NULL; - args_info->engine_flag = 0; - args_info->engine_port_arg = 16180; - args_info->engine_port_orig = NULL; - args_info->engine_name_arg = gengetopt_strdup ("ingen"); - args_info->engine_name_orig = NULL; - args_info->gui_flag = 0; - args_info->load_arg = NULL; - args_info->load_orig = NULL; - args_info->parallelism_arg = 1; - args_info->parallelism_orig = NULL; - args_info->path_arg = NULL; - args_info->path_orig = NULL; - args_info->run_arg = NULL; - args_info->run_orig = NULL; - -} - -static -void init_args_info(struct gengetopt_args_info *args_info) -{ - - - args_info->help_help = gengetopt_args_info_help[0] ; - args_info->version_help = gengetopt_args_info_help[1] ; - args_info->client_port_help = gengetopt_args_info_help[2] ; - args_info->connect_help = gengetopt_args_info_help[3] ; - args_info->engine_help = gengetopt_args_info_help[4] ; - args_info->engine_port_help = gengetopt_args_info_help[5] ; - args_info->engine_name_help = gengetopt_args_info_help[6] ; - args_info->gui_help = gengetopt_args_info_help[7] ; - args_info->load_help = gengetopt_args_info_help[8] ; - args_info->parallelism_help = gengetopt_args_info_help[9] ; - args_info->path_help = gengetopt_args_info_help[10] ; - args_info->run_help = gengetopt_args_info_help[11] ; - -} - -void -cmdline_parser_print_version (void) -{ - printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); -} - -static void print_help_common(void) { - cmdline_parser_print_version (); - - if (strlen(gengetopt_args_info_purpose) > 0) - printf("\n%s\n", gengetopt_args_info_purpose); - - if (strlen(gengetopt_args_info_usage) > 0) - printf("\n%s\n", gengetopt_args_info_usage); - - printf("\n"); - - if (strlen(gengetopt_args_info_description) > 0) - printf("%s\n\n", gengetopt_args_info_description); -} - -void -cmdline_parser_print_help (void) -{ - int i = 0; - print_help_common(); - while (gengetopt_args_info_help[i]) - printf("%s\n", gengetopt_args_info_help[i++]); -} - -void -cmdline_parser_init (struct gengetopt_args_info *args_info) -{ - clear_given (args_info); - clear_args (args_info); - init_args_info (args_info); -} - -void -cmdline_parser_params_init(struct cmdline_parser_params *params) -{ - if (params) - { - params->override = 0; - params->initialize = 1; - params->check_required = 1; - params->check_ambiguity = 0; - params->print_errors = 1; - } -} - -struct cmdline_parser_params * -cmdline_parser_params_create(void) -{ - struct cmdline_parser_params *params = - (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); - cmdline_parser_params_init(params); - return params; -} - -static void -free_string_field (char **s) -{ - if (*s) - { - free (*s); - *s = 0; - } -} - - -static void -cmdline_parser_release (struct gengetopt_args_info *args_info) -{ - - free_string_field (&(args_info->client_port_orig)); - free_string_field (&(args_info->connect_arg)); - free_string_field (&(args_info->connect_orig)); - free_string_field (&(args_info->engine_port_orig)); - free_string_field (&(args_info->engine_name_arg)); - free_string_field (&(args_info->engine_name_orig)); - free_string_field (&(args_info->load_arg)); - free_string_field (&(args_info->load_orig)); - free_string_field (&(args_info->parallelism_orig)); - free_string_field (&(args_info->path_arg)); - free_string_field (&(args_info->path_orig)); - free_string_field (&(args_info->run_arg)); - free_string_field (&(args_info->run_orig)); - - - - clear_given (args_info); -} - - -static void -write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) -{ - if (arg) { - fprintf(outfile, "%s=\"%s\"\n", opt, arg); - } else { - fprintf(outfile, "%s\n", opt); - } -} - - -int -cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) -{ - int i = 0; - - if (!outfile) - { - fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); - return EXIT_FAILURE; - } - - if (args_info->help_given) - write_into_file(outfile, "help", 0, 0 ); - if (args_info->version_given) - write_into_file(outfile, "version", 0, 0 ); - if (args_info->client_port_given) - write_into_file(outfile, "client-port", args_info->client_port_orig, 0); - if (args_info->connect_given) - write_into_file(outfile, "connect", args_info->connect_orig, 0); - if (args_info->engine_given) - write_into_file(outfile, "engine", 0, 0 ); - if (args_info->engine_port_given) - write_into_file(outfile, "engine-port", args_info->engine_port_orig, 0); - if (args_info->engine_name_given) - write_into_file(outfile, "engine-name", args_info->engine_name_orig, 0); - if (args_info->gui_given) - write_into_file(outfile, "gui", 0, 0 ); - if (args_info->load_given) - write_into_file(outfile, "load", args_info->load_orig, 0); - if (args_info->parallelism_given) - write_into_file(outfile, "parallelism", args_info->parallelism_orig, 0); - if (args_info->path_given) - write_into_file(outfile, "path", args_info->path_orig, 0); - if (args_info->run_given) - write_into_file(outfile, "run", args_info->run_orig, 0); - - - i = EXIT_SUCCESS; - return i; -} - -int -cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) -{ - FILE *outfile; - int i = 0; - - outfile = fopen(filename, "w"); - - if (!outfile) - { - fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); - return EXIT_FAILURE; - } - - i = cmdline_parser_dump(outfile, args_info); - fclose (outfile); - - return i; -} - -void -cmdline_parser_free (struct gengetopt_args_info *args_info) -{ - cmdline_parser_release (args_info); -} - -/** @brief replacement of strdup, which is not standard */ -char * -gengetopt_strdup (const char *s) -{ - char *result = NULL; - if (!s) - return result; - - result = (char*)malloc(strlen(s) + 1); - if (result == (char*)0) - return (char*)0; - strcpy(result, s); - return result; -} - -int -cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) -{ - return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); -} - -int -cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params) -{ - int result; - result = cmdline_parser_internal (argc, argv, args_info, params, NULL); - - if (result == EXIT_FAILURE) - { - cmdline_parser_free (args_info); - exit (EXIT_FAILURE); - } - - return result; -} - -int -cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) -{ - int result; - struct cmdline_parser_params params; - - params.override = override; - params.initialize = initialize; - params.check_required = check_required; - params.check_ambiguity = 0; - params.print_errors = 1; - - result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); - - if (result == EXIT_FAILURE) - { - cmdline_parser_free (args_info); - exit (EXIT_FAILURE); - } - - return result; -} - -int -cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) -{ - return EXIT_SUCCESS; -} - - -static char *package_name = 0; - -/** - * @brief updates an option - * @param field the generic pointer to the field to update - * @param orig_field the pointer to the orig field - * @param field_given the pointer to the number of occurrence of this option - * @param prev_given the pointer to the number of occurrence already seen - * @param value the argument for this option (if null no arg was specified) - * @param possible_values the possible values for this option (if specified) - * @param default_value the default value (in case the option only accepts fixed values) - * @param arg_type the type of this option - * @param check_ambiguity @see cmdline_parser_params.check_ambiguity - * @param override @see cmdline_parser_params.override - * @param no_free whether to free a possible previous value - * @param multiple_option whether this is a multiple option - * @param long_opt the corresponding long option - * @param short_opt the corresponding short option (or '-' if none) - * @param additional_error possible further error specification - */ -static -int update_arg(void *field, char **orig_field, - unsigned int *field_given, unsigned int *prev_given, - char *value, char *possible_values[], const char *default_value, - cmdline_parser_arg_type arg_type, - int check_ambiguity, int override, - int no_free, int multiple_option, - const char *long_opt, char short_opt, - const char *additional_error) -{ - char *stop_char = 0; - const char *val = value; - int found; - char **string_field; - - stop_char = 0; - found = 0; - - if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) - { - if (short_opt != '-') - fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", - package_name, long_opt, short_opt, - (additional_error ? additional_error : "")); - else - fprintf (stderr, "%s: `--%s' option given more than once%s\n", - package_name, long_opt, - (additional_error ? additional_error : "")); - return 1; /* failure */ - } - - - if (field_given && *field_given && ! override) - return 0; - if (prev_given) - (*prev_given)++; - if (field_given) - (*field_given)++; - if (possible_values) - val = possible_values[found]; - - switch(arg_type) { - case ARG_FLAG: - *((int *)field) = !*((int *)field); - break; - case ARG_INT: - if (val) *((int *)field) = strtol (val, &stop_char, 0); - break; - case ARG_STRING: - if (val) { - string_field = (char **)field; - if (!no_free && *string_field) - free (*string_field); /* free previous string */ - *string_field = gengetopt_strdup (val); - } - break; - default: - break; - }; - - /* check numeric conversion */ - switch(arg_type) { - case ARG_INT: - if (val && !(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); - return 1; /* failure */ - } - break; - default: - ; - }; - - /* store the original value */ - switch(arg_type) { - case ARG_NO: - case ARG_FLAG: - break; - default: - if (value && orig_field) { - if (no_free) { - *orig_field = value; - } else { - if (*orig_field) - free (*orig_field); /* free previous string */ - *orig_field = gengetopt_strdup (value); - } - } - }; - - return 0; /* OK */ -} - - -int -cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params, const char *additional_error) -{ - int c; /* Character of the parsed option. */ - - int error = 0; - struct gengetopt_args_info local_args_info; - - int override; - int initialize; - int check_required; - int check_ambiguity; - - package_name = argv[0]; - - override = params->override; - initialize = params->initialize; - check_required = params->check_required; - check_ambiguity = params->check_ambiguity; - - if (initialize) - cmdline_parser_init (args_info); - - cmdline_parser_init (&local_args_info); - - optarg = 0; - optind = 0; - opterr = params->print_errors; - optopt = '?'; - - while (1) - { - int option_index = 0; - - static struct option long_options[] = { - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, - { "client-port", 1, NULL, 'C' }, - { "connect", 1, NULL, 'c' }, - { "engine", 0, NULL, 'e' }, - { "engine-port", 1, NULL, 'E' }, - { "engine-name", 1, NULL, 'n' }, - { "gui", 0, NULL, 'g' }, - { "load", 1, NULL, 'l' }, - { "parallelism", 1, NULL, 'p' }, - { "path", 1, NULL, 'L' }, - { "run", 1, NULL, 'r' }, - { NULL, 0, NULL, 0 } - }; - - c = getopt_long (argc, argv, "hVC:c:eE:n:gl:p:L:r:", long_options, &option_index); - - if (c == -1) break; /* Exit from `while (1)' loop. */ - - switch (c) - { - case 'h': /* Print help and exit. */ - cmdline_parser_print_help (); - cmdline_parser_free (&local_args_info); - exit (EXIT_SUCCESS); - - case 'V': /* Print version and exit. */ - cmdline_parser_print_version (); - cmdline_parser_free (&local_args_info); - exit (EXIT_SUCCESS); - - case 'C': /* Client OSC port. */ - - - if (update_arg( (void *)&(args_info->client_port_arg), - &(args_info->client_port_orig), &(args_info->client_port_given), - &(local_args_info.client_port_given), optarg, 0, 0, ARG_INT, - check_ambiguity, override, 0, 0, - "client-port", 'C', - additional_error)) - goto failure; - - break; - case 'c': /* Connect to existing engine at URI. */ - - - if (update_arg( (void *)&(args_info->connect_arg), - &(args_info->connect_orig), &(args_info->connect_given), - &(local_args_info.connect_given), optarg, 0, "osc.udp://localhost:16180", ARG_STRING, - check_ambiguity, override, 0, 0, - "connect", 'c', - additional_error)) - goto failure; - - break; - case 'e': /* Run (JACK) engine. */ - - - if (update_arg((void *)&(args_info->engine_flag), 0, &(args_info->engine_given), - &(local_args_info.engine_given), optarg, 0, 0, ARG_FLAG, - check_ambiguity, override, 1, 0, "engine", 'e', - additional_error)) - goto failure; - - break; - case 'E': /* Engine listen port. */ - - - if (update_arg( (void *)&(args_info->engine_port_arg), - &(args_info->engine_port_orig), &(args_info->engine_port_given), - &(local_args_info.engine_port_given), optarg, 0, "16180", ARG_INT, - check_ambiguity, override, 0, 0, - "engine-port", 'E', - additional_error)) - goto failure; - - break; - case 'n': /* Engine JACK client name. */ - - - if (update_arg( (void *)&(args_info->engine_name_arg), - &(args_info->engine_name_orig), &(args_info->engine_name_given), - &(local_args_info.engine_name_given), optarg, 0, "ingen", ARG_STRING, - check_ambiguity, override, 0, 0, - "engine-name", 'n', - additional_error)) - goto failure; - - break; - case 'g': /* Launch the GTK graphical interface. */ - - - if (update_arg((void *)&(args_info->gui_flag), 0, &(args_info->gui_given), - &(local_args_info.gui_given), optarg, 0, 0, ARG_FLAG, - check_ambiguity, override, 1, 0, "gui", 'g', - additional_error)) - goto failure; - - break; - case 'l': /* Load patch. */ - - - if (update_arg( (void *)&(args_info->load_arg), - &(args_info->load_orig), &(args_info->load_given), - &(local_args_info.load_given), optarg, 0, 0, ARG_STRING, - check_ambiguity, override, 0, 0, - "load", 'l', - additional_error)) - goto failure; - - break; - case 'p': /* Number of concurrent process threads. */ - - - if (update_arg( (void *)&(args_info->parallelism_arg), - &(args_info->parallelism_orig), &(args_info->parallelism_given), - &(local_args_info.parallelism_given), optarg, 0, "1", ARG_INT, - check_ambiguity, override, 0, 0, - "parallelism", 'p', - additional_error)) - goto failure; - - break; - case 'L': /* Target path for loaded patch. */ - - - if (update_arg( (void *)&(args_info->path_arg), - &(args_info->path_orig), &(args_info->path_given), - &(local_args_info.path_given), optarg, 0, 0, ARG_STRING, - check_ambiguity, override, 0, 0, - "path", 'L', - additional_error)) - goto failure; - - break; - case 'r': /* Run script. */ - - - if (update_arg( (void *)&(args_info->run_arg), - &(args_info->run_orig), &(args_info->run_given), - &(local_args_info.run_given), optarg, 0, 0, ARG_STRING, - check_ambiguity, override, 0, 0, - "run", 'r', - additional_error)) - goto failure; - - break; - - case 0: /* Long option with no short option */ - case '?': /* Invalid option. */ - /* `getopt_long' already printed an error message. */ - goto failure; - - default: /* bug: option not considered. */ - fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); - abort (); - } /* switch */ - } /* while */ - - - - - cmdline_parser_release (&local_args_info); - - if ( error ) - return (EXIT_FAILURE); - - return 0; - -failure: - - cmdline_parser_release (&local_args_info); - return (EXIT_FAILURE); -} diff --git a/src/ingen/cmdline.ggo b/src/ingen/cmdline.ggo deleted file mode 100644 index 2892e65a..00000000 --- a/src/ingen/cmdline.ggo +++ /dev/null @@ -1,37 +0,0 @@ -# Process this file with gengetopt to generate the necessary code (in cmdline.h, cmdline.c) - -package "ingen" -purpose "A modular realtime audio processing system" - -description "Ingen can be run in various configurations. The engine can -run as a stand-alone server controlled by OSC, or internal to -another process (e.g. the GUI). The GUI can communicate with the engine -via either method, and many GUIs (or other things) may connect to an -engine via OSC. - -Examples: - - ingen -e - Run an engine, listen for OSC - ingen -g - Run a GUI, connect via OSC - ingen -eg - Run an engine and a GUI in one process - -The -l (load) option can be used in all cases: - - ingen -el patch.ingen.ttl - Run an engine and load a patch - ingen -gl patch.ingen.ttl - Run a GUI and load a patch - ingen -egl patch.ingen.ttl - Run an engine and a GUI and load a patch - -Options: -" - -option "client-port" C "Client OSC port" int no -option "connect" c "Connect to existing engine at URI" string no default="osc.udp://localhost:16180" -option "engine" e "Run (JACK) engine" flag off -option "engine-port" E "Engine listen port" int no default="16180" -option "engine-name" n "Engine JACK client name" string no default="ingen" -option "gui" g "Launch the GTK graphical interface" flag off -option "load" l "Load patch" string no -option "parallelism" p "Number of concurrent process threads" int no default="1" -option "path" L "Target path for loaded patch" string no -option "run" r "Run script" string no - diff --git a/src/ingen/cmdline.h b/src/ingen/cmdline.h deleted file mode 100644 index 0a798e6c..00000000 --- a/src/ingen/cmdline.h +++ /dev/null @@ -1,204 +0,0 @@ -/** @file cmdline.h - * @brief The header file for the command line option parser - * generated by GNU Gengetopt - * http://www.gnu.org/software/gengetopt. - * DO NOT modify this file, since it can be overwritten - * @author GNU Gengetopt by Lorenzo Bettini */ - -#ifndef CMDLINE_H -#define CMDLINE_H - -/* If we use autoconf. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> /* for FILE */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef CMDLINE_PARSER_PACKAGE -/** @brief the program name */ -#define CMDLINE_PARSER_PACKAGE "ingen" -#endif - -#ifndef CMDLINE_PARSER_VERSION -/** @brief the program version */ -#define CMDLINE_PARSER_VERSION VERSION -#endif - -/** @brief Where the command line options are stored */ -struct gengetopt_args_info -{ - const char *help_help; /**< @brief Print help and exit help description. */ - const char *version_help; /**< @brief Print version and exit help description. */ - int client_port_arg; /**< @brief Client OSC port. */ - char * client_port_orig; /**< @brief Client OSC port original value given at command line. */ - const char *client_port_help; /**< @brief Client OSC port help description. */ - char * connect_arg; /**< @brief Connect to existing engine at URI (default='osc.udp://localhost:16180'). */ - char * connect_orig; /**< @brief Connect to existing engine at URI original value given at command line. */ - const char *connect_help; /**< @brief Connect to existing engine at URI help description. */ - int engine_flag; /**< @brief Run (JACK) engine (default=off). */ - const char *engine_help; /**< @brief Run (JACK) engine help description. */ - int engine_port_arg; /**< @brief Engine listen port (default='16180'). */ - char * engine_port_orig; /**< @brief Engine listen port original value given at command line. */ - const char *engine_port_help; /**< @brief Engine listen port help description. */ - char * engine_name_arg; /**< @brief Engine JACK client name (default='ingen'). */ - char * engine_name_orig; /**< @brief Engine JACK client name original value given at command line. */ - const char *engine_name_help; /**< @brief Engine JACK client name help description. */ - int gui_flag; /**< @brief Launch the GTK graphical interface (default=off). */ - const char *gui_help; /**< @brief Launch the GTK graphical interface help description. */ - char * load_arg; /**< @brief Load patch. */ - char * load_orig; /**< @brief Load patch original value given at command line. */ - const char *load_help; /**< @brief Load patch help description. */ - int parallelism_arg; /**< @brief Number of concurrent process threads (default='1'). */ - char * parallelism_orig; /**< @brief Number of concurrent process threads original value given at command line. */ - const char *parallelism_help; /**< @brief Number of concurrent process threads help description. */ - char * path_arg; /**< @brief Target path for loaded patch. */ - char * path_orig; /**< @brief Target path for loaded patch original value given at command line. */ - const char *path_help; /**< @brief Target path for loaded patch help description. */ - char * run_arg; /**< @brief Run script. */ - char * run_orig; /**< @brief Run script original value given at command line. */ - const char *run_help; /**< @brief Run script help description. */ - - unsigned int help_given ; /**< @brief Whether help was given. */ - unsigned int version_given ; /**< @brief Whether version was given. */ - unsigned int client_port_given ; /**< @brief Whether client-port was given. */ - unsigned int connect_given ; /**< @brief Whether connect was given. */ - unsigned int engine_given ; /**< @brief Whether engine was given. */ - unsigned int engine_port_given ; /**< @brief Whether engine-port was given. */ - unsigned int engine_name_given ; /**< @brief Whether engine-name was given. */ - unsigned int gui_given ; /**< @brief Whether gui was given. */ - unsigned int load_given ; /**< @brief Whether load was given. */ - unsigned int parallelism_given ; /**< @brief Whether parallelism was given. */ - unsigned int path_given ; /**< @brief Whether path was given. */ - unsigned int run_given ; /**< @brief Whether run was given. */ - -} ; - -/** @brief The additional parameters to pass to parser functions */ -struct cmdline_parser_params -{ - int override; /**< @brief whether to override possibly already present options (default 0) */ - int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ - int check_required; /**< @brief whether to check that all required options were provided (default 1) */ - int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ - int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ -} ; - -/** @brief the purpose string of the program */ -extern const char *gengetopt_args_info_purpose; -/** @brief the usage string of the program */ -extern const char *gengetopt_args_info_usage; -/** @brief all the lines making the help output */ -extern const char *gengetopt_args_info_help[]; - -/** - * The command line parser - * @param argc the number of command line options - * @param argv the command line options - * @param args_info the structure where option information will be stored - * @return 0 if everything went fine, NON 0 if an error took place - */ -int cmdline_parser (int argc, char * const *argv, - struct gengetopt_args_info *args_info); - -/** - * The command line parser (version with additional parameters - deprecated) - * @param argc the number of command line options - * @param argv the command line options - * @param args_info the structure where option information will be stored - * @param override whether to override possibly already present options - * @param initialize whether to initialize the option structure my_args_info - * @param check_required whether to check that all required options were provided - * @return 0 if everything went fine, NON 0 if an error took place - * @deprecated use cmdline_parser_ext() instead - */ -int cmdline_parser2 (int argc, char * const *argv, - struct gengetopt_args_info *args_info, - int override, int initialize, int check_required); - -/** - * The command line parser (version with additional parameters) - * @param argc the number of command line options - * @param argv the command line options - * @param args_info the structure where option information will be stored - * @param params additional parameters for the parser - * @return 0 if everything went fine, NON 0 if an error took place - */ -int cmdline_parser_ext (int argc, char * const *argv, - struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params); - -/** - * Save the contents of the option struct into an already open FILE stream. - * @param outfile the stream where to dump options - * @param args_info the option struct to dump - * @return 0 if everything went fine, NON 0 if an error took place - */ -int cmdline_parser_dump(FILE *outfile, - struct gengetopt_args_info *args_info); - -/** - * Save the contents of the option struct into a (text) file. - * This file can be read by the config file parser (if generated by gengetopt) - * @param filename the file where to save - * @param args_info the option struct to save - * @return 0 if everything went fine, NON 0 if an error took place - */ -int cmdline_parser_file_save(const char *filename, - struct gengetopt_args_info *args_info); - -/** - * Print the help - */ -void cmdline_parser_print_help(void); -/** - * Print the version - */ -void cmdline_parser_print_version(void); - -/** - * Initializes all the fields a cmdline_parser_params structure - * to their default values - * @param params the structure to initialize - */ -void cmdline_parser_params_init(struct cmdline_parser_params *params); - -/** - * Allocates dynamically a cmdline_parser_params structure and initializes - * all its fields to their default values - * @return the created and initialized cmdline_parser_params structure - */ -struct cmdline_parser_params *cmdline_parser_params_create(void); - -/** - * Initializes the passed gengetopt_args_info structure's fields - * (also set default values for options that have a default) - * @param args_info the structure to initialize - */ -void cmdline_parser_init (struct gengetopt_args_info *args_info); -/** - * Deallocates the string fields of the gengetopt_args_info structure - * (but does not deallocate the structure itself) - * @param args_info the structure to deallocate - */ -void cmdline_parser_free (struct gengetopt_args_info *args_info); - -/** - * Checks that all the required options were specified - * @param args_info the structure to check - * @param prog_name the name of the program that will be used to print - * possible errors - * @return - */ -int cmdline_parser_required (struct gengetopt_args_info *args_info, - const char *prog_name); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* CMDLINE_H */ diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 850c398a..715261f3 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -18,29 +18,23 @@ #include "ingen-config.h" #include <iostream> #include <string> +#include <stdlib.h> #include <signal.h> #include <boost/optional.hpp> #include <glibmm/convert.h> #include <glibmm/miscutils.h> #include <glibmm/thread.h> +#include "raul/Configuration.hpp" #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" #include "redlandmm/World.hpp" +#include "interface/EngineInterface.hpp" #include "shared/runtime_paths.hpp" #include "module/ingen_module.hpp" #include "module/Module.hpp" #include "module/World.hpp" #include "engine/Engine.hpp" -#include "engine/QueuedEngineInterface.hpp" -#include "engine/JackAudioDriver.hpp" #include "serialisation/Parser.hpp" -#include "cmdline.h" -#ifdef HAVE_LIBLO -#include "engine/OSCEngineReceiver.hpp" -#endif -#ifdef HAVE_SOUP -#include "engine/HTTPEngineReceiver.hpp" -#endif #ifdef WITH_BINDINGS #include "bindings/ingen_bindings.hpp" #endif @@ -52,47 +46,68 @@ using namespace Ingen; SharedPtr<Ingen::Engine> engine; void -catch_int(int) +ingen_interrupt(int) { - signal(SIGINT, catch_int); - signal(SIGTERM, catch_int); - - cout << "[Main] Ingen interrupted." << endl; + cout << "ingen: Interrupted" << endl; engine->quit(); } +void +ingen_abort(const char* msg) +{ + cerr << "ingen: Error: " << msg << endl; + ingen_destroy_world(); + exit(1); +} + int main(int argc, char** argv) { + Raul::Configuration conf("A realtime modular audio processor.", + "Ingen is a flexible modular system that be used in various ways.\n" + "The engine can run as a stand-alone server controlled via a network protocol\n" + "(e.g. OSC), or internal to another process (e.g. the GUI). The GUI, or other\n" + "clients, can communicate with the engine via any supported protocol, or host the\n" + "engine in the same process. Many clients can connect to an engine at once.\n\n" + "Examples:\n" + " ingen -e # Run an engine, listen for OSC\n" + " ingen -g # Run a GUI, connect via OSC\n" + " ingen -eg # Run an engine and a GUI in one process\n" + " ingen -egl patch.ingen.ttl # Run an engine and a GUI and load a patch"); + + conf.add("client-port", 'C', "Client OSC port", Atom::INT, Atom()) + .add("connect", 'c', "Connect to engine URI", Atom::STRING, "osc.udp://localhost:16180") + .add("engine", 'e', "Run (JACK) engine", Atom::BOOL, false) + .add("engine-port", 'E', "Engine listen port", Atom::INT, 16180) + .add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, false) + .add("help", 'h', "Print this help message", Atom::BOOL, false) + .add("jack-client", 'n', "JACK client name", Atom::STRING, "ingen") + .add("jack-server", 's', "JACK server name", Atom::STRING, "default") + .add("load", 'l', "Load patch", Atom::STRING, Atom()) + .add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, 1) + .add("path", 'L', "Target path for loaded patch", Atom::STRING, Atom()) + .add("run", 'r', "Run script", Atom::STRING, Atom()); + // Parse command line options - gengetopt_args_info args; - if (cmdline_parser (argc, argv, &args) != 0) - return 1; + try { + conf.parse(argc, argv); + } catch (std::exception& e) { + cout << "ingen: " << e.what() << endl; + return EXIT_FAILURE; + } + // Verify option sanity if (argc <= 1) { - cmdline_parser_print_help(); - cerr << endl << "*** Ingen requires at least one command line parameter" << endl; - cerr << "*** Just want a graphical application? Try 'ingen -eg'" << endl; - return 1; - } else if (args.connect_given && args.engine_flag) { - cerr << "\n*** Nonsense arguments, can't both run a local engine " - << "and connect to a remote one." << endl - << "*** Run separate instances if that is what you want" << endl; - return 1; + conf.print_usage("ingen", cout); + return EXIT_FAILURE; + } else if (conf.option("help").get_bool()) { + conf.print_usage("ingen", cout); + return EXIT_SUCCESS; } // Set bundle path from executable location so resources/modules can be found Shared::set_bundle_path_from_code((void*)&main); - SharedPtr<Glib::Module> engine_module; - SharedPtr<Glib::Module> engine_http_module; - SharedPtr<Glib::Module> engine_osc_module; - SharedPtr<Glib::Module> engine_queued_module; - SharedPtr<Glib::Module> engine_jack_module; - SharedPtr<Glib::Module> client_module; - SharedPtr<Glib::Module> gui_module; - SharedPtr<Glib::Module> bindings_module; - SharedPtr<Shared::EngineInterface> engine_interface; Glib::thread_init(); @@ -100,7 +115,11 @@ main(int argc, char** argv) g_type_init(); #endif - Ingen::Shared::World* world = Ingen::Shared::get_world(); + Ingen::Shared::World* world = ingen_get_world(); + + world->argc = argc; + world->argv = argv; + world->conf = &conf; // Set up RDF namespaces world->rdf_world->add_prefix("dc", "http://purl.org/dc/elements/1.1/"); @@ -116,211 +135,113 @@ main(int argc, char** argv) world->rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); // Run engine - if (args.engine_flag) { - engine_module = Ingen::Shared::load_module("ingen_engine"); - engine_jack_module = Ingen::Shared::load_module("ingen_engine_jack"); - engine_queued_module = Ingen::Shared::load_module("ingen_engine_queued"); - - if (!engine_queued_module) { - cerr << "ERROR: Unable to load (queued) engine interface module" << endl; - Ingen::Shared::destroy_world(); - return 1; - } - - if (engine_module) { - Engine* (*new_engine)(Ingen::Shared::World* world) = NULL; - if (engine_module->get_symbol("new_engine", (void*&)new_engine)) { - engine = SharedPtr<Engine>(new_engine(world)); - world->local_engine = engine; - - // Load queued (direct in-process) engine interface - if (args.gui_given && engine_queued_module) { - Ingen::QueuedEngineInterface* (*new_interface)(Ingen::Engine& engine); - if (engine_queued_module->get_symbol("new_queued_interface", (void*&)new_interface)) { - SharedPtr<QueuedEngineInterface> interface(new_interface(*engine)); - world->local_engine->add_event_source(interface); - engine_interface = interface; - world->engine = engine_interface; - } - - // Load network engine interfaces - } else { - #ifdef HAVE_LIBLO - if ((engine_osc_module = Ingen::Shared::load_module("ingen_engine_osc"))) { - Ingen::OSCEngineReceiver* (*new_receiver)( - Ingen::Engine& engine, size_t queue_size, uint16_t port); - if (engine_osc_module->get_symbol("new_osc_receiver", (void*&)new_receiver)) { - static const size_t queue_size = 1024; // FIXME - SharedPtr<EventSource> receiver(new_receiver( - *engine, queue_size, args.engine_port_arg)); - world->local_engine->add_event_source(receiver); - } - } - #endif - #ifdef HAVE_SOUP - if ((engine_http_module = Ingen::Shared::load_module("ingen_engine_http"))) { - Ingen::HTTPEngineReceiver* (*new_receiver)( - Ingen::Engine& engine, uint16_t port); - if (engine_http_module->get_symbol("new_http_receiver", (void*&)new_receiver)) { - SharedPtr<EventSource> receiver(new_receiver( - *world->local_engine, args.engine_port_arg)); - world->local_engine->add_event_source(receiver); - } - } - #endif - } - } else { - engine_module.reset(); - } - } else { - cerr << "Unable to load engine module." << endl; + if (conf.option("engine").get_bool()) { + if (!world->load("ingen_engine")) + ingen_abort("Unable to load engine module"); + + if (!world->local_engine) + ingen_abort("Unable to create engine"); + + engine = world->local_engine; + engine_interface = world->engine; + + // Not loading a GUI, load network engine interfaces + if (!conf.option("gui").get_bool()) { + #ifdef HAVE_LIBLO + if (!world->load("ingen_osc")) + ingen_abort("Unable to load OSC module"); + #endif + #ifdef HAVE_SOUP + if (!world->load("ingen_http")) + ingen_abort("Unable to load HTTP module"); + #endif } } - // Load client library - if (args.load_given || args.gui_given) { - client_module = Ingen::Shared::load_module("ingen_client"); - if (!client_module) - cerr << "Unable to load client module." << endl; - } + // Load client library (required for patch loading and/or GUI) + if (conf.option("load").is_valid() || conf.option("gui").get_bool()) + if (!world->load("ingen_client")) + ingen_abort("Unable to load client module"); // If we don't have a local engine interface (for GUI), use network - if (client_module && ! engine_interface) { - SharedPtr<Shared::EngineInterface> (*new_remote_interface) - (Ingen::Shared::World*, const std::string&) = NULL; - - if (client_module->get_symbol("new_remote_interface", (void*&)new_remote_interface)) { - engine_interface = new_remote_interface(world, args.connect_arg); - } else { - cerr << "Unable to find symbol 'new_remote_interface' in " - "ingen_client module, aborting." << endl; - return -1; - } + if (!engine_interface) { + const char* const uri = conf.option("connect").get_string(); + if (!(engine_interface = world->interface(uri))) + ingen_abort((string("Unable to create interface to `") + uri + "'").c_str()); } // Activate the engine, if we have one if (engine) { - Ingen::JackAudioDriver* (*new_driver)( - Ingen::Engine& engine, - const std::string server_name, - const std::string client_name, - void* jack_client) = NULL; - if (engine_jack_module->get_symbol("new_jack_audio_driver", (void*&)new_driver)) { - engine->set_driver(Shared::PortType::AUDIO, SharedPtr<Driver>(new_driver( - *engine, "default", args.engine_name_arg, NULL))); - } else { - cerr << Glib::Module::get_last_error() << endl; - } + if (!world->load("ingen_jack")) + ingen_abort("Unable to load jack module"); - engine->activate(args.parallelism_arg); + engine->activate(); } world->engine = engine_interface; - void (*gui_run)() = NULL; - - // Load GUI - bool run_gui = false; - if (args.gui_given) { - gui_module = Ingen::Shared::load_module("ingen_gui"); - if (gui_module) { - void (*init)(int, char**, Ingen::Shared::World*); - - bool found = gui_module->get_symbol("init", (void*&)init); - found = found && gui_module->get_symbol("run", (void*&)gui_run); - if (found) { - run_gui = true; - init(argc, argv, world); - } else { - cerr << "Unable to find hooks in GUI module, GUI not loaded." << endl; - } - } else { - cerr << "Unable to load GUI module." << endl; - } - } - // Load a patch - if (args.load_given && engine_interface) { + if (conf.option("load").is_valid() && engine_interface) { boost::optional<Path> data_path = Path("/"); boost::optional<Path> parent; boost::optional<Symbol> symbol; + const Raul::Atom& path_option = conf.option("path"); - if (args.path_given) { - const Glib::ustring path = args.path_arg; - if (Path::is_valid(path)) { - const Path p(path); + if (path_option.is_valid()) { + if (Path::is_valid(path_option.get_string())) { + const Path p(path_option.get_string()); if (!p.is_root()) { parent = p.parent(); - const string s = p.name(); - if (Symbol::is_valid(s)) - symbol = s; + symbol = p.name(); } } else { - cerr << "Invalid path given: '" << path << endl; + cerr << "Invalid path given: '" << path_option << endl; } } - bool found = false; - if (!world->serialisation_module) - world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - Serialisation::Parser* (*new_parser)() = NULL; - - if (world->serialisation_module) - found = world->serialisation_module->get_symbol("new_parser", (void*&)new_parser); - - if (world->serialisation_module && found) { - SharedPtr<Serialisation::Parser> parser(new_parser()); + if (!world->load("ingen_serialisation")) + ingen_abort("Unable to load serialisation module"); + if (world->parser) { // Assumption: Containing ':' means URI, otherwise filename - string uri = args.load_arg; + string uri = conf.option("load").get_string(); if (uri.find(':') == string::npos) { - if (Glib::path_is_absolute(args.load_arg)) - uri = Glib::filename_to_uri(args.load_arg); + if (Glib::path_is_absolute(uri)) + uri = Glib::filename_to_uri(uri); else uri = Glib::filename_to_uri(Glib::build_filename( - Glib::get_current_dir(), args.load_arg)); + Glib::get_current_dir(), uri)); } engine_interface->load_plugins(); - parser->parse_document(world, engine_interface.get(), uri, data_path, parent, symbol); + world->parser->parse_document( + world, engine_interface.get(), uri, data_path, parent, symbol); } else { - cerr << "Unable to load serialisation module, aborting." << endl; - return -1; + ingen_abort("Unable to create parser"); } } - // Run GUI (if applicable) - if (run_gui) - gui_run(); + // Load GUI + if (conf.option("gui").get_bool()) + if (!world->load("ingen_gui")) + ingen_abort("Unable to load GUI module"); // Run a script - if (args.run_given) { + if (conf.option("run").is_valid()) { #ifdef WITH_BINDINGS - bool (*run_script)(Ingen::Shared::World*, const char*) = NULL; - SharedPtr<Glib::Module> bindings_module = Ingen::Shared::load_module("ingen_bindings"); - if (bindings_module) { - bindings_module->make_resident(); - - bool found = bindings_module->get_symbol("run", (void*&)(run_script)); - if (found) { - setenv("PYTHONPATH", "../../bindings", 1); - run_script(world, args.run_arg); - } else { - cerr << "FAILED: " << Glib::Module::get_last_error() << endl; - } - } else { - cerr << Glib::Module::get_last_error() << endl; - } + if (!world->load("ingen_bindings")) + ingen_abort("Unable to load bindings module"); + + world->run("application/x-python", conf.option("run").get_string()); #else cerr << "This build of ingen does not support scripting." << endl; #endif // Listen to OSC and run main loop - } else if (engine && !run_gui) { - signal(SIGINT, catch_int); - signal(SIGTERM, catch_int); + } else if (engine && !conf.option("gui").get_bool()) { + signal(SIGINT, ingen_interrupt); + signal(SIGTERM, ingen_interrupt); engine->main(); // Block here } @@ -330,13 +251,7 @@ main(int argc, char** argv) engine.reset(); } - engine_interface.reset(); - client_module.reset(); - world->serialisation_module.reset(); - gui_module.reset(); - engine_module.reset(); - - Ingen::Shared::destroy_world(); + ingen_destroy_world(); return 0; } diff --git a/src/ingen/wscript b/src/ingen/wscript index 61c69bcd..839b789b 100644 --- a/src/ingen/wscript +++ b/src/ingen/wscript @@ -4,7 +4,7 @@ import autowaf def build(bld): obj = bld.new_task_gen(features='cxx cc cprogram') obj.target = 'ingen' - obj.source = 'main.cpp cmdline.c' + obj.source = 'main.cpp' obj.includes = ['..', '../..', '../common'] obj.defines = 'VERSION="' + bld.env['INGEN_VERSION'] + '"' obj.uselib_local = 'libingen_module libingen_shared' diff --git a/src/module/Module.hpp b/src/module/Module.hpp index d078264f..c9ac198f 100644 --- a/src/module/Module.hpp +++ b/src/module/Module.hpp @@ -15,6 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef INGEN_MODULE_HPP +#define INGEN_MODULE_HPP + #include <string> #include <glibmm/module.h> #include "raul/SharedPtr.hpp" @@ -22,14 +25,20 @@ namespace Ingen { namespace Shared { +class World; -/** Load a dynamic module from the default path. +/** A dynamically loaded Ingen module. * - * \param name The base name of the module, e.g. "ingen_serialisation" + * All components of Ingen reside in one of these. */ -SharedPtr<Glib::Module> load_module(const std::string& name); +struct Module { + virtual void load(Ingen::Shared::World* world) = 0; + + SharedPtr<Glib::Module> library; +}; } // namespace Shared } // namespace Ingen +#endif //INGEN_MODULE_HPP diff --git a/src/module/Module.cpp b/src/module/World.cpp index 2e2c71a7..0bc87459 100644 --- a/src/module/Module.cpp +++ b/src/module/World.cpp @@ -15,22 +15,19 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> -#include <sstream> #include <iostream> #include <glibmm/module.h> #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> #include "ingen-config.h" -#include "raul/SharedPtr.hpp" #include "shared/runtime_paths.hpp" +#include "World.hpp" using namespace std; namespace Ingen { namespace Shared { - /** Load a dynamic module from the default path. * * This will check in the directories specified in the environment variable @@ -39,7 +36,7 @@ namespace Shared { * * \param name The base name of the module, e.g. "ingen_serialisation" */ -SharedPtr<Glib::Module> +static SharedPtr<Glib::Module> load_module(const string& name) { Glib::Module* module = NULL; @@ -85,7 +82,65 @@ load_module(const string& name) } } +/** Load an Ingen module. + * @return true on success, false on failure + */ +bool +World::load(const char* name) +{ + SharedPtr<Glib::Module> lib = load_module(name); + Ingen::Shared::Module* (*module_load)() = NULL; + if (lib->get_symbol("ingen_module_load", (void*&)module_load)) { + Module* module = module_load(); + module->library = lib; + module->load(this); + modules.insert(make_pair(string(name), module)); + return true; + } else { + cerr << "Failed to load module " << name << endl; + return false; + } +} + + +/** Unload all loaded Ingen modules. + */ +void +World::unload_all() +{ + modules.clear(); +} + + +/** Get an interface for a remote engine at @a url + */ +SharedPtr<Ingen::Shared::EngineInterface> +World::interface(const std::string& url) +{ + const string scheme = url.substr(0, url.find(":")); + const InterfaceFactories::const_iterator i = interface_factories.find(scheme); + if (i == interface_factories.end()) { + cerr << "WARNING: Unknown URI scheme `'" << scheme << "'" << endl; + return SharedPtr<Ingen::Shared::EngineInterface>(); + } + + return i->second(this, url); +} + + +/** Run a script of type @a mime_type at filename @a filename */ +bool +World::run(const std::string& mime_type, const std::string& filename) +{ + const ScriptRunners::const_iterator i = script_runners.find(mime_type); + if (i == script_runners.end()) { + cerr << "WARNING: Unknown script MIME type `'" << mime_type << "'" << endl; + return false; + } + + return i->second(this, filename.c_str()); +} + } // namespace Shared } // namespace Ingen - diff --git a/src/module/World.hpp b/src/module/World.hpp index 27c9c764..e12ce5b2 100644 --- a/src/module/World.hpp +++ b/src/module/World.hpp @@ -18,8 +18,12 @@ #ifndef INGEN_WORLD_HPP #define INGEN_WORLD_HPP +#include <map> +#include <string> #include <boost/shared_ptr.hpp> #include <glibmm/module.h> +#include "raul/Configuration.hpp" +#include "Module.hpp" typedef struct _SLV2World* SLV2World; @@ -49,10 +53,22 @@ class LV2Features; * The Ingen System(TM) and whatnot. */ struct World { - Redland::World* rdf_world; + World() : conf(0) {} - SLV2World slv2_world; - LV2Features* lv2_features; + bool load(const char* name); + void unload_all(); + + SharedPtr<Ingen::Shared::EngineInterface> interface(const std::string& engine_url); + + bool run(const std::string& mime_type, const std::string& filename); + + int argc; + char** argv; + Raul::Configuration* conf; + + Redland::World* rdf_world; + SLV2World slv2_world; + LV2Features* lv2_features; boost::shared_ptr<EngineInterface> engine; boost::shared_ptr<Engine> local_engine; @@ -60,7 +76,18 @@ struct World { boost::shared_ptr<Serialisation::Parser> parser; boost::shared_ptr<Store> store; - boost::shared_ptr<Glib::Module> serialisation_module; +private: + typedef std::map< const std::string, boost::shared_ptr<Module> > Modules; + Modules modules; + + typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)( + World* world, const std::string& url); + typedef std::map<const std::string, InterfaceFactory> InterfaceFactories; + InterfaceFactories interface_factories; + + typedef bool (*ScriptRunner)(World* world, const char* filename); + typedef std::map<const std::string, ScriptRunner> ScriptRunners; + ScriptRunners script_runners; }; diff --git a/src/module/ingen_module.cpp b/src/module/ingen_module.cpp index c9a6d9d4..5faefebc 100644 --- a/src/module/ingen_module.cpp +++ b/src/module/ingen_module.cpp @@ -15,36 +15,30 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> #include "redlandmm/World.hpp" #include "shared/LV2Features.hpp" #include "ingen_module.hpp" #include "World.hpp" - #include "ingen-config.h" #ifdef HAVE_SLV2 #include "slv2/slv2.h" #endif -using namespace std; - -namespace Ingen { -namespace Shared { - -static World* world = NULL; +extern "C" { +static Ingen::Shared::World* world = NULL; -World* -get_world() +Ingen::Shared::World* +ingen_get_world() { - static World* world = NULL; + static Ingen::Shared::World* world = NULL; if (!world) { - world = new World(); + world = new Ingen::Shared::World(); world->rdf_world = new Redland::World(); #ifdef HAVE_SLV2 world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world->world()); - world->lv2_features = new LV2Features(); + world->lv2_features = new Ingen::Shared::LV2Features(); slv2_world_load_all(world->slv2_world); #endif world->engine.reset(); @@ -54,11 +48,11 @@ get_world() return world; } - void -destroy_world() +ingen_destroy_world() { if (world) { + world->unload_all(); #ifdef HAVE_SLV2 slv2_world_free(world->slv2_world); delete world->lv2_features; @@ -69,7 +63,4 @@ destroy_world() } } - -} // namesace Shared -} // namespace Ingen - +} // extern "C" diff --git a/src/module/ingen_module.hpp b/src/module/ingen_module.hpp index ef373430..1095a3e6 100644 --- a/src/module/ingen_module.hpp +++ b/src/module/ingen_module.hpp @@ -15,19 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_GLOBAL_H -#define INGEN_GLOBAL_H +#ifndef INGEN_LIB_MODULE_HPP +#define INGEN_LIB_MODULE_HPP -namespace Ingen { -namespace Shared { +namespace Ingen { namespace Shared { class World; } } -class World; +extern "C" { -World* get_world(); -void destroy_world(); +Ingen::Shared::World* ingen_get_world(); +void ingen_destroy_world(); -} // namesace Shared -} // namespace Ingen +} // extern "C" -#endif // INGEN_GLOBAL_H +#endif // INGEN_LIB_MODULE_HPP diff --git a/src/module/wscript b/src/module/wscript index 318bf645..8553618f 100644 --- a/src/module/wscript +++ b/src/module/wscript @@ -7,7 +7,7 @@ def build(bld): obj = bld.new_task_gen('cxx', 'shlib') obj.source = ''' - Module.cpp + World.cpp ingen_module.cpp ''' obj.export_incdirs = ['.'] diff --git a/src/serialisation/serialisation.cpp b/src/serialisation/serialisation.cpp index 09c4f798..a453f000 100644 --- a/src/serialisation/serialisation.cpp +++ b/src/serialisation/serialisation.cpp @@ -16,31 +16,33 @@ */ #include "raul/Atom.hpp" +#include "module/Module.hpp" #include "module/World.hpp" -#include "serialisation.hpp" #include "Parser.hpp" #include "Serialiser.hpp" -namespace Ingen { -namespace Serialisation { +using namespace Ingen; +struct IngenModule : public Shared::Module { + void load(Shared::World* world) { + world->parser = SharedPtr<Serialisation::Parser>( + new Serialisation::Parser()); + world->serialiser = SharedPtr<Serialisation::Serialiser>( + new Serialisation::Serialiser(*world, world->store)); + } +}; -Ingen::Serialisation::Parser* -new_parser() -{ - return new Parser(); -} - +static IngenModule* module = NULL; -Ingen::Serialisation::Serialiser* -new_serialiser(Ingen::Shared::World* world, SharedPtr<Shared::Store> store) -{ - assert(world->rdf_world); - return new Serialiser(*world, store); -} +extern "C" { +Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenModule(); + return module; +} -} // namespace Serialisation -} // namespace Ingen +} // extern "C" diff --git a/src/serialisation/serialisation.hpp b/src/serialisation/serialisation.hpp deleted file mode 100644 index d04639a5..00000000 --- a/src/serialisation/serialisation.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_SERIALISATION_H -#define INGEN_SERIALISATION_H - -#include <boost/shared_ptr.hpp> - -namespace Ingen { - -namespace Shared { class World; class Store; } - -namespace Serialisation { - -class Parser; -class Serialiser; - - -extern "C" { - - extern Parser* new_parser(); - extern Serialiser* new_serialiser(Ingen::Shared::World* world, - boost::shared_ptr<Shared::Store> store); - -} - - -} // namespace Serialisation -} // namespace Ingen - -#endif // INGEN_SERIALISATION_H - |