diff options
author | Robin Gareus <robin@gareus.org> | 2017-09-30 18:53:02 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-09-30 18:53:02 +0200 |
commit | dec10f2f3c6fffe27e72243d9bf36713d8f084f9 (patch) | |
tree | dc7929061e69643c6f6505296a4244be5d26afc6 /libs/ardour/route.cc | |
parent | 0fc3bbddb280f237d6c9066caee8712ad8888aa4 (diff) |
First part of consolidating ::roll(), ::no_roll()
This moves common code (get and fill buffers) into ::passthru()
and renames ::passthru() to ::run_route().
passthru_silence() is no longer used (it was only needed A5 style
Track::no_roll_unlocked for no-roll + disk-monitoring)
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r-- | libs/ardour/route.cc | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 18d5e945e5..73b3ee7662 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -678,14 +678,18 @@ void Route::monitor_run (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick) { assert (is_monitor()); - BufferSet& bufs (_session.get_route_buffers (n_process_buffers())); - fill_buffers_with_input (bufs, _input, nframes); - passthru (bufs, start_sample, end_sample, nframes, declick, true, false); + run_route (start_sample, end_sample, nframes, declick, true, false); } void -Route::passthru (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader) +Route::run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader) { + BufferSet& bufs (_session.get_route_buffers (n_process_buffers())); + + fill_buffers_with_input (bufs, _input, nframes); + + /* filter captured data before meter sees it */ + filter_input (bufs); if (is_monitor() && _session.listening() && !_session.is_auditioning()) { @@ -704,16 +708,8 @@ Route::passthru (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp /* run processor chain */ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, gain_automation_ok, run_disk_reader); -} -void -Route::passthru_silence (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick) -{ - BufferSet& bufs (_session.get_route_buffers (n_process_buffers(), true)); - - bufs.set_count (_input->n_ports()); - write_out_of_band_data (bufs, start_sample, end_sample, nframes); - process_output_buffers (bufs, start_sample, end_sample, nframes, declick, false, false); + flush_processor_buffers_locked (nframes); } void @@ -3645,8 +3641,11 @@ Route::no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sam int Route::no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing) { + /* Must be called with the processor lock held */ + if (!_active) { silence_unlocked (nframes); + _meter->reset(); return 0; } @@ -3658,6 +3657,7 @@ Route::no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_ XXX note the absurdity of ::no_roll() being called when we ARE rolling! */ silence_unlocked (nframes); + _meter->reset(); return 0; } /* we're really not rolling, so we're either delivery silence or actually @@ -3665,16 +3665,7 @@ Route::no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_ */ } - BufferSet& bufs = _session.get_route_buffers (n_process_buffers()); - - fill_buffers_with_input (bufs, _input, nframes); - - /* filter captured data before meter sees it */ - filter_input (bufs); - - passthru (bufs, start_sample, end_sample, nframes, 0, true, false); - - flush_processor_buffers_locked (nframes); + run_route (start_sample, end_sample, nframes, 0, false, false); return 0; } @@ -3729,30 +3720,19 @@ Route::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample if (!_active) { silence_unlocked (nframes); - if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || (!_disk_writer || _disk_writer->record_enabled()))) { - _meter->reset(); - } + _meter->reset(); return 0; } + if ((nframes = latency_preroll (nframes, start_sample, end_sample)) == 0) { return 0; } - BufferSet& bufs = _session.get_route_buffers (n_process_buffers ()); - - fill_buffers_with_input (bufs, _input, nframes); - - /* filter captured data before meter sees it */ - filter_input (bufs); - - passthru (bufs, start_sample, end_sample, nframes, declick, (!_disk_writer || !_disk_writer->record_enabled()) && _session.transport_rolling(), true); + run_route (start_sample, end_sample, nframes, declick, (!_disk_writer || !_disk_writer->record_enabled()) && _session.transport_rolling(), true); if ((_disk_reader && _disk_reader->need_butler()) || (_disk_writer && _disk_writer->need_butler())) { need_butler = true; } - - flush_processor_buffers_locked (nframes); - return 0; } |