Respond to MMC even when synced to JACK. Fixes #3700.
[ardour.git] / libs / ardour / session_events.cc
index 170a1c0c4c987dc9e75ce86f4007e79f5e05a9c4..df47cd5baf25752a156285c4891ac2737a99f7f4 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
+#include "pbd/stacktrace.h"
 
 #include "ardour/ardour.h"
 #include "ardour/audio_diskstream.h"
@@ -46,7 +47,7 @@ SessionEvent::init_event_pool ()
 }
 
 void
-SessionEvent::create_per_thread_pool (const std::string& name, unsigned long nitems)
+SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
 {
        /* this is a per-thread call that simply creates a thread-private ptr to
           a CrossThreadPool for use by this thread whenever events are allocated/released
@@ -60,6 +61,7 @@ SessionEvent::operator new (size_t)
 {
        CrossThreadPool* p = pool->per_thread_pool ();
        SessionEvent* ev = static_cast<SessionEvent*> (p->alloc ());
+       DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_self(), p->name(), ev));
        ev->own_pool = p;
        return ev;
 }
@@ -70,6 +72,17 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
        Pool* p = pool->per_thread_pool ();
        SessionEvent* ev = static_cast<SessionEvent*> (ptr);
 
+        DEBUG_TRACE (DEBUG::SessionEvents, string_compose (
+                            "%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n",
+                            pthread_self(), ev, p->name(), ev->own_pool->name()
+                            ));
+
+#ifdef NDEBUG
+       if (DEBUG::SessionEvents & PBD::debug_bits) {
+               stacktrace (cerr, 20);
+       }
+#endif
+       
        if (p == ev->own_pool) {
                p->release (ptr);
        } else {
@@ -78,21 +91,21 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
 }
 
 void
-SessionEventManager::add_event (nframes64_t frame, SessionEvent::Type type, nframes64_t target_frame)
+SessionEventManager::add_event (framepos_t frame, SessionEvent::Type type, framepos_t target_frame)
 {
        SessionEvent* ev = new SessionEvent (type, SessionEvent::Add, frame, target_frame, 0);
        queue_event (ev);
 }
 
 void
-SessionEventManager::remove_event (nframes64_t frame, SessionEvent::Type type)
+SessionEventManager::remove_event (framepos_t frame, SessionEvent::Type type)
 {
        SessionEvent* ev = new SessionEvent (type, SessionEvent::Remove, frame, 0, 0);
        queue_event (ev);
 }
 
 void
-SessionEventManager::replace_event (SessionEvent::Type type, nframes64_t frame, nframes64_t target)
+SessionEventManager::replace_event (SessionEvent::Type type, framepos_t frame, framepos_t target)
 {
        SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, frame, target, 0);
        queue_event (ev);