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
This commit is contained in:
Paul Davis 2014-01-16 17:22:19 -05:00
parent 8df4f67460
commit 10933e2003
6 changed files with 73 additions and 21 deletions

View File

@ -40,6 +40,7 @@ class Auditioner : public AudioTrack
~Auditioner ();
int init ();
int connect ();
void audition_region (boost::shared_ptr<Region>);

View File

@ -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);

View File

@ -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<string> 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 (_output->n_ports().n_audio() == 0) {
/* create (and connect) new ports */
_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 ();
} else {
/* reconnect existing ports */
boost::shared_ptr<Port> oleft (_output->nth (0));
boost::shared_ptr<Port> oright (_output->nth (1));
if (oleft) {
oleft->connect (left);
}
if (oright) {
oright->connect (right);
}
}
if (right.length()) {
_output->add_port (right, this, DataType::AUDIO);
}
_main_outs->allow_pan_reset ();
_main_outs->reset_panner ();
}
_output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
return 0;
}
Auditioner::~Auditioner ()
{
return 0;
}
AudioPlaylist&

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}