Relax assertion to allow rolling backwards into 0.
[ardour.git] / libs / ardour / session_butler.cc
index 1d235b051aad98888c70b9b35a15c59a2893ac1e..262444c4358cab5fd7b8eec23787df64240d4687 100644 (file)
 
 */
 
-#include <algorithm>
-#include <string>
-#include <cmath>
-#include <cerrno>
-#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
-
-#include <glibmm/threads.h>
-
 #include "pbd/error.h"
 #include "pbd/pthread_utils.h"
 #include "pbd/stacktrace.h"
 #include "ardour/track.h"
 #include "ardour/types.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-/* XXX put this in the right place */
-
-static inline uint32_t next_power_of_two (uint32_t n)
-{
-       --n;
-       n |= n >> 16;
-       n |= n >> 8;
-       n |= n >> 4;
-       n |= n >> 2;
-       n |= n >> 1;
-       ++n;
-       return n;
-}
-
 /*---------------------------------------------------------------------------
  BUTLER THREAD
  ---------------------------------------------------------------------------*/
@@ -100,10 +76,15 @@ Session::schedule_curve_reallocation ()
 }
 
 void
-Session::request_overwrite_buffer (Track* t)
+Session::request_overwrite_buffer (boost::shared_ptr<Route> r)
 {
+       boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (r);
+       if (!t) {
+               return;
+       }
+
        SessionEvent *ev = new SessionEvent (SessionEvent::Overwrite, SessionEvent::Add, SessionEvent::Immediate, 0, 0, 0.0);
-       ev->set_ptr (t);
+       ev->set_ptr (t.get());
        queue_event (ev);
 }