diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 6af10ea10..8b45e7d3a 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -209,7 +209,7 @@ public: opcode = fShmControl.readOpcode(); CARLA_ASSERT_INT(opcode == kPluginBridgeOpcodeSetBufferSize, opcode); - pData->bufferSize = fShmControl.readInt(); + pData->bufferSize = fShmControl.readUInt(); carla_stderr("BufferSize: %i", pData->bufferSize); opcode = fShmControl.readOpcode(); @@ -301,7 +301,7 @@ public: case kPluginBridgeOpcodeSetBufferSize: { - const int bufferSize(fShmControl.readInt()); + const uint32_t bufferSize(fShmControl.readUInt()); bufferSizeChanged(bufferSize); break; } diff --git a/source/backend/plugin/BridgePlugin.cpp b/source/backend/plugin/BridgePlugin.cpp index 6ad5490b1..e0d1132f7 100644 --- a/source/backend/plugin/BridgePlugin.cpp +++ b/source/backend/plugin/BridgePlugin.cpp @@ -1665,7 +1665,7 @@ public: if (name != nullptr && name[0] != '\0') pData->name = pData->engine->getUniquePluginName(name); - pData->filename = filename; + pData->filename = carla_strdup(filename); fBridgeBinary = bridgeBinary; // --------------------------------------------------------------- diff --git a/source/bridges/CarlaBridgeClient.cpp b/source/bridges/CarlaBridgeClient.cpp index c58d010ee..1be884a15 100644 --- a/source/bridges/CarlaBridgeClient.cpp +++ b/source/bridges/CarlaBridgeClient.cpp @@ -190,7 +190,7 @@ void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) c osc_send_control(fOscData, index, value); } -void CarlaBridgeClient::sendOscProgram(const int32_t index) const +void CarlaBridgeClient::sendOscProgram(const uint32_t index) const { carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); @@ -198,7 +198,7 @@ void CarlaBridgeClient::sendOscProgram(const int32_t index) const osc_send_program(fOscData, index); } -void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) const +void CarlaBridgeClient::sendOscMidiProgram(const uint32_t index) const { carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); diff --git a/source/bridges/CarlaBridgeClient.hpp b/source/bridges/CarlaBridgeClient.hpp index dfd3da786..2bb9f9c36 100644 --- a/source/bridges/CarlaBridgeClient.hpp +++ b/source/bridges/CarlaBridgeClient.hpp @@ -90,8 +90,8 @@ public: protected: void sendOscConfigure(const char* const key, const char* const value) const; void sendOscControl(const int32_t index, const float value) const; - void sendOscProgram(const int32_t index) const; - void sendOscMidiProgram(const int32_t index) const; + void sendOscProgram(const uint32_t index) const; + void sendOscMidiProgram(const uint32_t index) const; void sendOscMidi(const uint8_t midiBuf[4]) const; void sendOscExiting() const; diff --git a/source/bridges/CarlaBridgePlugin.cpp b/source/bridges/CarlaBridgePlugin.cpp index 5f1b00813..0a04e6bd3 100644 --- a/source/bridges/CarlaBridgePlugin.cpp +++ b/source/bridges/CarlaBridgePlugin.cpp @@ -194,7 +194,7 @@ public: void exec() { - while (! gCloseNow) + for (; ! gCloseNow;) { idle(); carla_msleep(30); @@ -251,7 +251,7 @@ public: fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); } - void setParameterMidiChannel(const int32_t index, const uint8_t channel) + void setParameterMidiChannel(const uint32_t index, const uint8_t channel) { CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); carla_debug("CarlaPluginClient::setParameterMidiChannel(%i, %i)", index, channel); @@ -259,7 +259,7 @@ public: fPlugin->setParameterMidiChannel(index, channel, false, false); } - void setParameterMidiCC(const int32_t index, const int16_t cc) + void setParameterMidiCC(const uint32_t index, const int16_t cc) { CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); carla_debug("CarlaPluginClient::setParameterMidiCC(%i, %i)", index, cc); @@ -366,7 +366,9 @@ int CarlaBridgeOsc::handleMsgShow() { carla_debug("CarlaBridgeOsc::handleMsgShow()"); - carla_show_custom_ui(0, true); + if (carla_get_plugin_info(0)->hints & CarlaBackend::PLUGIN_HAS_CUSTOM_UI) + carla_show_custom_ui(0, true); + return 0; } @@ -374,7 +376,9 @@ int CarlaBridgeOsc::handleMsgHide() { carla_debug("CarlaBridgeOsc::handleMsgHide()"); - carla_show_custom_ui(0, false); + if (carla_get_plugin_info(0)->hints & CarlaBackend::PLUGIN_HAS_CUSTOM_UI) + carla_show_custom_ui(0, false); + return 0; } diff --git a/source/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp index 5c81f7ac8..50d591a38 100644 --- a/source/utils/CarlaRingBuffer.hpp +++ b/source/utils/CarlaRingBuffer.hpp @@ -139,6 +139,13 @@ public: return i; } + uint32_t readUInt() noexcept + { + int32_t i = -1; + tryRead(&i, sizeof(int32_t)); + return (i >= 0) ? static_cast(i) : 0; + } + int64_t readLong() noexcept { int64_t l = 0; diff --git a/source/utils/CarlaShmUtils.hpp b/source/utils/CarlaShmUtils.hpp index 35b5e3db7..9c0921475 100644 --- a/source/utils/CarlaShmUtils.hpp +++ b/source/utils/CarlaShmUtils.hpp @@ -102,7 +102,7 @@ shm_t carla_shm_attach_linux(const char* const name) static inline shm_t carla_shm_create(const char* const name) { - CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', -1); + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', gNullCarlaShm); return shm_open(name, O_RDWR|O_CREAT|O_EXCL, 0600); } @@ -110,7 +110,7 @@ shm_t carla_shm_create(const char* const name) static inline shm_t carla_shm_attach(const char* const name) { - CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', -1); + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', gNullCarlaShm); return shm_open(name, O_RDWR, 0); }