mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-24 07:27:44 +01:00
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)
This commit is contained in:
parent
0fc3bbddb2
commit
dec10f2f3c
4 changed files with 20 additions and 170 deletions
|
|
@ -597,10 +597,6 @@ protected:
|
|||
|
||||
virtual int no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing);
|
||||
|
||||
void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
|
||||
|
||||
void passthru (BufferSet&, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader);
|
||||
|
||||
virtual void write_out_of_band_data (BufferSet& /* bufs */, samplepos_t /* start_sample */, samplepos_t /* end_sample */, samplecnt_t /* nframes */) {}
|
||||
|
||||
void process_output_buffers (BufferSet& bufs,
|
||||
|
|
@ -680,9 +676,6 @@ protected:
|
|||
|
||||
int configure_processors (ProcessorStreams*);
|
||||
|
||||
void passthru_silence (samplepos_t start_sample, samplepos_t end_sample,
|
||||
pframes_t nframes, int declick);
|
||||
|
||||
void silence (samplecnt_t);
|
||||
void silence_unlocked (samplecnt_t);
|
||||
|
||||
|
|
@ -747,6 +740,9 @@ private:
|
|||
|
||||
pframes_t latency_preroll (pframes_t nframes, samplepos_t& start_sample, samplepos_t& end_sample);
|
||||
|
||||
void run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader);
|
||||
void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
|
||||
|
||||
void reset_instrument_info ();
|
||||
void solo_control_changed (bool self, PBD::Controllable::GroupControlDisposition);
|
||||
void maybe_note_meter_position ();
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ class LIBARDOUR_API Track : public Route, public Recordable
|
|||
|
||||
bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
|
||||
|
||||
virtual int no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing);
|
||||
|
||||
bool needs_butler() const { return _needs_butler; }
|
||||
|
||||
bool can_record();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,130 +429,6 @@ Track::set_name (const string& str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
Track::no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing)
|
||||
{
|
||||
/* no outputs? nothing to do ... what happens if we have sends etc. ? */
|
||||
|
||||
if (n_outputs().n_total() == 0 && !ARDOUR::Profile->get_mixbus()) {
|
||||
//Note: Mixbus has its own output mechanism, so we should operate even if no explicit outputs are assigned
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* not active ... do the minimum possible by just outputting silence */
|
||||
|
||||
if (!_active) {
|
||||
silence (nframes);
|
||||
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
|
||||
_meter->reset();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (session_state_changing) {
|
||||
if (_session.transport_speed() != 0.0f) {
|
||||
/* we're rolling but some state is changing (e.g. our
|
||||
disk reader contents) so we cannot use them. Be
|
||||
silent till this is over. Don't declick.
|
||||
|
||||
XXX note the absurdity of ::no_roll() being called when we ARE rolling!
|
||||
*/
|
||||
passthru_silence (start_sample, end_sample, nframes, 0);
|
||||
return 0;
|
||||
}
|
||||
/* we're really not rolling, so we're either delivery silence or actually
|
||||
monitoring, both of which are safe to do while session_state_changing is true.
|
||||
*/
|
||||
}
|
||||
|
||||
// XXX this needs to go away.. disk-reader or Route::process_output_buffers needs to handle this XXX //
|
||||
|
||||
bool be_silent;
|
||||
MonitorState const s = monitoring_state ();
|
||||
/* we are not rolling, so be silent even if we are monitoring disk, as there
|
||||
will be no disk data coming in.
|
||||
*/
|
||||
switch (s) {
|
||||
case MonitoringSilence:
|
||||
be_silent = true;
|
||||
break;
|
||||
case MonitoringDisk:
|
||||
be_silent = true;
|
||||
break;
|
||||
case MonitoringInput:
|
||||
be_silent = false;
|
||||
break;
|
||||
default:
|
||||
be_silent = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//if we have an internal generator, let it play regardless of monitoring state
|
||||
if (_have_internal_generator) {
|
||||
be_silent = false;
|
||||
}
|
||||
|
||||
/* if have_internal_generator, or .. */
|
||||
|
||||
if (be_silent) {
|
||||
|
||||
#if 0
|
||||
// XXX this is also the only user of IO::process_input ()
|
||||
|
||||
if (_meter_point == MeterInput) {
|
||||
/* still need input monitoring and metering */
|
||||
|
||||
bool const track_rec = _disk_writer->record_enabled ();
|
||||
bool const auto_input = _session.config.get_auto_input ();
|
||||
bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
|
||||
bool const tape_machine_mode = Config->get_tape_machine_mode ();
|
||||
bool no_meter = false;
|
||||
|
||||
/* this needs a proper K-map
|
||||
* and should be separated into a function similar to monitoring_state()
|
||||
* that also handles roll() states in audio_track.cc, midi_track.cc and route.cc
|
||||
*
|
||||
* see http://www.oofus.co.uk/ardour/Ardour3MonitorModesV3.pdf
|
||||
*/
|
||||
if (!auto_input && !track_rec) {
|
||||
no_meter=true;
|
||||
}
|
||||
else if (tape_machine_mode && !track_rec && auto_input) {
|
||||
no_meter=true;
|
||||
}
|
||||
else if (!software_monitor && tape_machine_mode && !track_rec) {
|
||||
no_meter=true;
|
||||
}
|
||||
else if (!software_monitor && !tape_machine_mode && !track_rec && !auto_input) {
|
||||
no_meter=true;
|
||||
}
|
||||
|
||||
if (no_meter) {
|
||||
BufferSet& bufs (_session.get_silent_buffers (n_process_buffers()));
|
||||
_meter->run (bufs, start_sample, end_sample, 1.0, nframes, true);
|
||||
_input->process_input (boost::shared_ptr<Processor>(), start_sample, end_sample, _session.transport_speed(), nframes);
|
||||
} else {
|
||||
_input->process_input (_meter, start_sample, end_sample, _session.transport_speed(), nframes);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
passthru_silence (start_sample, end_sample, nframes, 0);
|
||||
|
||||
} else {
|
||||
|
||||
BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
|
||||
|
||||
fill_buffers_with_input (bufs, _input, nframes);
|
||||
|
||||
passthru (bufs, start_sample, end_sample, nframes, false, true, false);
|
||||
}
|
||||
|
||||
flush_processor_buffers_locked (nframes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Playlist>
|
||||
Track::playlist ()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue