From 302854ae65b5bef44bc013d3be9837f8a384bbb9 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 10 Nov 2019 14:07:46 +0100 Subject: [PATCH] Fix 0 BPM when starting carla as transport master, and not rolling --- source/backend/engine/CarlaEngine.cpp | 2 ++ source/backend/engine/CarlaEngineJack.cpp | 14 ++++++++++++++ source/frontend/carla_host.py | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index feb238bb6..13b89ba98 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1536,6 +1536,8 @@ void CarlaEngine::transportPause() noexcept void CarlaEngine::transportBPM(const double bpm) noexcept { + CARLA_SAFE_ASSERT_RETURN(bpm >= 20.0,) + try { pData->time.setBPM(bpm); } CARLA_SAFE_EXCEPTION("CarlaEngine::transportBPM"); diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index 29b597de2..47ecfe0c7 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -1221,6 +1221,20 @@ public: } #endif + void callback(const bool sendHost, const bool sendOsc, + const EngineCallbackOpcode action, const uint pluginId, + const int value1, const int value2, const int value3, + const float valuef, const char* const valueStr) noexcept override + { + if (action == ENGINE_CALLBACK_PROJECT_LOAD_FINISHED && fTimebaseMaster) + { + // project finished loading, need to set bpm here, so we force an update of timebase master + transportRelocate(pData->timeInfo.frame); + } + + CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr); + } + bool setBufferSizeAndSampleRate(const uint bufferSize, const double sampleRate) override { CARLA_SAFE_ASSERT_RETURN(carla_isEqual(pData->sampleRate, sampleRate), false); diff --git a/source/frontend/carla_host.py b/source/frontend/carla_host.py index 33a35f080..b0749b3fc 100644 --- a/source/frontend/carla_host.py +++ b/source/frontend/carla_host.py @@ -838,7 +838,8 @@ class HostWindow(QMainWindow): settings = QSettings() lastBpm = settings.value("LastBPM", 120.0, type=float) del settings - self.host.transport_bpm(lastBpm) + if lastBpm >= 20.0: + self.host.transport_bpm(lastBpm) return elif firstInit: