diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/Engine.cpp | 27 | ||||
-rw-r--r-- | src/libs/engine/NodeFactory.cpp | 6 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 1 | ||||
-rw-r--r-- | src/libs/engine/util.hpp | 2 | ||||
-rw-r--r-- | src/libs/gui/App.cpp | 15 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 27 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.cpp | 47 |
9 files changed, 71 insertions, 62 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index 5e724c1c..8c8d3936 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -183,8 +183,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { - if (load_name) { - assert(key != NULL); + if (load_name && key) { if (parent_path) path = Path(parent_path.get()).base() + nameify_if_invalid((char*)key); else @@ -598,7 +597,6 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt while ((slash_index = port_name.find("/")) != string::npos) port_name[slash_index] = '-'; - cerr << "ADDING CONTROL: " << node_name << " / " << port_name << " = " << val << endl; pm->add_control(node_name, port_name, val); } } diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 44cac86c..004de200 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -120,10 +120,7 @@ Engine::main() } cout << "[Main] Done main loop." << endl; - _event_source->deactivate(); - - if (_activated) - deactivate(); + deactivate(); return 0; } @@ -152,23 +149,21 @@ Engine::main_iteration() void Engine::start_jack_driver() { - if (_audio_driver) - cerr << "[Engine] Warning: replaced audio driver" << endl; - - _audio_driver = SharedPtr<AudioDriver>(new JackAudioDriver(*this)); + if ( ! _audio_driver) + _audio_driver = SharedPtr<AudioDriver>(new JackAudioDriver(*this)); + else + cerr << "[Engine::start_jack_driver] Audio driver already running" << endl; } void Engine::start_osc_driver(int port) { - if (_event_source) - cerr << "[Engine] Warning: replaced event source (engine interface)" << endl; - - _event_source = SharedPtr<EventSource>(new OSCEngineReceiver( - *this, pre_processor_queue_size, port)); - - //_osc_driver = _event_source; + if ( ! _event_source) + _event_source = SharedPtr<EventSource>(new OSCEngineReceiver( + *this, pre_processor_queue_size, port)); + else + cerr << "[Engine::start_osc_driver] Event source already running" << endl; } @@ -247,6 +242,8 @@ Engine::deactivate() { if (!_activated) return; + + _event_source->deactivate(); /*for (Tree<GraphObject*>::iterator i = _object_store->objects().begin(); i != _object_store->objects().end(); ++i) diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index b2714e23..c2b9536a 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -336,7 +336,11 @@ NodeFactory::load_lv2_plugin(const string& plug_uri, if (plugin) { n = new LV2Node(plugin, node_name, polyphonic, parent, srate, buffer_size); - bool success = ((LV2Node*)n)->instantiate(); + + Glib::Mutex::Lock lock(_world->rdf_world->mutex()); + + const bool success = ((LV2Node*)n)->instantiate(); + if (!success) { delete n; n = NULL; diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 96aee3b1..a50ca275 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -53,12 +53,10 @@ PostProcessor::process() while (_engine.audio_driver()->context().event_sink().read( _event_buffer_size, _event_buffer)) { if (((Event*)_event_buffer)->time() > end_time) - break; + break; // FIXME: loses event? ((Event*)_event_buffer)->post_process(); } - - /* Process normal events */ while ( ! _events.empty()) { Event* const ev = _events.front(); diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 053c0ff8..a2603665 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -38,6 +38,7 @@ QueuedEngineInterface::now() const { // Exactly one cycle latency (some could run ASAP if we get lucky, but not always, and a slight // constant latency is far better than jittery lower (average) latency + assert(_engine.audio_driver()); return _engine.audio_driver()->frame_time() + _engine.audio_driver()->buffer_size(); } diff --git a/src/libs/engine/util.hpp b/src/libs/engine/util.hpp index ce943673..4d03d94e 100644 --- a/src/libs/engine/util.hpp +++ b/src/libs/engine/util.hpp @@ -65,8 +65,6 @@ set_denormal_flags() exit(EXIT_FAILURE); } #endif - // Set 387 control register via standard C99 interface - fesetround(FE_TOWARDZERO); } } // namespace Ingen diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index e207bb9f..d9bac842 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -32,6 +32,7 @@ #include "client/ObjectModel.hpp" #include "client/PatchModel.hpp" #include "client/Store.hpp" +#include "engine/Engine.hpp" #include "NodeModule.hpp" #include "ControlPanel.hpp" #include "SubpatchModule.hpp" @@ -169,7 +170,7 @@ App::run(int argc, char** argv, void -App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> client) +App::attach(SharedPtr<EngineInterface> engine, SharedPtr<ThreadedSigClientInterface> client) { assert( ! _engine); assert( ! _client); @@ -347,6 +348,18 @@ App::event_save_session_as() #endif +bool +App::gtk_main_iteration() +{ + if (_world->local_engine) + _world->local_engine->main_iteration(); + + _client->emit_signals(); + + return true; +} + + void App::quit() { diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 956ac9bd..cba8efab 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -41,7 +41,7 @@ namespace Ingen { class PatchModel; class PluginModel; class Store; - class SigClientInterface; + class ThreadedSigClientInterface; } namespace Serialisation { class Serialiser; @@ -83,11 +83,12 @@ public: void error_message(const string& msg); - void attach(SharedPtr<EngineInterface> engine, - SharedPtr<SigClientInterface> client); + void attach(SharedPtr<EngineInterface> engine, + SharedPtr<ThreadedSigClientInterface> client); void detach(); + bool gtk_main_iteration(); void quit(); void port_activity(Port* port); @@ -99,11 +100,11 @@ public: Configuration* configuration() const { return _configuration; } WindowFactory* window_factory() const { return _window_factory; } - const SharedPtr<EngineInterface>& engine() const { return _engine; } - const SharedPtr<SigClientInterface>& client() const { return _client; } - const SharedPtr<Store>& store() const { return _store; } - const SharedPtr<ThreadedLoader>& loader() const { return _loader; } - const SharedPtr<Serialiser>& serialiser() const { return _serialiser; } + const SharedPtr<EngineInterface>& engine() const { return _engine; } + const SharedPtr<ThreadedSigClientInterface>& client() const { return _client; } + const SharedPtr<Store>& store() const { return _store; } + const SharedPtr<ThreadedLoader>& loader() const { return _loader; } + const SharedPtr<Serialiser>& serialiser() const { return _serialiser; } SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; } @@ -125,11 +126,11 @@ protected: SharedPtr<Glib::Module> _serialisation_module; - SharedPtr<EngineInterface> _engine; - SharedPtr<SigClientInterface> _client; - SharedPtr<Store> _store; - SharedPtr<ThreadedLoader> _loader; - SharedPtr<Serialiser> _serialiser; + SharedPtr<EngineInterface> _engine; + SharedPtr<ThreadedSigClientInterface> _client; + SharedPtr<Store> _store; + SharedPtr<ThreadedLoader> _loader; + SharedPtr<Serialiser> _serialiser; Configuration* _configuration; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index e8f93354..25195f75 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -24,6 +24,7 @@ #include <raul/Process.hpp> #include CONFIG_H_PATH #include "interface/EngineInterface.hpp" +#include "module/World.hpp" #include "engine/tuning.hpp" #include "engine/Engine.hpp" #include "engine/QueuedEngineInterface.hpp" @@ -107,9 +108,14 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: void ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface) { + if (engine) { + _engine = engine; + _mode = INTERNAL; + } + set_connected_to(interface); - show(); +#if 0 if (engine) { Glib::signal_timeout().connect( @@ -126,13 +132,10 @@ ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineIn _connect_stage = 0; } - - if (interface) { - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); - } else { - connect(); - } +#endif + + show(); + connect(); } @@ -203,7 +206,7 @@ ConnectWindow::connect() new OSCEngineSender(_url_entry->get_text())); OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args - SharedPtr<SigClientInterface> client(ose); + SharedPtr<ThreadedSigClientInterface> client(ose); App::instance().attach(engine, client); Glib::signal_timeout().connect( @@ -224,7 +227,7 @@ ConnectWindow::connect() new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args - SharedPtr<SigClientInterface> client(ose); + SharedPtr<ThreadedSigClientInterface> client(ose); App::instance().attach(engine, client); Glib::signal_timeout().connect( @@ -240,26 +243,23 @@ ConnectWindow::connect() } else if (_mode == INTERNAL) { assert(_new_engine); _engine = SharedPtr<Ingen::Engine>(_new_engine(App::instance().world())); - - //_engine->start_jack_driver(); + App::instance().world()->local_engine = _engine.get(); SharedPtr<Ingen::EngineInterface> engine_interface = _engine->new_queued_interface(); - ThreadedSigClientInterface* tsci = new ThreadedSigClientInterface(Ingen::event_queue_size); - SharedPtr<SigClientInterface> client(tsci); + SharedPtr<ThreadedSigClientInterface> client( + new ThreadedSigClientInterface(Ingen::event_queue_size)); + + _engine->start_jack_driver(); + _engine->activate(1); // FIXME: parallelism App::instance().attach(engine_interface, client); - /*_engine->activate(1); // FIXME - Glib::signal_timeout().connect( - sigc::mem_fun(_engine.get(), &Ingen::Engine::main_iteration), 1000);*/ + sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 100); Glib::signal_timeout().connect( sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); - - /*Glib::signal_timeout().connect( - sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);*/ } } @@ -341,12 +341,11 @@ ConnectWindow::gtk_callback() /* Connecting to engine */ if (_connect_stage == 0) { - assert(!_attached); + _attached = false; + assert(App::instance().engine()); assert(App::instance().client()); - // FIXME - //assert(!App::instance().engine()->is_attached()); _progress_label->set_text("Connecting to engine..."); present(); @@ -381,7 +380,7 @@ ConnectWindow::gtk_callback() // FIXME //auto_ptr<ClientInterface> client(new ThreadedSigClientInterface(); // FIXME: client URI - App::instance().engine()->register_client(App::instance().client().get()); + //App::instance().engine()->register_client(App::instance().client().get()); App::instance().engine()->load_plugins(); ++_connect_stage; } else if (_connect_stage == 3) { |