summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/JackAudioDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-30 17:36:38 +0000
committerDavid Robillard <d@drobilla.net>2007-09-30 17:36:38 +0000
commitc40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941 (patch)
tree6e73d5d43284335031cee32f9225b698f315a59d /src/libs/engine/JackAudioDriver.cpp
parent829075dff9fe5d0b3f243f9e40256563a5f8e09a (diff)
downloadingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.tar.gz
ingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.tar.bz2
ingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.zip
Better driver interface for input/output.
MIDI output (pass-through anyway, plugin->output is still screwy). Fix crash on failure to instantiate LV2 plugin. git-svn-id: http://svn.drobilla.net/lad/ingen@786 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/JackAudioDriver.cpp')
-rw-r--r--src/libs/engine/JackAudioDriver.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 4f32beb4..b5748e78 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -267,24 +267,25 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
// FIXME: all of this time stuff is screwy
- static jack_nframes_t start_of_current_cycle = 0;
- static jack_nframes_t start_of_last_cycle = 0;
-
// FIXME: support nframes != buffer_size, even though that never damn well happens
assert(nframes == _buffer_size);
// 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
- start_of_current_cycle = jack_last_frame_time(_client);
- start_of_last_cycle = start_of_current_cycle - nframes;
+ const jack_nframes_t start_of_current_cycle = jack_last_frame_time(_client);
+ const jack_nframes_t start_of_last_cycle = start_of_current_cycle - nframes; // FIXME: maybe not..
+ const jack_nframes_t end_of_current_cycle = start_of_current_cycle + nframes;
// FIXME: ditto
assert(start_of_current_cycle - start_of_last_cycle == nframes);
_transport_state = jack_transport_query(_client, &_position);
+ // Process events that came in during the last cycle
+ // (Aiming for jitter-free 1 block event latency, ideally)
if (_engine.event_source())
- _engine.event_source()->process(*_engine.post_processor(), nframes, start_of_last_cycle, start_of_current_cycle);
+ _engine.event_source()->process(*_engine.post_processor(), nframes,
+ start_of_last_cycle, start_of_current_cycle);
// Set buffers of patch ports to Jack port buffers (zero-copy processing)
for (Raul::List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
@@ -293,14 +294,16 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
}
assert(_engine.midi_driver());
- //_engine.midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle);
- _engine.midi_driver()->prepare_block(start_of_current_cycle, start_of_current_cycle + nframes);
-
+ _engine.midi_driver()->pre_process(_process_context, nframes,
+ start_of_current_cycle, end_of_current_cycle);
// Run root patch
if (_root_patch)
- _root_patch->process(_process_context, nframes, start_of_current_cycle,
- start_of_current_cycle + nframes);
+ _root_patch->process(_process_context, nframes,
+ start_of_current_cycle, end_of_current_cycle);
+
+ _engine.midi_driver()->post_process(_process_context, nframes,
+ start_of_current_cycle, end_of_current_cycle);
return 0;
}