diff options
author | David Robillard <d@drobilla.net> | 2007-08-01 04:42:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-08-01 04:42:09 +0000 |
commit | 1a77934531b0ddfc4392ccffbdde0058c2dbab68 (patch) | |
tree | 51e628c9b3dc4299d1f5dbb3bd5aad4938b0ae5a /src/libs | |
parent | 9cd4eddfb41c4573d4acd4f625572c4cdff50497 (diff) | |
download | ingen-1a77934531b0ddfc4392ccffbdde0058c2dbab68.tar.gz ingen-1a77934531b0ddfc4392ccffbdde0058c2dbab68.tar.bz2 ingen-1a77934531b0ddfc4392ccffbdde0058c2dbab68.zip |
Remove PostProcessor thread, post-process in main thread instead (solves scripting threading issues, and saves memory anyway).
Revert saw_lp.ingen.ttl (version written by broken raptor committed by mistake).
Working engine->script responses, nicer Python example.
git-svn-id: http://svn.drobilla.net/lad/ingen@665 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/engine/Engine.cpp | 9 | ||||
-rw-r--r-- | src/libs/engine/JackAudioDriver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.cpp | 21 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.hpp | 18 | ||||
-rw-r--r-- | src/libs/engine/QueuedEventSource.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/tuning.hpp | 5 | ||||
-rw-r--r-- | src/libs/module/World.hpp | 5 | ||||
-rw-r--r-- | src/libs/module/module.cpp | 2 |
8 files changed, 43 insertions, 23 deletions
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index a77662a3..af4eca27 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -54,7 +54,7 @@ Engine::Engine(Ingen::Shared::World* world) _midi_driver(NULL), _osc_driver(NULL), _maid(new Raul::Maid(maid_queue_size)), - _post_processor(new PostProcessor(*_maid, post_processor_queue_size)), + _post_processor(new PostProcessor(/**_maid, */post_processor_queue_size)), _broadcaster(new ClientBroadcaster()), _object_store(new ObjectStore()), _node_factory(new NodeFactory(world)), @@ -142,6 +142,7 @@ Engine::main_iteration() lash_driver->process_events(); #endif*/ // Run the maid (garbage collector) + _post_processor->process(); _maid->cleanup(); return !_quit_flag; @@ -227,7 +228,7 @@ Engine::activate() _audio_driver->activate(); - _post_processor->start(); + //_post_processor->start(); _activated = true; @@ -254,8 +255,8 @@ Engine::deactivate() _audio_driver->root_patch()->deactivate(); // Finalize any lingering events (unlikely) - _post_processor->whip(); - _post_processor->stop(); + //_post_processor->whip(); + //_post_processor->stop(); _audio_driver.reset(); diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index ebb4708b..b9e89189 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -204,7 +204,7 @@ JackAudioDriver::deactivate() cout << "[JackAudioDriver] Deactivated Jack client." << endl; - _engine.post_processor()->stop(); + //_engine.post_processor()->stop(); } } diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 64c106d8..109635df 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -19,7 +19,7 @@ #include <iostream> #include <pthread.h> #include <raul/SRSWQueue.hpp> -#include <raul/Maid.hpp> +//#include <raul/Maid.hpp> #include "Event.hpp" #include "PostProcessor.hpp" @@ -28,14 +28,14 @@ using std::cerr; using std::cout; using std::endl; namespace Ingen { -PostProcessor::PostProcessor(Raul::Maid& maid, size_t queue_size) -: _maid(maid), - _events(queue_size) +PostProcessor::PostProcessor(/*Raul::Maid& maid, */size_t queue_size) + //: _maid(maid) + : _events(queue_size) { - set_name("PostProcessor"); + //set_name("PostProcessor"); } - +#if 0 /** Post-Process every pending event. * * The PostProcessor should be whipped by the audio thread once every cycle @@ -43,12 +43,19 @@ PostProcessor::PostProcessor(Raul::Maid& maid, size_t queue_size) void PostProcessor::_whipped() { + //process(); +} +#endif + +void +PostProcessor::process() +{ while ( ! _events.empty()) { Event* const ev = _events.front(); _events.pop(); assert(ev); ev->post_process(); - _maid.push(ev); + delete ev; } } diff --git a/src/libs/engine/PostProcessor.hpp b/src/libs/engine/PostProcessor.hpp index b77bda6e..114a8bef 100644 --- a/src/libs/engine/PostProcessor.hpp +++ b/src/libs/engine/PostProcessor.hpp @@ -21,9 +21,9 @@ #include <pthread.h> #include "types.hpp" #include <raul/SRSWQueue.hpp> -#include <raul/Slave.hpp> +//#include <raul/Slave.hpp> -namespace Raul { class Maid; } +//namespace Raul { class Maid; } namespace Ingen { @@ -36,20 +36,26 @@ class Event; * is realtime-safe), which signals the processing thread through a semaphore * to handle the event and pass it on to the Maid. * + * Update: This is all run from main_iteration now to solve scripting + * thread issues. Not sure if this is permanent/ideal or not... + * * \ingroup engine */ -class PostProcessor : public Raul::Slave +class PostProcessor //: public Raul::Slave { public: - PostProcessor(Raul::Maid& maid, size_t queue_size); + PostProcessor(/*Raul::Maid& maid, */size_t queue_size); /** Push an event on to the process queue, realtime-safe, not thread-safe. */ inline void push(Event* const ev) { _events.push(ev); } + /** Post-process and delete all pending events */ + void process(); + private: - Raul::Maid& _maid; + //Raul::Maid& _maid; Raul::SRSWQueue<Event*> _events; - virtual void _whipped(); + //virtual void _whipped(); }; diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp index 6414a6e9..ac03ef16 100644 --- a/src/libs/engine/QueuedEventSource.cpp +++ b/src/libs/engine/QueuedEventSource.cpp @@ -106,8 +106,8 @@ QueuedEventSource::process(PostProcessor& dest, SampleCount nframes, FrameTime c ++num_events_processed; } - if (num_events_processed > 0) - dest.whip(); + /*if (num_events_processed > 0) + dest.whip();*/ //else // cerr << "NO PROC: queued: " << unprepared_events() << ", stamped: " << !_stamped_queue.empty() << endl; } diff --git a/src/libs/engine/tuning.hpp b/src/libs/engine/tuning.hpp index 25aa9eb0..7ec55ae4 100644 --- a/src/libs/engine/tuning.hpp +++ b/src/libs/engine/tuning.hpp @@ -30,9 +30,8 @@ static const size_t pre_processor_queue_size = 1024; static const size_t post_processor_queue_size = 1024; static const size_t maid_queue_size = 1024; -// This controls both the LASH event processing rate and the Maid cleanup rate -// (both of which are driven from the main thread) -static const timespec main_rate = { 0, 500000000 }; // 1/2 second +//static const timespec main_rate = { 0, 500000000 }; // 1/2 second +static const timespec main_rate = { 0, 125000000 }; // 1/8 second } // namespace Ingen diff --git a/src/libs/module/World.hpp b/src/libs/module/World.hpp index f665e6ad..1caa50ac 100644 --- a/src/libs/module/World.hpp +++ b/src/libs/module/World.hpp @@ -30,6 +30,9 @@ #endif namespace Ingen { + +class Engine; + namespace Shared { class EngineInterface; @@ -52,6 +55,8 @@ struct World { Raul::RDF::World* rdf_world; EngineInterface* engine; + + Engine* local_engine; }; diff --git a/src/libs/module/module.cpp b/src/libs/module/module.cpp index d169e546..2914907a 100644 --- a/src/libs/module/module.cpp +++ b/src/libs/module/module.cpp @@ -48,6 +48,8 @@ get_world() world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world->world()); slv2_world_load_all(world->slv2_world); #endif + world->engine = NULL; + world->local_engine = NULL; } return world; |