diff options
author | Robin Gareus <robin@gareus.org> | 2017-09-30 23:16:04 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-09-30 23:16:04 +0200 |
commit | eb0dded0954782768834e1d3a494f45cc4a118a1 (patch) | |
tree | 7f67841c0c04354f4b20f2f9510493000679e18d /libs/ardour/route.cc | |
parent | 97c637e39914a8b68f1d0c83d3f8c37d81fc43c2 (diff) |
Immediate-event/out-of-band injection update & tweak clearing buffers
Immediate events are used for MIDI-Panic and to inject GUI generated
events e.g. patch-changes, note-events from the track-header
(scroomer-keyboard) and patch-change audition.
Current behavior:
- snapshot copy immediate events from ringbuffer into a buffer at
the beginning of each the cycle.
- Inject immediate events into input-buffer directly after reading the input
- process "normally"
- pass immediate event-buffer to disk-writer, so it can skip them
(don't write immediate events to disk)
- if the Route is not monitoring input: clear buffer before disk-reader
and re-inject (original) immediate events after the disk-reader
- immediate events process normally and are also sent to outputs.
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r-- | libs/ardour/route.cc | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 0f8c892b24..236f2d7c0c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -402,7 +402,8 @@ Route::process_output_buffers (BufferSet& bufs, * Also during remaining_latency_preroll, transport_rolling () is false, but * we may need to monitor disk instead. */ - bool silence = _have_internal_generator ? false : (monitoring_state () == MonitoringSilence); + MonitorState ms = monitoring_state (); + bool silence = _have_internal_generator ? false : (ms == MonitoringSilence); _main_outs->no_outs_cuz_we_no_monitor (silence); @@ -524,6 +525,24 @@ Route::process_output_buffers (BufferSet& bufs, /* input->latency() + */ latency, /* output->latency() + */ playback_latency); } + bool re_inject_oob_data = false; + if ((*i) == _disk_reader) { + /* Well now, we've made it past the disk-writer and to the disk-reader. + * Time to decide what to do about monitoring. + * + * Even when not doing MonitoringDisk, we need to run the processors, + * so that it advances its internal buffers (IFF run_disk_reader is true). + * + */ + if (ms == MonitoringDisk || ms == MonitoringSilence) { + /* this will clear out-of-band data, too (e.g. MIDI-PC, Panic etc. + * OOB data is written at the end of the cycle (nframes - 1), + * and jack does not re-order events, so we push them back later */ + re_inject_oob_data = true; + bufs.silence (nframes, 0); + } + } + double pspeed = speed; if ((!run_disk_reader && (*i) == _disk_reader) || (!run_disk_writer && (*i) == _disk_writer)) { /* run with speed 0, no-roll */ @@ -531,6 +550,7 @@ Route::process_output_buffers (BufferSet& bufs, } (*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back()); + bufs.set_count ((*i)->output_streams()); /* Note: plugin latency may change. While the plugin does inform the session via @@ -542,6 +562,11 @@ Route::process_output_buffers (BufferSet& bufs, if ((*i)->active ()) { latency += (*i)->signal_latency (); } + + if (re_inject_oob_data) { + write_out_of_band_data (bufs, nframes); + } + #if 0 if ((*i) == _delayline) { latency += _delayline->get_delay (); @@ -701,14 +726,18 @@ Route::run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nf bufs.silence (nframes, 0); } + snapshot_out_of_band_data (nframes); /* append immediate messages to the first MIDI buffer (thus sending it to the first output port) */ - write_out_of_band_data (bufs, start_sample, end_sample, nframes); + write_out_of_band_data (bufs, nframes); /* run processor chain */ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, gain_automation_ok, run_disk_reader); + /* map events (e.g. MIDI-CC) back to control-parameters */ + update_controls (bufs); + flush_processor_buffers_locked (nframes); } |