From e479da3c26d41e977cf55b8e2355db45991be09f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 22 Nov 2009 03:06:25 +0000 Subject: 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 --- src/engine/JackAudioDriver.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/engine/JackAudioDriver.cpp') 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 #include #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); -- cgit v1.2.1