From 90da8601f555c62563d9d9b7ecfb9cf2eb3ca3e5 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 23 Nov 2017 22:56:33 +0100 Subject: [PATCH] Release JACK timebase master when disabling jack transport sync Fixes #525 --- source/backend/CarlaEngine.hpp | 2 +- source/backend/engine/CarlaEngineJack.cpp | 25 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index fb80795e3..f91676df7 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -1041,7 +1041,7 @@ public: /*! * Set the engine option @a option to @a value or @a valueStr. */ - void setOption(const EngineOption option, const int value, const char* const valueStr) noexcept; + virtual void setOption(const EngineOption option, const int value, const char* const valueStr) noexcept; // ------------------------------------------------------------------- // OSC Stuff diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index 079ca110c..89578f69f 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -949,7 +949,8 @@ public: jackbridge_set_process_callback(fClient, carla_jack_process_callback, this); jackbridge_on_shutdown(fClient, carla_jack_shutdown_callback, this); - fTimebaseMaster = jackbridge_set_timebase_callback(fClient, true, carla_jack_timebase_callback, this); + if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_JACK) + fTimebaseMaster = jackbridge_set_timebase_callback(fClient, true, carla_jack_timebase_callback, this); if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY) initJackPatchbay(jackClientName); @@ -1081,6 +1082,28 @@ public: return "JACK"; } +#ifndef BUILD_BRIDGE + void setOption(const EngineOption option, const int value, const char* const valueStr) noexcept override + { + if (option == ENGINE_OPTION_TRANSPORT_MODE && fClient != nullptr) + { + CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_TRANSPORT_MODE_INTERNAL && value <= ENGINE_TRANSPORT_MODE_JACK,); + + if (value == ENGINE_TRANSPORT_MODE_JACK) + { + fTimebaseMaster = jackbridge_set_timebase_callback(fClient, true, carla_jack_timebase_callback, this); + } + else + { + jackbridge_release_timebase(fClient); + fTimebaseMaster = false; + } + } + + CarlaEngine::setOption(option, value, valueStr); + } +#endif + CarlaEngineClient* addClient(CarlaPlugin* const plugin) override { jack_client_t* client = nullptr;