From 8defdcb32f4421c9d124767d1c677c05791ead55 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 11 Oct 2007 02:31:34 +0000 Subject: Fix Gtk rendering corruption problems when running monolithic (internal engine). Reduce Gtk main loop overhead when running monolithic. Fix crash on importing certain Om patches. git-svn-id: http://svn.drobilla.net/lad/ingen@870 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/Engine.cpp | 27 ++++++++++++--------------- src/libs/engine/NodeFactory.cpp | 6 +++++- src/libs/engine/PostProcessor.cpp | 4 +--- src/libs/engine/QueuedEngineInterface.cpp | 1 + src/libs/engine/util.hpp | 2 -- 5 files changed, 19 insertions(+), 21 deletions(-) (limited to 'src/libs/engine') 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(new JackAudioDriver(*this)); + if ( ! _audio_driver) + _audio_driver = SharedPtr(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(new OSCEngineReceiver( - *this, pre_processor_queue_size, port)); - - //_osc_driver = _event_source; + if ( ! _event_source) + _event_source = SharedPtr(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::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 -- cgit v1.2.1