smooth 0.5 second fade out during quit, plus MIDI panic to turn everything off (someo...
[ardour.git] / libs / ardour / session_process.cc
index c8f76f3d7071eeb17d2a050b39f68d82e08d2e46..585d0927f27fd0311817ce4edb749d85d9fab74c 100644 (file)
 
 #include <glibmm/thread.h>
 
-#include "ardour/ardour.h"
 #include "ardour/audioengine.h"
 #include "ardour/auditioner.h"
 #include "ardour/butler.h"
+#include "ardour/cycle_timer.h"
 #include "ardour/debug.h"
+#include "ardour/graph.h"
+#include "ardour/port.h"
 #include "ardour/process_thread.h"
 #include "ardour/session.h"
 #include "ardour/slave.h"
-#include "ardour/timestamps.h"
-#include "ardour/graph.h"
-#include "ardour/audio_port.h"
-#include "ardour/tempo.h"
 #include "ardour/ticker.h"
-#include "ardour/cycle_timer.h"
+#include "ardour/types.h"
 
 #include "midi++/manager.h"
 #include "midi++/mmc.h"
@@ -96,7 +94,6 @@ Session::process (pframes_t nframes)
        }
 
        SendFeedback (); /* EMIT SIGNAL */
-
 }
 
 int
@@ -112,7 +109,7 @@ Session::no_roll (pframes_t nframes)
        
        framepos_t end_frame = _transport_frame + nframes; // FIXME: varispeed + no_roll ??
        int ret = 0;
-       bool declick = get_transport_declick_required();
+       int declick = get_transport_declick_required();
        boost::shared_ptr<RouteList> r = routes.reader ();
 
        if (_click_io) {
@@ -161,7 +158,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
 
        const framepos_t start_frame = _transport_frame;
        const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed);
-
+       
        if (_process_graph) {
                DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n");
                _process_graph->process_routes (nframes, start_frame, end_frame, declick, need_butler);
@@ -1024,6 +1021,17 @@ Session::process_event (SessionEvent* ev)
                del = false;
                break;
 
+       case SessionEvent::AutoLoopDeclick:
+               if (play_loop) {
+                       /* Request a declick fade-out and a fade-in; the fade-out will happen
+                          at the end of the loop, and the fade-in at the start.
+                       */
+                       transport_sub_state |= (PendingLoopDeclickOut | PendingLoopDeclickIn);
+               }
+               remove = false;
+               del = false;
+               break;
+
        case SessionEvent::Locate:
                if (ev->yes_or_no) {
                        // cerr << "forced locate to " << ev->target_frame << endl;