summaryrefslogtreecommitdiffstats
path: root/src/engine/JackAudioDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-22 03:06:25 +0000
committerDavid Robillard <d@drobilla.net>2009-11-22 03:06:25 +0000
commite479da3c26d41e977cf55b8e2355db45991be09f (patch)
treef6887a9b19eaee951dafd17fea8021556bff1169 /src/engine/JackAudioDriver.cpp
parent58807f5840592959c31b415f7e2d64967594b5ee (diff)
downloadingen-e479da3c26d41e977cf55b8e2355db45991be09f.tar.gz
ingen-e479da3c26d41e977cf55b8e2355db45991be09f.tar.bz2
ingen-e479da3c26d41e977cf55b8e2355db45991be09f.zip
Partial support for message/value ports and the message context.
This use case now works: - Add an event input and the "print" plugin from imum.lv2 to ingen - Connect the event input to the input of "print" - Hook Ingen up to JACK and play some MIDI events (or get events to the print plugin from anywhere else) - The "print" plugin will print the received events to the console in the message context (i.e. the audio thread is realtime safe) git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2281 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/JackAudioDriver.cpp')
-rw-r--r--src/engine/JackAudioDriver.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/engine/JackAudioDriver.cpp b/src/engine/JackAudioDriver.cpp
index 86f946da..edb1ba9a 100644
--- a/src/engine/JackAudioDriver.cpp
+++ b/src/engine/JackAudioDriver.cpp
@@ -21,21 +21,22 @@
#include <iostream>
#include <cstdlib>
#include "raul/List.hpp"
+#include "AudioBuffer.hpp"
+#include "DuplexPort.hpp"
#include "Engine.hpp"
-#include "util.hpp"
#include "Event.hpp"
-#include "ThreadManager.hpp"
-#include "QueuedEvent.hpp"
#include "EventSource.hpp"
-#include "PostProcessor.hpp"
+#include "EventSource.hpp"
+#include "JackMidiDriver.hpp"
+#include "MessageContext.hpp"
+#include "MidiDriver.hpp"
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
-#include "MidiDriver.hpp"
-#include "DuplexPort.hpp"
-#include "EventSource.hpp"
-#include "AudioBuffer.hpp"
+#include "PostProcessor.hpp"
#include "ProcessSlave.hpp"
-#include "JackMidiDriver.hpp"
+#include "QueuedEvent.hpp"
+#include "ThreadManager.hpp"
+#include "util.hpp"
using namespace std;
using namespace Raul;
@@ -343,16 +344,9 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
// FIXME: support nframes != buffer_size, even though that never damn well happens
assert(nframes == _buffer_size / sizeof(Sample));
- // Jack can elect to not call this function for a cycle, if overloaded
- // FIXME: this doesn't make sense, and the start time isn't used anyway
+ // Note that Jack can not call this function for a cycle, if overloaded
const jack_nframes_t start_of_current_cycle = jack_last_frame_time(_client);
-
- const jack_nframes_t end_of_current_cycle = start_of_current_cycle + nframes;
-#ifndef NDEBUG
- // FIXME: support changing cycle length
- const jack_nframes_t start_of_last_cycle = start_of_current_cycle - nframes;
- assert(start_of_current_cycle - start_of_last_cycle == nframes);
-#endif
+ const jack_nframes_t end_of_current_cycle = start_of_current_cycle + nframes;
_transport_state = jack_transport_query(_client, &_position);
@@ -378,6 +372,10 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
if (_root_patch)
_root_patch->process(_process_context);
+ // Signal message context to run if necessary
+ if (_engine.message_context()->has_requests())
+ _engine.message_context()->signal();
+
if (_engine.midi_driver())
_engine.midi_driver()->post_process(_process_context);