summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/Makefile.am5
-rw-r--r--src/bindings/ingen.i5
-rwxr-xr-xsrc/bindings/test_ingen.py35
-rw-r--r--src/libs/engine/Engine.cpp9
-rw-r--r--src/libs/engine/JackAudioDriver.cpp2
-rw-r--r--src/libs/engine/PostProcessor.cpp21
-rw-r--r--src/libs/engine/PostProcessor.hpp18
-rw-r--r--src/libs/engine/QueuedEventSource.cpp4
-rw-r--r--src/libs/engine/tuning.hpp5
-rw-r--r--src/libs/module/World.hpp5
-rw-r--r--src/libs/module/module.cpp2
-rw-r--r--src/progs/ingen/main.cpp1
12 files changed, 69 insertions, 43 deletions
diff --git a/src/bindings/Makefile.am b/src/bindings/Makefile.am
index 48a5ad4f..cb86a915 100644
--- a/src/bindings/Makefile.am
+++ b/src/bindings/Makefile.am
@@ -10,6 +10,11 @@ bindings_LTLIBRARIES = libingen_bindings.la
libingen_bindings_la_LDFLAGS = -no-undefined -module -avoid-version
libingen_bindings_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ #../libs/module/libingen_module.la
libingen_bindings_la_SOURCES = ingen_wrap.cxx ingen_bindings.cpp ingen_bindings.hpp
+libingen_bindings_la_CXXFLAGS = \
+ @SLV2_CFLAGS@ @RAUL_CFLAGS@ @GLIBMM_CFLAGS@ \
+ -I$(top_srcdir)/ingen/src/common \
+ -I$(top_srcdir)/ingen/src/libs \
+ -I/usr/include/python2.4
swig: ingen.i
swig -c++ -Wall $(FLAGS) -python ingen.i
diff --git a/src/bindings/ingen.i b/src/bindings/ingen.i
index 719ece20..5eb942d9 100644
--- a/src/bindings/ingen.i
+++ b/src/bindings/ingen.i
@@ -42,6 +42,11 @@ namespace Ingen { namespace Shared {
return Ingen::Shared::ingen_world;
}
}
+
+ void iteration() {
+ Ingen::Shared::script_iteration($self);
+ }
+
/*SLV2World slv2() { return $self->me->slv2_world; }*/
};
diff --git a/src/bindings/test_ingen.py b/src/bindings/test_ingen.py
index 4109dd21..9b925155 100755
--- a/src/bindings/test_ingen.py
+++ b/src/bindings/test_ingen.py
@@ -1,40 +1,34 @@
#!/usr/bin/env python
+
import ingen
import time
world = ingen.World()
class PythonClient(ingen.Client):
- #def __init__(self):
- # ingen.Client(self)
- # print "Client"
-
- def bundle_begin():
- print "Bundle {"
+ def error(self, msg):
+ print "*** Received error:", msg
+ def bundle_begin(self):
+ print "*** Receiving Bundle {"
+
+ def bundle_end(self):
+ print "*** }"
def new_port(self, path, data_type, is_output):
- print "Port:", path, data_type, is_output
+ print "*** Received Port:", path, data_type, is_output
+
+ def new_node(self, plugin_uri, path, polyphonic, nports):
+ print "*** Received Node:", plugin_uri, path, polyphonic, nports
c = PythonClient()
-c.thisown = 0
-print "C OWN", c.thisown
-#print c.__base__
+c.enable()
e = world.engine
-print "E OWN", e.thisown
-e.thisown = 0
-#print e
-
e.activate()
-#e.register_client("foo", c)
c.subscribe(e)
-c.enable()
-#c.new_patch("/foo/bar", 1)
-
-
e.create_port("/I", "ingen:midi", False)
e.create_port("/made", "ingen:audio", False)
e.create_port("/these", "ingen:audio", False)
@@ -43,5 +37,6 @@ e.create_port("/a", "ingen:audio", True)
e.create_port("/script", "ingen:audio", True)
while True:
- time.sleep(1)
+ world.iteration()
+ time.sleep(0.1)
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;
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index 22ace336..f424eff0 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -88,6 +88,7 @@ main(int argc, char** argv)
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.get();
} else {
engine_module.reset();
}