X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fdelivery.cc;h=463bfce88bc989eb2e1e1e1163cb400a94f2d17a;hb=903c3ec5a;hp=a4cc7885d8fe467f35b2e5b94cc9fb918d4f374c;hpb=24e92c1861e91835a62e38d76a516bfec915d43c;p=ardour.git diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index a4cc7885d8..463bfce88b 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -1,20 +1,24 @@ /* - Copyright (C) 2009 Paul Davis - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + * Copyright (C) 2009-2012 Carl Hetherington + * Copyright (C) 2009-2012 David Robillard + * Copyright (C) 2009-2017 Paul Davis + * Copyright (C) 2013-2017 Robin Gareus + * Copyright (C) 2018 Len Ovens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ #include #include @@ -63,7 +67,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr io, boost::shared_ptr(new PannerShell (_name, _session, pannable, is_send)); } @@ -87,7 +91,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr pannable, boost::sha { if (pannable) { bool is_send = false; - if (r & (Delivery::Send|Delivery::Aux)) is_send = true; + if (r & (Delivery::Send|Delivery::Aux|Delivery::Foldback)) is_send = true; _panshell = boost::shared_ptr(new PannerShell (_name, _session, pannable, is_send)); } @@ -233,7 +237,7 @@ Delivery::configure_io (ChanCount in, ChanCount out) } void -Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double /*speed*/, pframes_t nframes, bool result_required) +Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double /*speed*/, pframes_t nframes, bool result_required) { assert (_output); @@ -266,7 +270,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do if (tgain != _current_gain) { /* target gain has changed */ - _current_gain = Amp::apply_gain (bufs, _session.nominal_frame_rate(), nframes, _current_gain, tgain); + _current_gain = Amp::apply_gain (bufs, _session.nominal_sample_rate(), nframes, _current_gain, tgain); } else if (tgain < GAIN_COEFF_SMALL) { @@ -299,7 +303,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do // Use the panner to distribute audio to output port buffers - _panshell->run (bufs, output_buffers(), start_frame, end_frame, nframes); + _panshell->run (bufs, output_buffers(), start_sample, end_sample, nframes); // non-audio data will not have been delivered by the panner @@ -345,7 +349,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do if (outs.count ().get (*t) <= n) { continue; } - b->read_from (outs.get (*t, n++), nframes, (*t == DataType::AUDIO ? 0 : -Port::port_offset())); + b->read_from (outs.get_available (*t, n++), nframes, (*t == DataType::AUDIO ? 0 : -Port::port_offset())); } } } @@ -355,9 +359,9 @@ out: } XMLNode& -Delivery::state (bool full_state) +Delivery::state () { - XMLNode& node (IOProcessor::state (full_state)); + XMLNode& node (IOProcessor::state ()); if (_role & Main) { node.set_property("type", "main-outs"); @@ -482,7 +486,7 @@ Delivery::reset_panners () } void -Delivery::flush_buffers (framecnt_t nframes) +Delivery::flush_buffers (samplecnt_t nframes) { /* io_lock, not taken: function must be called from Session::process() calltree */ @@ -498,7 +502,7 @@ Delivery::flush_buffers (framecnt_t nframes) } void -Delivery::non_realtime_transport_stop (framepos_t now, bool flush) +Delivery::non_realtime_transport_stop (samplepos_t now, bool flush) { Processor::non_realtime_transport_stop (now, flush); @@ -506,25 +510,25 @@ Delivery::non_realtime_transport_stop (framepos_t now, bool flush) _panshell->pannable()->non_realtime_transport_stop (now, flush); } - if (_output) { - PortSet& ports (_output->ports()); + if (_output) { + PortSet& ports (_output->ports()); - for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { - i->transport_stopped (); - } - } + for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { + i->transport_stopped (); + } + } } void Delivery::realtime_locate () { if (_output) { - PortSet& ports (_output->ports()); + PortSet& ports (_output->ports()); - for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { - i->realtime_locate (); - } - } + for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { + i->realtime_locate (); + } + } } gain_t @@ -544,38 +548,38 @@ Delivery::target_gain () return GAIN_COEFF_ZERO; } - MuteMaster::MutePoint mp = MuteMaster::Main; // stupid gcc uninit warning - - switch (_role) { - case Main: - mp = MuteMaster::Main; - break; - case Listen: - mp = MuteMaster::Listen; - break; - case Send: - case Insert: - case Aux: - if (_pre_fader) { - mp = MuteMaster::PreFader; - } else { - mp = MuteMaster::PostFader; - } - break; - } + MuteMaster::MutePoint mp = MuteMaster::Main; // stupid gcc uninit warning - gain_t desired_gain = _mute_master->mute_gain_at (mp); + switch (_role) { + case Main: + mp = MuteMaster::Main; + break; + case Listen: + mp = MuteMaster::Listen; + break; + case Send: + case Insert: + case Aux: + case Foldback: + if (_pre_fader) { + mp = MuteMaster::PreFader; + } else { + mp = MuteMaster::PostFader; + } + break; + } - if (_role == Listen && _session.monitor_out() && !_session.listening()) { + gain_t desired_gain = _mute_master->mute_gain_at (mp); - /* nobody is soloed, and this delivery is a listen-send to the - control/monitor/listen bus, we should be silent since - it gets its signal from the master out. - */ + if (_role == Listen && _session.monitor_out() && !_session.listening()) { - desired_gain = GAIN_COEFF_ZERO; + /* nobody is soloed, and this delivery is a listen-send to the + * control/monitor/listen bus, we should be silent since + * it gets its signal from the master out. + */ - } + desired_gain = GAIN_COEFF_ZERO; + } return desired_gain; }