diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/buffer_set.h | 1 | ||||
-rw-r--r-- | libs/ardour/io.cc | 22 | ||||
-rw-r--r-- | libs/ardour/route.cc | 30 | ||||
-rw-r--r-- | libs/ardour/session.cc | 55 |
4 files changed, 73 insertions, 35 deletions
diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 03b0b193d4..3520f95eb3 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -120,6 +120,7 @@ public: iterator& operator++() { ++_index; return *this; } // yes, prefix only bool operator==(const iterator& other) { return (_index == other._index); } bool operator!=(const iterator& other) { return (_index != other._index); } + iterator operator=(const iterator& other) { _set = other._set; _type = other._type; _index = other._index; return *this; } private: friend class BufferSet; diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index b3dc2a89c9..184077b5f1 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -255,18 +255,30 @@ IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, // Use the panner to distribute audio to output port buffers if (_panner && !_panner->empty() && !_panner->bypassed()) { - _panner->distribute(bufs, output_buffers(), start_frame, end_frame, nframes, offset); + _panner->distribute (bufs, output_buffers(), start_frame, end_frame, nframes, offset); } else { const DataType type = DataType::AUDIO; - + // Copy any audio 1:1 to outputs - assert(bufs.count().get(DataType::AUDIO) == output_buffers().count().get(DataType::AUDIO)); + BufferSet::iterator o = output_buffers().begin(type); - for (BufferSet::iterator i = bufs.begin(type); i != bufs.end(type); ++i, ++o) { + BufferSet::iterator i = bufs.begin(type); + BufferSet::iterator prev = i; + + while (i != bufs.end(type) && o != output_buffers().end (type)) { o->read_from(*i, nframes, offset); + prev = i; + ++i; + ++o; } - } + /* extra outputs get a copy of the last buffer */ + + while (o != output_buffers().end(type)) { + o->read_from(*prev, nframes, offset); + ++o; + } + } /* ********** MIDI ********** */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index e78706b71a..d361386324 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -431,7 +431,6 @@ Route::process_output_buffers (BufferSet& bufs, } else { co->deliver_output (bufs, start_frame, end_frame, nframes, offset); - } } @@ -588,7 +587,7 @@ Route::process_output_buffers (BufferSet& bufs, (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) ) { - + co->silence (nframes, offset); } else { @@ -645,7 +644,7 @@ Route::process_output_buffers (BufferSet& bufs, if (_meter_point == MeterPostFader) { peak_meter().reset(); } - + IO::silence (nframes, offset); } else { @@ -1763,11 +1762,17 @@ Route::set_control_outs (const vector<string>& ports) { Glib::Mutex::Lock lm (control_outs_lock); vector<string>::const_iterator i; - + size_t limit; + if (_control_outs) { delete _control_outs; _control_outs = 0; } + + if (control() || master()) { + /* no control outs for these two special busses */ + return 0; + } if (ports.empty()) { return 0; @@ -1781,8 +1786,23 @@ Route::set_control_outs (const vector<string>& ports) /* our control outs need as many outputs as we have audio outputs. we track the changes in ::output_change_handler(). */ + + // XXX its stupid that we have to get this value twice - _control_outs->ensure_io (ChanCount::ZERO, ChanCount(DataType::AUDIO, n_outputs().get(DataType::AUDIO)), true, this); + limit = n_outputs().get(DataType::AUDIO); + + if (_control_outs->ensure_io (ChanCount::ZERO, ChanCount (DataType::AUDIO, n_outputs().get (DataType::AUDIO)), true, this)) { + return -1; + } + + /* now connect to the named ports */ + + for (size_t n = 0; n < limit; ++n) { + if (_control_outs->connect_output (_control_outs->output (n), ports[n], this)) { + error << string_compose (_("could not connect %1 to %2"), _control_outs->output(n)->name(), ports[n]) << endmsg; + return -1; + } + } return 0; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ff549f9896..d29795904e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -913,6 +913,7 @@ Session::hookup_io () if (_control_out) { uint32_t n; + vector<string> cports; while (_control_out->n_inputs().get(DataType::AUDIO) < _control_out->input_maximum().get(DataType::AUDIO)) { if (_control_out->add_input_port ("", this)) { @@ -930,7 +931,20 @@ Session::hookup_io () } n++; } - } + + + uint32_t ni = _control_out->n_inputs().get (DataType::AUDIO); + + for (n = 0; n < ni; ++n) { + cports.push_back (_control_out->input(n)->name()); + } + + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator x = r->begin(); x != r->end(); ++x) { + (*x)->set_control_outs (cports); + } + } /* Tell all IO objects to connect themselves together */ @@ -1793,19 +1807,6 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod channels_used += track->n_inputs ().get(DataType::AUDIO); - if (_control_out) { - vector<string> cports; - uint32_t ni = _control_out->n_inputs().get(DataType::AUDIO); - - for (n = 0; n < ni; ++n) { - cports.push_back (_control_out->input(n)->name()); - } - - track->set_control_outs (cports); - } - - // assert (current_thread != RT_thread) - track->audio_diskstream()->non_realtime_input_change(); track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes)); @@ -1968,16 +1969,6 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_ } } - if (_control_out) { - vector<string> cports; - uint32_t ni = _control_out->n_inputs().get(DataType::AUDIO); - - for (uint32_t n = 0; n < ni; ++n) { - cports.push_back (_control_out->input(n)->name()); - } - bus->set_control_outs (cports); - } - bus->set_remote_control_id (control_id); ++control_id; @@ -2034,9 +2025,23 @@ Session::add_routes (RouteList& new_routes, bool save) if ((*x)->control()) { _control_out = (*x); - } + } } + if (_control_out && IO::connecting_legal) { + + vector<string> cports; + uint32_t ni = _control_out->n_inputs().get(DataType::AUDIO); + + for (uint32_t n = 0; n < ni; ++n) { + cports.push_back (_control_out->input(n)->name()); + } + + for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) { + (*x)->set_control_outs (cports); + } + } + set_dirty(); if (save) { |