Declick before the end of seamless loops, not after the end, so that loops are render...
[ardour.git] / libs / ardour / session_process.cc
index 60cb6ecee1f634022a00a86a82effcecdf6c474c..3936423b141a98e46ffc0cb09504e5bbe0bfd894 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"
 
 #include "i18n.h"
 
+#include <xmmintrin.h>
+
 using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
@@ -60,8 +60,6 @@ Session::process (pframes_t nframes)
 {
        framepos_t transport_at_start = _transport_frame;
 
-       MIDI::Manager::instance()->cycle_start(nframes);
-
        _silent = false;
 
        if (processing_blocked()) {
@@ -96,8 +94,6 @@ Session::process (pframes_t nframes)
        }
 
        SendFeedback (); /* EMIT SIGNAL */
-
-       MIDI::Manager::instance()->cycle_end();
 }
 
 int
@@ -113,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) {
@@ -1025,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;