From: Paul Davis Date: Thu, 16 Jan 2014 22:22:19 +0000 (-0500) Subject: allow auditioning via the monitor section to work. X-Git-Tag: 3.5.308~35 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=10933e200369ecceb2c8b3a52be41b930955d269 allow auditioning via the monitor section to work. Ideally, we would feed the monitor section via an internal (aux) send/return, but this is an improvement over what we had before --- diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index bdd04fcc66..5ce3ddaddf 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -40,6 +40,7 @@ class Auditioner : public AudioTrack ~Auditioner (); int init (); + int connect (); void audition_region (boost::shared_ptr); diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc index b4e2a55ac2..aa4f64755a 100644 --- a/libs/ardour/audio_buffer.cc +++ b/libs/ardour/audio_buffer.cc @@ -88,7 +88,7 @@ AudioBuffer::check_silence (pframes_t nframes, bool wholebuffer, pframes_t& n) c void AudioBuffer::silence (framecnt_t len, framecnt_t offset) { - pframes_t n = 0; + if (!_silent) { assert(_capacity > 0); assert(offset + len <= _capacity); diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 9f7dd85b52..73670798d8 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -54,13 +54,31 @@ Auditioner::init () if (Track::init ()) { return -1; } + + if (connect ()) { + return -1; + } + + _output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2)); + + return 0; +} + +Auditioner::~Auditioner () +{ +} +int +Auditioner::connect () +{ string left = Config->get_auditioner_output_left(); string right = Config->get_auditioner_output_right(); vector outputs; _session.engine().get_physical_outputs (DataType::AUDIO, outputs); + via_monitor = false; + if (left.empty() || left == "default") { if (_session.monitor_out()) { left = _session.monitor_out()->input()->audio (0)->name(); @@ -83,31 +101,49 @@ Auditioner::init () } } + _output->disconnect (this); + if (left.empty() && right.empty()) { - warning << _("no outputs available for auditioner - manual connection required") << endmsg; + if (_output->n_ports().n_audio() == 0) { + /* ports not set up, so must be during startup */ + warning << _("no outputs available for auditioner - manual connection required") << endmsg; + } } else { - _main_outs->defer_pan_reset (); - - if (left.length()) { - _output->add_port (left, this, DataType::AUDIO); - } - - if (right.length()) { - _output->add_port (right, this, DataType::AUDIO); - } - - _main_outs->allow_pan_reset (); - _main_outs->reset_panner (); - } + if (_output->n_ports().n_audio() == 0) { - _output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2)); + /* create (and connect) new ports */ - return 0; -} + _main_outs->defer_pan_reset (); + + if (left.length()) { + _output->add_port (left, this, DataType::AUDIO); + } + + if (right.length()) { + _output->add_port (right, this, DataType::AUDIO); + } + + _main_outs->allow_pan_reset (); + _main_outs->reset_panner (); -Auditioner::~Auditioner () -{ + } else { + + /* reconnect existing ports */ + + boost::shared_ptr oleft (_output->nth (0)); + boost::shared_ptr oright (_output->nth (1)); + if (oleft) { + oleft->connect (left); + } + if (oright) { + oright->connect (right); + } + } + + } + + return 0; } AudioPlaylist& diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index f994fe3d69..046bf7998e 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -544,6 +544,7 @@ Route::monitor_run (framepos_t start_frame, framepos_t end_frame, pframes_t nfra { assert (is_monitor()); BufferSet& bufs (_session.get_route_buffers (n_process_buffers())); + fill_buffers_with_input (bufs, _input, nframes); passthru (bufs, start_frame, end_frame, nframes, declick); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 115fcd750a..53d670a1f4 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -805,6 +805,12 @@ Session::remove_monitor_section () /* force reversion to Solo-In-Place */ Config->set_solo_control_is_listen_control (false); + /* if we are auditioning, cancel it ... this is a workaround + to a problem (auditioning does not execute the process graph, + which is needed to remove routes when using >1 core for processing) + */ + cancel_audition (); + { /* Hold process lock while doing this so that we don't hear bits and * pieces of audio as we work on each route. @@ -835,6 +841,10 @@ Session::remove_monitor_section () remove_route (_monitor_out); auto_connect_master_bus (); + + if (auditioner) { + auditioner->connect (); + } } void @@ -979,6 +989,10 @@ Session::add_monitor_section () (*x)->enable_monitor_send (); } } + + if (auditioner) { + auditioner->connect (); + } } void diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 6d8c0f9f70..6bfb250aec 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -875,7 +875,7 @@ Session::process_audition (pframes_t nframes) /* if using a monitor section, run it because otherwise we don't hear anything */ - if (auditioner->needs_monitor()) { + if (_monitor_out && auditioner->needs_monitor()) { _monitor_out->monitor_run (_transport_frame, _transport_frame + nframes, nframes, false); }