| @@ -2280,6 +2280,7 @@ public: | |||||
| break; | break; | ||||
| case kPluginBridgeNonRtServerUiClosed: | case kPluginBridgeNonRtServerUiClosed: | ||||
| pData->transientTryCounter = 0; | |||||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | ||||
| break; | break; | ||||
| @@ -697,11 +697,13 @@ bool CarlaPlugin::ProtectedData::uiLibClose() noexcept | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| #ifndef BUILD_BRIDGE | |||||
| void CarlaPlugin::ProtectedData::tryTransient() noexcept | void CarlaPlugin::ProtectedData::tryTransient() noexcept | ||||
| { | { | ||||
| if (engine->getOptions().frontendWinId != 0) | if (engine->getOptions().frontendWinId != 0) | ||||
| transientTryCounter = 1; | transientTryCounter = 1; | ||||
| } | } | ||||
| #endif | |||||
| void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin, const bool sendOsc, const bool sendCallback, const bool useDefault) noexcept | void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin, const bool sendOsc, const bool sendCallback, const bool useDefault) noexcept | ||||
| { | { | ||||
| @@ -341,7 +341,9 @@ struct CarlaPlugin::ProtectedData { | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Misc | // Misc | ||||
| #ifndef BUILD_BRIDGE | |||||
| void tryTransient() noexcept; | void tryTransient() noexcept; | ||||
| #endif | |||||
| void updateParameterValues(CarlaPlugin* const plugin, const bool sendOsc, const bool sendCallback, const bool useDefault) noexcept; | void updateParameterValues(CarlaPlugin* const plugin, const bool sendOsc, const bool sendCallback, const bool useDefault) noexcept; | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -425,16 +425,20 @@ public: | |||||
| return CarlaPipeServer::startPipeServer(fFilename, fPluginURI, fUiURI); | return CarlaPipeServer::startPipeServer(fFilename, fPluginURI, fUiURI); | ||||
| } | } | ||||
| void writeUiOptionsMessage(const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) const noexcept | |||||
| void writeUiOptionsMessage(const double sampleRate, const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) const noexcept | |||||
| { | { | ||||
| char tmpBuf[0xff+1]; | char tmpBuf[0xff+1]; | ||||
| tmpBuf[0xff] = '\0'; | tmpBuf[0xff] = '\0'; | ||||
| const CarlaMutexLocker cml(getPipeLock()); | const CarlaMutexLocker cml(getPipeLock()); | ||||
| const ScopedLocale csl; | |||||
| _writeMsgBuffer("uiOptions\n", 10); | _writeMsgBuffer("uiOptions\n", 10); | ||||
| { | { | ||||
| std::snprintf(tmpBuf, 0xff, "%g\n", sampleRate); | |||||
| _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf)); | |||||
| std::snprintf(tmpBuf, 0xff, "%s\n", bool2str(useTheme)); | std::snprintf(tmpBuf, 0xff, "%s\n", bool2str(useTheme)); | ||||
| _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf)); | _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf)); | ||||
| @@ -1089,6 +1093,9 @@ public: | |||||
| if (fFeatures[kFeatureIdExternalUi] != nullptr && fFeatures[kFeatureIdExternalUi]->data != nullptr) | if (fFeatures[kFeatureIdExternalUi] != nullptr && fFeatures[kFeatureIdExternalUi]->data != nullptr) | ||||
| ((LV2_External_UI_Host*)fFeatures[kFeatureIdExternalUi]->data)->plugin_human_id = fLv2Options.windowTitle; | ((LV2_External_UI_Host*)fFeatures[kFeatureIdExternalUi]->data)->plugin_human_id = fLv2Options.windowTitle; | ||||
| if (fPipeServer.isPipeRunning()) | |||||
| fPipeServer.writeUiTitleMessage(fLv2Options.windowTitle); | |||||
| #ifndef LV2_UIS_ONLY_BRIDGES | #ifndef LV2_UIS_ONLY_BRIDGES | ||||
| if (fUI.window != nullptr) | if (fUI.window != nullptr) | ||||
| fUI.window->setTitle(fLv2Options.windowTitle); | fUI.window->setTitle(fLv2Options.windowTitle); | ||||
| @@ -1250,7 +1257,7 @@ public: | |||||
| for (std::size_t i=CARLA_URI_MAP_ID_COUNT, count=fCustomURIDs.count(); i < count; ++i) | for (std::size_t i=CARLA_URI_MAP_ID_COUNT, count=fCustomURIDs.count(); i < count; ++i) | ||||
| fPipeServer.writeLv2UridMessage(static_cast<uint32_t>(i), fCustomURIDs.getAt(i, nullptr)); | fPipeServer.writeLv2UridMessage(static_cast<uint32_t>(i), fCustomURIDs.getAt(i, nullptr)); | ||||
| fPipeServer.writeUiOptionsMessage(true, true, fLv2Options.windowTitle, frontendWinId); | |||||
| fPipeServer.writeUiOptionsMessage(pData->engine->getSampleRate(), true, true, fLv2Options.windowTitle, frontendWinId); | |||||
| fPipeServer.writeShowMessage(); | fPipeServer.writeShowMessage(); | ||||
| } | } | ||||
| @@ -5199,8 +5206,14 @@ public: | |||||
| if (const char* const bridgeBinary = getUiBridgeBinary(uiType)) | if (const char* const bridgeBinary = getUiBridgeBinary(uiType)) | ||||
| { | { | ||||
| carla_stdout("Will use UI-Bridge, binary: \"%s\"", bridgeBinary); | carla_stdout("Will use UI-Bridge, binary: \"%s\"", bridgeBinary); | ||||
| CarlaString guiTitle(pData->name); | |||||
| guiTitle += " (GUI)"; | |||||
| fLv2Options.windowTitle = guiTitle.dup(); | |||||
| fUI.type = UI::TYPE_BRIDGE; | fUI.type = UI::TYPE_BRIDGE; | ||||
| fPipeServer.setData(bridgeBinary, fRdfDescriptor->URI, fUI.rdfDescriptor->URI); | fPipeServer.setData(bridgeBinary, fRdfDescriptor->URI, fUI.rdfDescriptor->URI); | ||||
| delete[] bridgeBinary; | delete[] bridgeBinary; | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -608,8 +608,12 @@ public: | |||||
| fCustomURIDs.append(carla_strdup(uri)); | fCustomURIDs.append(carla_strdup(uri)); | ||||
| } | } | ||||
| void uiOptionsChanged(const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) override | |||||
| void uiOptionsChanged(const double sampleRate, const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) override | |||||
| { | { | ||||
| carla_debug("CarlaLv2Client::uiOptionsChanged(%g, %s, %s, \"%s\", " P_UINTPTR ")", sampleRate, bool2str(useTheme), bool2str(useThemeColors), windowTitle, transientWindowId); | |||||
| fLv2Options.sampleRate = gSampleRate = sampleRate; | |||||
| fUiOptions.useTheme = useTheme; | fUiOptions.useTheme = useTheme; | ||||
| fUiOptions.useThemeColors = useThemeColors; | fUiOptions.useThemeColors = useThemeColors; | ||||
| fUiOptions.windowTitle = windowTitle; | fUiOptions.windowTitle = windowTitle; | ||||
| @@ -106,9 +106,11 @@ const char* CarlaBridgeUI::libError() const noexcept | |||||
| bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | ||||
| { | { | ||||
| if (! fGotOptions) { | |||||
| CARLA_SAFE_ASSERT_RETURN(std::strcmp(msg, "urid") == 0 || std::strcmp(msg, "uiOptions") == 0, true); | |||||
| } | |||||
| carla_debug("CarlaBridgeUI::msgReceived(\"%s\")", msg); | |||||
| if (! fGotOptions) { | |||||
| CARLA_SAFE_ASSERT_RETURN(std::strcmp(msg, "urid") == 0 || std::strcmp(msg, "uiOptions") == 0, true); | |||||
| } | |||||
| if (std::strcmp(msg, "control") == 0) | if (std::strcmp(msg, "control") == 0) | ||||
| { | { | ||||
| @@ -208,17 +210,19 @@ bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | |||||
| if (std::strcmp(msg, "uiOptions") == 0) | if (std::strcmp(msg, "uiOptions") == 0) | ||||
| { | { | ||||
| double sampleRate; | |||||
| bool useTheme, useThemeColors; | bool useTheme, useThemeColors; | ||||
| const char* windowTitle; | const char* windowTitle; | ||||
| uint64_t transientWindowId; | uint64_t transientWindowId; | ||||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsDouble(sampleRate), true); | |||||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useTheme), true); | CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useTheme), true); | ||||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useThemeColors), true); | CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useThemeColors), true); | ||||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(windowTitle), true); | CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(windowTitle), true); | ||||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true); | CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true); | ||||
| fGotOptions = true; | fGotOptions = true; | ||||
| uiOptionsChanged(useTheme, useThemeColors, windowTitle, static_cast<uintptr_t>(transientWindowId)); | |||||
| uiOptionsChanged(sampleRate, useTheme, useThemeColors, windowTitle, static_cast<uintptr_t>(transientWindowId)); | |||||
| delete[] windowTitle; | delete[] windowTitle; | ||||
| return true; | return true; | ||||
| @@ -71,7 +71,7 @@ protected: | |||||
| virtual void dspAtomReceived(const uint32_t index, const LV2_Atom* const atom) = 0; | virtual void dspAtomReceived(const uint32_t index, const LV2_Atom* const atom) = 0; | ||||
| virtual void dspURIDReceived(const LV2_URID urid, const char* const uri) = 0; | virtual void dspURIDReceived(const LV2_URID urid, const char* const uri) = 0; | ||||
| virtual void uiOptionsChanged(const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) = 0; | |||||
| virtual void uiOptionsChanged(const double sampleRate, const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) = 0; | |||||
| public: | public: | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||