- for (PortSet::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
- i->get_buffer().silence (nframes, offset);
- }
-}
-
-/** Deliver bufs to the IO's Jack outputs.
- *
- * This function should automatically do whatever it necessary to correctly deliver bufs
- * to the outputs, eg applying gain or pan or whatever else needs to be done.
- */
-void
-IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
-{
- // FIXME: type specific code doesn't actually need to be here, it will go away in time
-
- /* ********** AUDIO ********** */
-
- // Apply gain if gain automation isn't playing
- if ( ! apply_gain_automation) {
-
- gain_t dg = _gain; // desired gain
-
- {
- Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
-
- if (dm.locked()) {
- dg = _desired_gain;
- }
-
- }
-
- if (dg != _gain || dg != 1.0)
- Amp::run_in_place(bufs, nframes, _gain, dg, _phase_invert);
- }
-
- // 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);
- } else {
- const DataType type = DataType::AUDIO;
-
- // Copy any audio 1:1 to outputs
-
- BufferSet::iterator o = output_buffers().begin(type);
- 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 ********** */
-
- // No MIDI, we're done here
- if (bufs.count().n_midi() == 0) {
- return;
- }
-
- const DataType type = DataType::MIDI;
-
- // Copy any MIDI 1:1 to outputs
- assert(bufs.count().n_midi() == output_buffers().count().n_midi());
- BufferSet::iterator o = output_buffers().begin(type);
- for (BufferSet::iterator i = bufs.begin(type); i != bufs.end(type); ++i, ++o) {
- o->read_from(*i, nframes, offset);