| @@ -1006,12 +1006,7 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // OSC Stuff | |||
| #ifdef BUILD_BRIDGE | |||
| /*! | |||
| * Check if OSC bridge is registered. | |||
| */ | |||
| bool isOscBridgeRegistered() const noexcept; | |||
| #else | |||
| #ifndef BUILD_BRIDGE | |||
| /*! | |||
| * Check if OSC controller is registered. | |||
| */ | |||
| @@ -1033,13 +1028,6 @@ public: | |||
| */ | |||
| const char* getOscServerPathUDP() const noexcept; | |||
| #ifdef BUILD_BRIDGE | |||
| /*! | |||
| * Set OSC bridge data. | |||
| */ | |||
| void setOscBridgeData(CarlaOscData* const oscData) const noexcept; | |||
| #endif | |||
| // ------------------------------------------------------------------- | |||
| // Helper functions | |||
| @@ -1420,12 +1420,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||
| // ----------------------------------------------------------------------- | |||
| // OSC Stuff | |||
| #ifdef BUILD_BRIDGE | |||
| bool CarlaEngine::isOscBridgeRegistered() const noexcept | |||
| { | |||
| return (pData->oscData != nullptr); | |||
| } | |||
| #else | |||
| #ifndef BUILD_BRIDGE | |||
| bool CarlaEngine::isOscControlRegistered() const noexcept | |||
| { | |||
| return pData->osc.isControlRegistered(); | |||
| @@ -1447,13 +1442,6 @@ const char* CarlaEngine::getOscServerPathUDP() const noexcept | |||
| return pData->osc.getServerPathUDP(); | |||
| } | |||
| #ifdef BUILD_BRIDGE | |||
| void CarlaEngine::setOscBridgeData(CarlaOscData* const oscData) const noexcept | |||
| { | |||
| pData->oscData = oscData; | |||
| } | |||
| #endif | |||
| // ----------------------------------------------------------------------- | |||
| // Helper functions | |||
| @@ -788,13 +788,6 @@ protected: | |||
| break; | |||
| } | |||
| case kPluginBridgeRtClientSetCVPool: { | |||
| const uint64_t poolSize(fShmRtClientControl.readULong()); | |||
| CARLA_SAFE_ASSERT_BREAK(poolSize > 0); | |||
| //fShmCVPool.data = (float*)jackbridge_shm_map(fShmCVPool.shm, static_cast<size_t>(poolSize)); | |||
| break; | |||
| } | |||
| case kPluginBridgeRtClientControlEventParameter: { | |||
| const uint32_t time(fShmRtClientControl.readUInt()); | |||
| const uint8_t channel(fShmRtClientControl.readByte()); | |||
| @@ -110,6 +110,7 @@ private: | |||
| #ifndef BUILD_BRIDGE | |||
| int handleMsgRegister(const bool isTCP, const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source); | |||
| int handleMsgUnregister(); | |||
| #endif | |||
| // Internal methods | |||
| int handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS); | |||
| @@ -125,7 +126,6 @@ private: | |||
| int handleMsgSetMidiProgram(CARLA_ENGINE_OSC_HANDLE_ARGS); | |||
| int handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS); | |||
| int handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS); | |||
| #endif | |||
| // ----------------------------------------------------------------------- | |||
| @@ -47,12 +47,13 @@ void CarlaEngineThread::run() noexcept | |||
| bool needsSingleThread, needsUiUpdates, oscRegisted; | |||
| float value; | |||
| #ifdef BUILD_BRIDGE | |||
| oscRegisted = false; | |||
| #endif | |||
| for (; kEngine->isRunning() && ! shouldThreadExit();) | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| oscRegisted = kEngine->isOscBridgeRegistered(); | |||
| #else | |||
| #ifndef BUILD_BRIDGE | |||
| oscRegisted = kEngine->isOscControlRegistered(); | |||
| #endif | |||
| @@ -1431,7 +1431,7 @@ void CarlaPlugin::clearBuffers() noexcept | |||
| void CarlaPlugin::registerToOscClient() noexcept | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| if (! pData->engine->isOscBridgeRegistered()) | |||
| return; | |||
| #else | |||
| if (! pData->engine->isOscControlRegistered()) | |||
| #endif | |||
| @@ -130,12 +130,6 @@ public: | |||
| StringArray arguments; | |||
| #ifndef CARLA_OS_WIN | |||
| // start with "wine" if needed | |||
| if (fBinary.endsWith(".exe")) | |||
| arguments.add("wine"); | |||
| #endif | |||
| // binary | |||
| arguments.add(fBinary.buffer()); | |||
| @@ -205,57 +205,7 @@ public: | |||
| // --------------------------------------------------------------------- | |||
| void oscInit(const char* const url) | |||
| { | |||
| fOscServerThread = lo_server_thread_new_with_proto(nullptr, LO_UDP, osc_error_handler); | |||
| CARLA_SAFE_ASSERT_RETURN(fOscServerThread != nullptr,) | |||
| { | |||
| char* const host = lo_url_get_hostname(url); | |||
| char* const port = lo_url_get_port(url); | |||
| fOscControlData.path = carla_strdup_free(lo_url_get_path(url)); | |||
| fOscControlData.target = lo_address_new_with_proto(LO_UDP, host, port); | |||
| std::free(host); | |||
| std::free(port); | |||
| } | |||
| if (char* const tmpServerPath = lo_server_thread_get_url(fOscServerThread)) | |||
| { | |||
| std::srand((uint)(uintptr_t)this); | |||
| std::srand((uint)(uintptr_t)&url); | |||
| CarlaString oscName("plug-" + CarlaString(std::rand() % 99999)); | |||
| fOscServerPath = tmpServerPath; | |||
| fOscServerPath += oscName; | |||
| std::free(tmpServerPath); | |||
| } | |||
| lo_server_thread_start(fOscServerThread); | |||
| fEngine->setOscBridgeData(&fOscControlData); | |||
| } | |||
| void oscClose() | |||
| { | |||
| lo_server_thread_stop(fOscServerThread); | |||
| fEngine->setOscBridgeData(nullptr); | |||
| if (fOscServerThread != nullptr) | |||
| { | |||
| lo_server_thread_free(fOscServerThread); | |||
| fOscServerThread = nullptr; | |||
| } | |||
| fOscControlData.clear(); | |||
| fOscServerPath.clear(); | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| /* | |||
| void sendOscUpdate() const noexcept | |||
| { | |||
| if (fOscControlData.target != nullptr) | |||
| @@ -273,6 +223,7 @@ public: | |||
| if (fOscControlData.target != nullptr) | |||
| osc_send_bridge_error(fOscControlData, error); | |||
| } | |||
| */ | |||
| // --------------------------------------------------------------------- | |||
| @@ -377,9 +328,9 @@ int main(int argc, char* argv[]) | |||
| // --------------------------------------------------------------------- | |||
| // Check argument count | |||
| if (argc != 5) | |||
| if (argc != 4 && argc != 5) | |||
| { | |||
| carla_stdout("usage: %s <type> <filename> <label> <uniqueId>", argv[0]); | |||
| carla_stdout("usage: %s <type> <filename> <label> [uniqueId]", argv[0]); | |||
| return 1; | |||
| } | |||
| @@ -389,7 +340,7 @@ int main(int argc, char* argv[]) | |||
| const char* const stype = argv[1]; | |||
| const char* const filename = argv[2]; | |||
| const char* label = argv[3]; | |||
| const int64_t uniqueId = static_cast<int64_t>(std::atoll(argv[4])); | |||
| const int64_t uniqueId = (argc == 5) ? static_cast<int64_t>(std::atoll(argv[4])) : 0; | |||
| // --------------------------------------------------------------------- | |||
| // Check plugin type | |||
| @@ -413,10 +364,9 @@ int main(int argc, char* argv[]) | |||
| // --------------------------------------------------------------------- | |||
| // Setup options | |||
| const char* const oscUrl(std::getenv("ENGINE_BRIDGE_OSC_URL")); | |||
| const char* const shmIds(std::getenv("ENGINE_BRIDGE_SHM_IDS")); | |||
| const bool useBridge = (shmIds != nullptr && oscUrl != nullptr); | |||
| const bool useBridge = (shmIds != nullptr); | |||
| // --------------------------------------------------------------------- | |||
| // Setup bridge ids | |||
| @@ -479,12 +429,6 @@ int main(int argc, char* argv[]) | |||
| return 1; | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| // Init OSC | |||
| if (useBridge) | |||
| bridge.oscInit(oscUrl); | |||
| // --------------------------------------------------------------------- | |||
| // Listen for ctrl+c or sigint/sigterm events | |||
| @@ -501,8 +445,8 @@ int main(int argc, char* argv[]) | |||
| if (useBridge) | |||
| { | |||
| bridge.sendOscUpdate(); | |||
| bridge.sendOscBridgeUpdate(); | |||
| //bridge.sendOscUpdate(); | |||
| //bridge.sendOscBridgeUpdate(); | |||
| } | |||
| else | |||
| { | |||
| @@ -524,15 +468,9 @@ int main(int argc, char* argv[]) | |||
| const char* const lastError(carla_get_last_error()); | |||
| carla_stderr("Plugin failed to load, error was:\n%s", lastError); | |||
| if (useBridge) | |||
| bridge.sendOscBridgeError(lastError); | |||
| //if (useBridge) | |||
| // bridge.sendOscBridgeError(lastError); | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| // Close OSC | |||
| if (useBridge) | |||
| bridge.oscClose(); | |||
| return ret; | |||
| } | |||
| @@ -26,7 +26,6 @@ | |||
| enum PluginBridgeRtClientOpcode { | |||
| kPluginBridgeRtClientNull = 0, | |||
| kPluginBridgeRtClientSetAudioPool, // ulong/ptr | |||
| kPluginBridgeRtClientSetCVPool, // ulong/ptr | |||
| kPluginBridgeRtClientControlEventParameter, // uint/frame, byte/chan, ushort, float | |||
| kPluginBridgeRtClientControlEventMidiBank, // uint/frame, byte/chan, ushort | |||
| kPluginBridgeRtClientControlEventMidiProgram, // uint/frame, byte/chan, ushort | |||
| @@ -156,8 +155,6 @@ const char* PluginBridgeRtClientOpcode2str(const PluginBridgeRtClientOpcode opco | |||
| return "kPluginBridgeRtClientNull"; | |||
| case kPluginBridgeRtClientSetAudioPool: | |||
| return "kPluginBridgeRtClientSetAudioPool"; | |||
| case kPluginBridgeRtClientSetCVPool: | |||
| return "kPluginBridgeRtClientSetCVPool"; | |||
| case kPluginBridgeRtClientControlEventParameter: | |||
| return "kPluginBridgeRtClientControlEventParameter"; | |||
| case kPluginBridgeRtClientControlEventMidiBank: | |||