From 40744c672a1db6ca20a1e2a919f3563959217e2f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 20 Mar 2022 15:41:56 +0100 Subject: [PATCH] Fix VST2 callbacks querying tempo-map Some VST2 use a custom thread to make callbacks, in this case the corresponding thread will not have fetched a thread-local tempo-map. --- libs/ardour/session_vst.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc index da76d32888..20505821bf 100644 --- a/libs/ardour/session_vst.cc +++ b/libs/ardour/session_vst.cc @@ -75,7 +75,6 @@ intptr_t Session::vst_callback ( static VstTimeInfo _timeinfo; // only uses as fallback VstTimeInfo* timeinfo; int32_t newflags = 0; - TempoMap::SharedPtr tmap (TempoMap::use()); if (effect && effect->ptr1) { plug = (VSTPlugin *) (effect->ptr1); @@ -183,6 +182,7 @@ intptr_t Session::vst_callback ( timeinfo->nanoSeconds = g_get_monotonic_time () * 1000; if (plug && session) { + TempoMap::SharedPtr tmap (TempoMap::fetch()); samplepos_t now = plug->transport_sample(); timeinfo->samplePos = now; @@ -316,6 +316,7 @@ intptr_t Session::vst_callback ( SHOW_CALLBACK ("audioMasterTempoAt"); // returns tempo (in bpm * 10000) at sample sample location passed in if (session) { + TempoMap::SharedPtr tmap (TempoMap::fetch()); const Tempo& t (tmap->metric_at (value).tempo()); return t.quarter_notes_per_minute() * 1000; } else {