when calling Session::engine_halted() after a user-driven engine stop, make sure...
[ardour.git] / libs / ardour / delivery.cc
index 9e87c89346ec85e725262c0797ce5c49fad389bb..27a12dbc29cdb77ad13dc20e91c69d7759c8d985 100644 (file)
@@ -233,7 +233,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 +266,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 +299,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
 
@@ -355,9 +355,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 +482,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,33 +498,33 @@ Delivery::flush_buffers (framecnt_t nframes)
 }
 
 void
-Delivery::transport_stopped (framepos_t now)
+Delivery::non_realtime_transport_stop (samplepos_t now, bool flush)
 {
-        Processor::transport_stopped (now);
+       Processor::non_realtime_transport_stop (now, flush);
 
        if (_panshell) {
-               _panshell->pannable()->transport_stopped (now);
+               _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 +544,37 @@ 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:
+                       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;
 }