From a8a4695466ec5ab01b747b57089e952f78549d81 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Jul 2022 04:44:05 +0200 Subject: [PATCH] Dump SessionEvent cross-thread pool when it overflows --- libs/ardour/ardour/session_event.h | 2 ++ libs/ardour/session_events.cc | 46 +++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 956495cb9e..99473e437c 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -200,4 +200,6 @@ protected: } /* namespace */ +LIBARDOUR_API std::ostream& operator<<(std::ostream&, const ARDOUR::SessionEvent&); + #endif /* __ardour_session_event_h__ */ diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 1225022175..309c7f93e7 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -28,6 +28,8 @@ #include "ardour/debug.h" #include "ardour/session_event.h" +#include "ardour/track.h" +#include "ardour/region.h" #include "pbd/i18n.h" @@ -65,7 +67,7 @@ SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems) a CrossThreadPool for use by this thread whenever events are allocated/released from SessionEvent::pool() */ - pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems); + pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems, [](size_t i, void*p) { std::cout << i << " " << *static_cast (p) << "\n";}); } SessionEvent::SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn, bool yn2, bool yn3) @@ -364,3 +366,45 @@ SessionEventManager::_clear_event_type (SessionEvent::Type type) set_next_event (); } + +std::ostream& operator<<(std::ostream& o, ARDOUR::SessionEvent const& ev) { + o << "SessionEvent" + << " type: " << enum_2_string (ev.type) + << " action: " << enum_2_string (ev.action) + << " atime: " << ev.action_sample + << " ttime: " << ev.target_sample; + + switch (ev.type) { + case SessionEvent::Locate: + o << " disposition: " << ev.locate_transport_disposition; + o << " force: " << ev.yes_or_no; + break; + case SessionEvent::LocateRoll: + o << " force: " << ev.yes_or_no; + break; + case SessionEvent::SetDefaultPlaySpeed: + /* fallthrough */ + case SessionEvent::SetTransportSpeed: + o << " speed: " << ev.speed; + break; + case SessionEvent::EndRoll: + o << " abort: " << ev.yes_or_no; + o << " clear: " << ev.second_yes_or_no; + break; + case SessionEvent::OverwriteAll: + o << " reason: " << ev.overwrite; + break; + case SessionEvent::Audition: + o << " region: '" << ev.region->name () << "'"; + break; + case SessionEvent::Overwrite: + if (boost::shared_ptr track = ev.track.lock ()) { + o << " track: '" << track->name () << "'"; + } + o << " reason: " << ev.overwrite; + break; + default: + break; + } + return o; +}