| @@ -1037,12 +1037,6 @@ public: | |||
| */ | |||
| EngineEvent* getInternalEventBuffer(const bool isInput) const noexcept; | |||
| /*! | |||
| * Force register a plugin into slot @a id. | |||
| * This is needed so we can receive OSC events for a plugin while it initializes. | |||
| */ | |||
| void registerEnginePlugin(const uint id, CarlaPlugin* const plugin) noexcept; | |||
| #ifndef BUILD_BRIDGE | |||
| /*! | |||
| * Virtual functions for handling MIDI ports in the rack graph. | |||
| @@ -1177,30 +1171,7 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Bridge/Controller OSC stuff | |||
| #ifdef BUILD_BRIDGE | |||
| void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const uint optionsAvailable, const uint optionsEnabled, const int64_t uniqueId) const noexcept; | |||
| void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept; | |||
| void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const noexcept; | |||
| void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const noexcept; | |||
| void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const noexcept; | |||
| void oscSend_bridge_program_count(const uint32_t count) const noexcept; | |||
| void oscSend_bridge_midi_program_count(const uint32_t count) const noexcept; | |||
| void oscSend_bridge_parameter_data1(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const int16_t cc) const noexcept; | |||
| void oscSend_bridge_parameter_data2(const uint32_t index, const char* const name, const char* const unit) const noexcept; | |||
| void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept; | |||
| void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept; | |||
| void oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept; | |||
| void oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept; | |||
| void oscSend_bridge_current_program(const int32_t index) const noexcept; | |||
| void oscSend_bridge_current_midi_program(const int32_t index) const noexcept; | |||
| void oscSend_bridge_program_name(const uint32_t index, const char* const name) const noexcept; | |||
| void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept; | |||
| void oscSend_bridge_configure(const char* const key, const char* const value) const noexcept; | |||
| void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const noexcept; | |||
| void oscSend_bridge_set_chunk_data_file(const char* const chunkDataFile) const noexcept; | |||
| void oscSend_bridge_set_peaks() const noexcept; | |||
| void oscSend_bridge_pong() const noexcept; | |||
| #else | |||
| #ifndef BUILD_BRIDGE | |||
| void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const noexcept; | |||
| void oscSend_control_add_plugin_end(const uint pluginId) const noexcept; | |||
| void oscSend_control_remove_plugin(const uint pluginId) const noexcept; | |||
| @@ -710,11 +710,13 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // OSC stuff | |||
| #ifndef BUILD_BRIDGE | |||
| /*! | |||
| * Register this plugin to the engine's OSC client (controller or bridge). | |||
| * TODO | |||
| */ | |||
| void registerToOscClient() noexcept; | |||
| #endif | |||
| /*! | |||
| * Handle an OSC message. | |||
| @@ -1091,7 +1091,7 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI | |||
| { | |||
| ++pData->isIdling; | |||
| } | |||
| #ifdef BUILD_BRIDGE | |||
| #if 0 //def BUILD_BRIDGE | |||
| else if (pData->oscData != nullptr) | |||
| { | |||
| switch (action) | |||
| @@ -1450,14 +1450,6 @@ EngineEvent* CarlaEngine::getInternalEventBuffer(const bool isInput) const noexc | |||
| return isInput ? pData->events.in : pData->events.out; | |||
| } | |||
| void CarlaEngine::registerEnginePlugin(const uint id, CarlaPlugin* const plugin) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(id == pData->curPluginCount,); | |||
| carla_debug("CarlaEngine::registerEnginePlugin(%i, %p)", id, plugin); | |||
| pData->plugins[id].plugin = plugin; | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Internal stuff | |||
| @@ -249,12 +249,14 @@ struct BridgeNonRtClientControl : public CarlaRingBufferControl<BigStackBuffer> | |||
| // ------------------------------------------------------------------- | |||
| struct BridgeNonRtServerControl : public CarlaRingBufferControl<HugeStackBuffer> { | |||
| CarlaMutex mutex; | |||
| CarlaString filename; | |||
| BridgeNonRtServerData* data; | |||
| char shm[64]; | |||
| BridgeNonRtServerControl() noexcept | |||
| : filename(), | |||
| : mutex(), | |||
| filename(), | |||
| data(nullptr) | |||
| { | |||
| carla_zeroChar(shm, 64); | |||
| @@ -465,6 +467,8 @@ public: | |||
| { | |||
| CarlaEngine::idle(); | |||
| // TODO - send output parameters to server | |||
| try { | |||
| handleNonRtData(); | |||
| } CARLA_SAFE_EXCEPTION("handleNonRtData"); | |||
| @@ -498,7 +502,7 @@ public: | |||
| break; | |||
| case kPluginBridgeNonRtClientPing: | |||
| oscSend_bridge_pong(); | |||
| //oscSend_bridge_pong(); | |||
| break; | |||
| case kPluginBridgeNonRtClientActivate: | |||
| @@ -656,14 +660,15 @@ public: | |||
| plugin->prepareForSave(); | |||
| for (uint32_t i=0, count=plugin->getCustomDataCount(); i<count; ++i) | |||
| //for (uint32_t i=0, count=plugin->getCustomDataCount(); i<count; ++i) | |||
| { | |||
| const CustomData& cdata(plugin->getCustomData(i)); | |||
| oscSend_bridge_set_custom_data(cdata.type, cdata.key, cdata.value); | |||
| //const CustomData& cdata(plugin->getCustomData(i)); | |||
| //oscSend_bridge_set_custom_data(cdata.type, cdata.key, cdata.value); | |||
| } | |||
| if (plugin->getOptionsEnabled() & PLUGIN_OPTION_USE_CHUNKS) | |||
| { | |||
| /* | |||
| void* data = nullptr; | |||
| if (const std::size_t dataSize = plugin->getChunkData(&data)) | |||
| { | |||
| @@ -681,6 +686,7 @@ public: | |||
| if (File(filePath).replaceWithText(dataBase64.buffer())) | |||
| oscSend_bridge_set_chunk_data_file(filePath.toRawUTF8()); | |||
| } | |||
| */ | |||
| } | |||
| //oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); | |||
| @@ -23,295 +23,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
| // ----------------------------------------------------------------------- | |||
| #ifdef BUILD_BRIDGE | |||
| void CarlaEngine::oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const uint optionsAvailable, const uint optionsEnabled, const int64_t uniqueId) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_plugin_info1(%i:%s, %X, %X, %X, " P_INT64 ")", category, PluginCategory2Str(category), hints, optionsAvailable, optionsEnabled, uniqueId); | |||
| char targetPath[std::strlen(pData->oscData->path)+21]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_plugin_info1"); | |||
| try_lo_send(pData->oscData->target, targetPath, "iiiih", static_cast<int32_t>(category), static_cast<int32_t>(hints), static_cast<int32_t>(optionsAvailable), static_cast<int32_t>(optionsEnabled), uniqueId); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(maker != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_plugin_info2(\"%s\", \"%s\", \"%s\", \"%s\")", realName, label, maker, copyright); | |||
| char targetPath[std::strlen(pData->oscData->path)+21]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_plugin_info2"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ssss", realName, label, maker, copyright); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_audio_count(%i, %i)", ins, outs); | |||
| char targetPath[std::strlen(pData->oscData->path)+20]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_audio_count"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_midi_count(%i, %i)", ins, outs); | |||
| char targetPath[std::strlen(pData->oscData->path)+19]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_midi_count"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_count(%i, %i)", ins, outs); | |||
| char targetPath[std::strlen(pData->oscData->path)+24]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_count"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_program_count(const uint32_t count) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_program_count(%i)", count); | |||
| char targetPath[std::strlen(pData->oscData->path)+23]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_program_count"); | |||
| try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_midi_program_count(const uint32_t count) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_midi_program_count(%i)", count); | |||
| char targetPath[std::strlen(pData->oscData->path)+27]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_midi_program_count"); | |||
| try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_data1(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const int16_t cc) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < 0x9F,); // FIXME | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_data1(%i, %i, %i:%s, %X, %i)", index, rindex, type, ParameterType2Str(type), hints, cc); | |||
| char targetPath[std::strlen(pData->oscData->path)+25]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_data1"); | |||
| try_lo_send(pData->oscData->target, targetPath, "iiiii", static_cast<int32_t>(index), static_cast<int32_t>(rindex), static_cast<int32_t>(type), static_cast<int32_t>(hints), static_cast<int32_t>(cc)); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_data2(const uint32_t index, const char* const name, const char* const unit) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(name != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(unit != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_data2(%i, \"%s\", \"%s\")", index, name, unit); | |||
| char targetPath[std::strlen(pData->oscData->path)+25]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_data2"); | |||
| try_lo_send(pData->oscData->target, targetPath, "iss", static_cast<int32_t>(index), name, unit); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, def, min, max); | |||
| char targetPath[std::strlen(pData->oscData->path)+26]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_ranges1"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), def, min, max); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, step, stepSmall, stepLarge); | |||
| char targetPath[std::strlen(pData->oscData->path)+26]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_ranges2"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), step, stepSmall, stepLarge); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_parameter_value(%i, %f)", index, value); | |||
| char targetPath[std::strlen(pData->oscData->path)+24]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_parameter_value"); | |||
| try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_default_value(%i, %f)", index, value); | |||
| char targetPath[std::strlen(pData->oscData->path)+22]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_default_value"); | |||
| try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_current_program(const int32_t index) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_current_program(%i)", index); | |||
| char targetPath[std::strlen(pData->oscData->path)+24]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_current_program"); | |||
| try_lo_send(pData->oscData->target, targetPath, "i", index); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_current_midi_program(const int32_t index) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_current_midi_program(%i)", index); | |||
| char targetPath[std::strlen(pData->oscData->path)+30]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_current_midi_program"); | |||
| try_lo_send(pData->oscData->target, targetPath, "i", index); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_program_name(const uint32_t index, const char* const name) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(name != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_program_name(%i, \"%s\")", index, name); | |||
| char targetPath[std::strlen(pData->oscData->path)+21]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_program_name"); | |||
| try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(index), name); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(name != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_midi_program_data(%i, %i, %i, \"%s\")", index, bank, program, name); | |||
| char targetPath[std::strlen(pData->oscData->path)+26]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_midi_program_data"); | |||
| try_lo_send(pData->oscData->target, targetPath, "iiis", static_cast<int32_t>(index), static_cast<int32_t>(bank), static_cast<int32_t>(program), name); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_configure(\"%s\", \"%s\")", key, value); | |||
| char targetPath[std::strlen(pData->oscData->path)+18]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_configure"); | |||
| try_lo_send(pData->oscData->target, targetPath, "ss", key, value); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||
| carla_debug("CarlaEngine::oscSend_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value); | |||
| char targetPath[std::strlen(pData->oscData->path)+24]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_set_custom_data"); | |||
| try_lo_send(pData->oscData->target, targetPath, "sss", type, key, value); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_set_chunk_data_file(const char* const chunkDataFile) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(chunkDataFile != nullptr && chunkDataFile[0] != '\0',); | |||
| carla_debug("CarlaEngine::oscSend_bridge_set_chunk_data_file(\"%s\")", chunkDataFile); | |||
| char targetPath[std::strlen(pData->oscData->path)+28]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_set_chunk_data_file"); | |||
| try_lo_send(pData->oscData->target, targetPath, "s", chunkDataFile); | |||
| } | |||
| void CarlaEngine::oscSend_bridge_pong() const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,); | |||
| //carla_debug("CarlaEngine::oscSend_pong()"); | |||
| char targetPath[std::strlen(pData->oscData->path)+13]; | |||
| std::strcpy(targetPath, pData->oscData->path); | |||
| std::strcat(targetPath, "/bridge_pong"); | |||
| try_lo_send(pData->oscData->target, targetPath, ""); | |||
| } | |||
| #else // BUILD_BRIDGE | |||
| #ifndef BUILD_BRIDGE | |||
| void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
| @@ -93,7 +93,7 @@ void CarlaEngineThread::run() noexcept | |||
| if (oscRegisted) | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| kEngine->oscSend_bridge_parameter_value(j, value); | |||
| //kEngine->oscSend_bridge_parameter_value(j, value); | |||
| #else | |||
| kEngine->oscSend_control_set_parameter_value(i, static_cast<int32_t>(j), value); | |||
| #endif | |||
| @@ -1428,19 +1428,13 @@ void CarlaPlugin::clearBuffers() noexcept | |||
| // ------------------------------------------------------------------- | |||
| // OSC stuff | |||
| #ifndef BUILD_BRIDGE | |||
| void CarlaPlugin::registerToOscClient() noexcept | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| return; | |||
| #else | |||
| if (! pData->engine->isOscControlRegistered()) | |||
| #endif | |||
| return; | |||
| #ifndef BUILD_BRIDGE | |||
| pData->engine->oscSend_control_add_plugin_start(pData->id, pData->name); | |||
| #endif | |||
| // Base data | |||
| { | |||
| @@ -1454,13 +1448,8 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| getMaker(bufMaker); | |||
| getCopyright(bufCopyright); | |||
| #ifdef BUILD_BRIDGE | |||
| pData->engine->oscSend_bridge_plugin_info1(getCategory(), pData->hints, getOptionsAvailable(), pData->options, getUniqueId()); | |||
| pData->engine->oscSend_bridge_plugin_info2(bufName, bufLabel, bufMaker, bufCopyright); | |||
| #else | |||
| pData->engine->oscSend_control_set_plugin_info1(pData->id, getType(), getCategory(), pData->hints, getUniqueId()); | |||
| pData->engine->oscSend_control_set_plugin_info2(pData->id, bufName, bufLabel, bufMaker, bufCopyright); | |||
| #endif | |||
| } | |||
| // Base count | |||
| @@ -1468,15 +1457,9 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| uint32_t paramIns, paramOuts; | |||
| getParameterCountInfo(paramIns, paramOuts); | |||
| #ifdef BUILD_BRIDGE | |||
| pData->engine->oscSend_bridge_audio_count(getAudioInCount(), getAudioOutCount()); | |||
| pData->engine->oscSend_bridge_midi_count(getMidiInCount(), getMidiOutCount()); | |||
| pData->engine->oscSend_bridge_parameter_count(paramIns, paramOuts); | |||
| #else | |||
| pData->engine->oscSend_control_set_audio_count(pData->id, getAudioInCount(), getAudioOutCount()); | |||
| pData->engine->oscSend_control_set_midi_count(pData->id, getMidiInCount(), getMidiOutCount()); | |||
| pData->engine->oscSend_control_set_parameter_count(pData->id, paramIns, paramOuts); | |||
| #endif | |||
| } | |||
| // Plugin Parameters | |||
| @@ -1495,58 +1478,29 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| const ParameterData& paramData(pData->param.data[i]); | |||
| const ParameterRanges& paramRanges(pData->param.ranges[i]); | |||
| #ifdef BUILD_BRIDGE | |||
| pData->engine->oscSend_bridge_parameter_data1(i, paramData.rindex, paramData.type, paramData.hints, paramData.midiCC); | |||
| pData->engine->oscSend_bridge_parameter_data2(i, bufName, bufUnit); | |||
| pData->engine->oscSend_bridge_parameter_ranges1(i, paramRanges.def, paramRanges.min, paramRanges.max); | |||
| pData->engine->oscSend_bridge_parameter_ranges2(i, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | |||
| pData->engine->oscSend_bridge_parameter_value(i, getParameterValue(i)); | |||
| #else | |||
| pData->engine->oscSend_control_set_parameter_data(pData->id, i, paramData.type, paramData.hints, bufName, bufUnit); | |||
| pData->engine->oscSend_control_set_parameter_ranges1(pData->id, i, paramRanges.def, paramRanges.min, paramRanges.max); | |||
| pData->engine->oscSend_control_set_parameter_ranges2(pData->id, i, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(i), getParameterValue(i)); | |||
| pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, i, paramData.midiCC); | |||
| pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, i, paramData.midiChannel); | |||
| #endif | |||
| } | |||
| } | |||
| // Programs | |||
| if (pData->prog.count > 0) | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| pData->engine->oscSend_bridge_program_count(pData->prog.count); | |||
| for (uint32_t i=0; i < pData->prog.count; ++i) | |||
| pData->engine->oscSend_bridge_program_name(i, pData->prog.names[i]); | |||
| pData->engine->oscSend_bridge_current_program(pData->prog.current); | |||
| #else | |||
| pData->engine->oscSend_control_set_program_count(pData->id, pData->prog.count); | |||
| for (uint32_t i=0; i < pData->prog.count; ++i) | |||
| pData->engine->oscSend_control_set_program_name(pData->id, i, pData->prog.names[i]); | |||
| pData->engine->oscSend_control_set_current_program(pData->id, pData->prog.current); | |||
| #endif | |||
| } | |||
| // MIDI Programs | |||
| if (pData->midiprog.count > 0) | |||
| { | |||
| #ifdef BUILD_BRIDGE | |||
| pData->engine->oscSend_bridge_midi_program_count(pData->midiprog.count); | |||
| for (uint32_t i=0; i < pData->midiprog.count; ++i) | |||
| { | |||
| const MidiProgramData& mpData(pData->midiprog.data[i]); | |||
| pData->engine->oscSend_bridge_midi_program_data(i, mpData.bank, mpData.program, mpData.name); | |||
| } | |||
| pData->engine->oscSend_bridge_current_midi_program(pData->midiprog.current); | |||
| #else | |||
| pData->engine->oscSend_control_set_midi_program_count(pData->id, pData->midiprog.count); | |||
| for (uint32_t i=0; i < pData->midiprog.count; ++i) | |||
| @@ -1557,10 +1511,8 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| } | |||
| pData->engine->oscSend_control_set_current_midi_program(pData->id, pData->midiprog.current); | |||
| #endif | |||
| } | |||
| #ifndef BUILD_BRIDGE | |||
| pData->engine->oscSend_control_add_plugin_end(pData->id); | |||
| // Internal Parameters | |||
| @@ -1573,8 +1525,8 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_CTRL_CHANNEL, pData->ctrlChannel); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, pData->active ? 1.0f : 0.0f); | |||
| } | |||
| #endif | |||
| } | |||
| #endif // BUILD_BRIDGE | |||
| void CarlaPlugin::handleOscMessage(const char* const, const int, const void* const, const char* const, const lo_message) | |||
| { | |||
| @@ -869,6 +869,10 @@ public: | |||
| fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientPing); | |||
| fShmNonRtClientControl.commitWrite(); | |||
| try { | |||
| handleNonRtData(); | |||
| } CARLA_SAFE_EXCEPTION("handleNonRtData"); | |||
| } | |||
| else | |||
| carla_stderr2("TESTING: Bridge has closed!"); | |||
| @@ -903,6 +907,16 @@ public: | |||
| needsCtrlIn = true; | |||
| } | |||
| if (fInfo.cvIns > 0) | |||
| { | |||
| pData->cvIn.createNew(fInfo.cvIns); | |||
| } | |||
| if (fInfo.cvOuts > 0) | |||
| { | |||
| pData->cvOut.createNew(fInfo.cvOuts); | |||
| } | |||
| if (fInfo.mIns > 0) | |||
| needsCtrlIn = true; | |||
| @@ -960,6 +974,8 @@ public: | |||
| pData->audioOut.ports[j].rindex = j; | |||
| } | |||
| // TODO - CV | |||
| if (needsCtrlIn) | |||
| { | |||
| portName.clear(); | |||
| @@ -1026,7 +1042,7 @@ public: | |||
| try { | |||
| timedOut = waitForClient(1); | |||
| } catch(...) {} | |||
| } CARLA_SAFE_EXCEPTION("activate - waitForClient"); | |||
| if (! timedOut) | |||
| fTimedOut = false; | |||
| @@ -1045,7 +1061,7 @@ public: | |||
| try { | |||
| timedOut = waitForClient(1); | |||
| } catch(...) {} | |||
| } CARLA_SAFE_EXCEPTION("deactivate - waitForClient"); | |||
| if (! timedOut) | |||
| fTimedOut = false; | |||
| @@ -1452,7 +1468,7 @@ public: | |||
| void bufferSizeChanged(const uint32_t newBufferSize) override | |||
| { | |||
| resizeAudioAndCVPool(newBufferSize); | |||
| resizeAudioPool(newBufferSize); | |||
| { | |||
| const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | |||
| @@ -1568,461 +1584,413 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| #if 0 | |||
| int setOscPluginBridgeInfo(const PluginBridgeOscInfoType infoType, const int argc, const lo_arg* const* const argv, const char* const types) | |||
| void handleNonRtData() | |||
| { | |||
| for (; fShmNonRtServerControl.isDataAvailableForReading();) | |||
| { | |||
| const PluginBridgeNonRtServerOpcode opcode(fShmNonRtServerControl.readOpcode()); | |||
| #ifdef DEBUG | |||
| if (infoType != kPluginBridgeOscPong) { | |||
| carla_debug("CarlaPluginBridge::setOscPluginBridgeInfo(%s, %i, %p, \"%s\")", PluginBridgeOscInfoType2str(infoType), argc, argv, types); | |||
| } | |||
| if (opcode != kPluginBridgeNonRtServerPong) { | |||
| carla_debug("CarlaPluginBridge::handleNonRtData() - got opcode: %s", PluginBridgeNonRtServerOpcode2str(opcode)); | |||
| } | |||
| #endif | |||
| switch (infoType) | |||
| { | |||
| case kPluginBridgeOscNull: | |||
| break; | |||
| case kPluginBridgeOscPong: | |||
| if (fLastPongCounter > 0) | |||
| fLastPongCounter = 0; | |||
| break; | |||
| case kPluginBridgeOscPluginInfo1: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(5, "iiiih"); | |||
| const int32_t category = argv[0]->i; | |||
| const int32_t hints = argv[1]->i; | |||
| const int32_t optionAv = argv[2]->i; | |||
| const int32_t optionEn = argv[3]->i; | |||
| const int64_t uniqueId = argv[4]->h; | |||
| CARLA_SAFE_ASSERT_BREAK(category >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(hints >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(optionAv >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(optionEn >= 0); | |||
| pData->hints = static_cast<uint>(hints); | |||
| pData->hints |= PLUGIN_IS_BRIDGE; | |||
| pData->options = static_cast<uint>(optionEn); | |||
| fInfo.category = static_cast<PluginCategory>(category); | |||
| fInfo.uniqueId = uniqueId; | |||
| fInfo.optionsAvailable = static_cast<uint>(optionAv); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscPluginInfo2: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(4, "ssss"); | |||
| const char* const realName = (const char*)&argv[0]->s; | |||
| const char* const label = (const char*)&argv[1]->s; | |||
| const char* const maker = (const char*)&argv[2]->s; | |||
| const char* const copyright = (const char*)&argv[3]->s; | |||
| CARLA_SAFE_ASSERT_BREAK(realName != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(label != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(maker != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(copyright != nullptr); | |||
| fInfo.name = realName; | |||
| fInfo.label = label; | |||
| fInfo.maker = maker; | |||
| fInfo.copyright = copyright; | |||
| if (pData->name == nullptr) | |||
| pData->name = pData->engine->getUniquePluginName(realName); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscAudioCount: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ii"); | |||
| const int32_t ins = argv[0]->i; | |||
| const int32_t outs = argv[1]->i; | |||
| CARLA_SAFE_ASSERT_BREAK(ins >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(outs >= 0); | |||
| fInfo.aIns = static_cast<uint32_t>(ins); | |||
| fInfo.aOuts = static_cast<uint32_t>(outs); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscMidiCount: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ii"); | |||
| const int32_t ins = argv[0]->i; | |||
| const int32_t outs = argv[1]->i; | |||
| CARLA_SAFE_ASSERT_BREAK(ins >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(outs >= 0); | |||
| fInfo.mIns = static_cast<uint32_t>(ins); | |||
| fInfo.mOuts = static_cast<uint32_t>(outs); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscParameterCount: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ii"); | |||
| const int32_t ins = argv[0]->i; | |||
| const int32_t outs = argv[1]->i; | |||
| CARLA_SAFE_ASSERT_BREAK(ins >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(outs >= 0); | |||
| // delete old data | |||
| pData->param.clear(); | |||
| if (fParams != nullptr) | |||
| switch (opcode) | |||
| { | |||
| delete[] fParams; | |||
| fParams = nullptr; | |||
| } | |||
| case kPluginBridgeNonRtServerNull: | |||
| break; | |||
| if (int32_t count = ins+outs) | |||
| { | |||
| const int32_t maxParams(static_cast<int32_t>(pData->engine->getOptions().maxParameters)); | |||
| case kPluginBridgeNonRtServerPong: | |||
| if (fLastPongCounter > 0) | |||
| fLastPongCounter = 0; | |||
| break; | |||
| if (count > maxParams) | |||
| case kPluginBridgeNonRtServerPluginInfo1: { | |||
| // uint/category, uint/hints, uint/optionsAvailable, uint/optionsEnabled, long/uniqueId | |||
| const uint32_t category = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t hints = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t optionAv = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t optionEn = fShmNonRtServerControl.readUInt(); | |||
| const int64_t uniqueId = fShmNonRtServerControl.readLong(); | |||
| pData->hints = hints | PLUGIN_IS_BRIDGE; | |||
| pData->options = optionEn; | |||
| fInfo.category = static_cast<PluginCategory>(category); | |||
| fInfo.uniqueId = uniqueId; | |||
| fInfo.optionsAvailable = optionAv; | |||
| } break; | |||
| case kPluginBridgeNonRtServerPluginInfo2: { | |||
| // uint/size, str[] (realName), uint/size, str[] (label), uint/size, str[] (maker), uint/size, str[] (copyright) | |||
| // realName | |||
| const uint32_t realNameSize(fShmNonRtServerControl.readUInt()); | |||
| char realName[realNameSize+1]; | |||
| carla_zeroChar(realName, realNameSize+1); | |||
| fShmNonRtServerControl.readCustomData(realName, realNameSize); | |||
| // label | |||
| const uint32_t labelSize(fShmNonRtServerControl.readUInt()); | |||
| char label[labelSize+1]; | |||
| carla_zeroChar(label, labelSize+1); | |||
| fShmNonRtServerControl.readCustomData(label, labelSize); | |||
| // maker | |||
| const uint32_t makerSize(fShmNonRtServerControl.readUInt()); | |||
| char maker[makerSize+1]; | |||
| carla_zeroChar(maker, makerSize+1); | |||
| fShmNonRtServerControl.readCustomData(maker, makerSize); | |||
| // copyright | |||
| const uint32_t copyrightSize(fShmNonRtServerControl.readUInt()); | |||
| char copyright[copyrightSize+1]; | |||
| carla_zeroChar(copyright, copyrightSize+1); | |||
| fShmNonRtServerControl.readCustomData(copyright, copyrightSize); | |||
| fInfo.name = realName; | |||
| fInfo.label = label; | |||
| fInfo.maker = maker; | |||
| fInfo.copyright = copyright; | |||
| if (pData->name == nullptr) | |||
| pData->name = pData->engine->getUniquePluginName(realName); | |||
| } break; | |||
| case kPluginBridgeNonRtServerAudioCount: { | |||
| // uint/ins, uint/outs | |||
| fInfo.aIns = fShmNonRtServerControl.readUInt(); | |||
| fInfo.aOuts = fShmNonRtServerControl.readUInt(); | |||
| } break; | |||
| case kPluginBridgeNonRtServerMidiCount: { | |||
| // uint/ins, uint/outs | |||
| fInfo.mIns = fShmNonRtServerControl.readUInt(); | |||
| fInfo.mOuts = fShmNonRtServerControl.readUInt(); | |||
| } break; | |||
| case kPluginBridgeNonRtServerParameterCount: { | |||
| // uint/ins, uint/outs | |||
| const uint32_t ins = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t outs = fShmNonRtServerControl.readUInt(); | |||
| // delete old data | |||
| pData->param.clear(); | |||
| if (fParams != nullptr) | |||
| { | |||
| // this is expected right now, to be handled better later | |||
| //carla_safe_assert_int2("count <= pData->engine->getOptions().maxParameters", __FILE__, __LINE__, count, maxParams); | |||
| count = maxParams; | |||
| delete[] fParams; | |||
| fParams = nullptr; | |||
| } | |||
| const uint32_t ucount(static_cast<uint32_t>(count)); | |||
| pData->param.createNew(ucount, false); | |||
| fParams = new BridgeParamInfo[ucount]; | |||
| } | |||
| break; | |||
| } | |||
| case kPluginBridgeOscProgramCount: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||
| const int32_t count = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_BREAK(count >= 0); | |||
| pData->prog.clear(); | |||
| if (count > 0) | |||
| pData->prog.createNew(static_cast<uint32_t>(count)); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscMidiProgramCount: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||
| const int32_t count = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_BREAK(count >= 0); | |||
| pData->midiprog.clear(); | |||
| if (count > 0) | |||
| pData->midiprog.createNew(static_cast<uint32_t>(count)); | |||
| break; | |||
| } | |||
| case kPluginBridgeOscParameterData1: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(5, "iiiii"); | |||
| const int32_t index = argv[0]->i; | |||
| const int32_t rindex = argv[1]->i; | |||
| const int32_t type = argv[2]->i; | |||
| const int32_t hints = argv[3]->i; | |||
| const int32_t midiCC = argv[4]->i; | |||
| if (uint32_t count = ins+outs) | |||
| { | |||
| const uint32_t maxParams(pData->engine->getOptions().maxParameters); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(rindex >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(type >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(hints >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(midiCC >= -1 && midiCC < MAX_MIDI_CONTROL); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| if (count > maxParams) | |||
| { | |||
| // this is expected right now, to be handled better later | |||
| //carla_safe_assert_int2("count <= pData->engine->getOptions().maxParameters", __FILE__, __LINE__, count, maxParams); | |||
| count = maxParams; | |||
| } | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| { | |||
| pData->param.data[index].type = static_cast<ParameterType>(type); | |||
| pData->param.data[index].index = index; | |||
| pData->param.data[index].rindex = rindex; | |||
| pData->param.data[index].hints = static_cast<uint>(hints); | |||
| pData->param.data[index].midiCC = static_cast<int16_t>(midiCC); | |||
| } | |||
| break; | |||
| } | |||
| pData->param.createNew(count, false); | |||
| fParams = new BridgeParamInfo[count]; | |||
| } | |||
| } break; | |||
| case kPluginBridgeOscParameterData2: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iss"); | |||
| case kPluginBridgeNonRtServerProgramCount: { | |||
| // uint/count | |||
| pData->prog.clear(); | |||
| const int32_t index = argv[0]->i; | |||
| const char* const name = (const char*)&argv[1]->s; | |||
| const char* const unit = (const char*)&argv[2]->s; | |||
| if (const uint32_t count = fShmNonRtServerControl.readUInt()) | |||
| pData->prog.createNew(static_cast<uint32_t>(count)); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(name != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(unit != nullptr); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| } break; | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| { | |||
| fParams[index].name = name; | |||
| fParams[index].unit = unit; | |||
| } | |||
| break; | |||
| } | |||
| case kPluginBridgeNonRtServerMidiProgramCount: { | |||
| // uint/count | |||
| pData->midiprog.clear(); | |||
| case kPluginBridgeOscParameterRanges1: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(4, "ifff"); | |||
| if (const uint32_t count = fShmNonRtServerControl.readUInt()) | |||
| pData->midiprog.createNew(static_cast<uint32_t>(count)); | |||
| const int32_t index = argv[0]->i; | |||
| const float def = argv[1]->f; | |||
| const float min = argv[2]->f; | |||
| const float max = argv[3]->f; | |||
| } break; | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(min < max); | |||
| CARLA_SAFE_ASSERT_BREAK(def >= min); | |||
| CARLA_SAFE_ASSERT_BREAK(def <= max); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| case kPluginBridgeNonRtServerParameterData1: { | |||
| // uint/index, int/rindex, uint/type, uint/hints, int/cc | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const int32_t rindex = fShmNonRtServerControl.readInt(); | |||
| const uint32_t type = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t hints = fShmNonRtServerControl.readUInt(); | |||
| const int16_t midiCC = fShmNonRtServerControl.readShort(); | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| { | |||
| pData->param.ranges[index].def = def; | |||
| pData->param.ranges[index].min = min; | |||
| pData->param.ranges[index].max = max; | |||
| } | |||
| break; | |||
| } | |||
| CARLA_SAFE_ASSERT_BREAK(midiCC >= -1 && midiCC < MAX_MIDI_CONTROL); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| case kPluginBridgeOscParameterRanges2: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(4, "ifff"); | |||
| if (index < pData->param.count) | |||
| { | |||
| pData->param.data[index].type = static_cast<ParameterType>(type); | |||
| pData->param.data[index].index = static_cast<int32_t>(index); | |||
| pData->param.data[index].rindex = rindex; | |||
| pData->param.data[index].hints = hints; | |||
| pData->param.data[index].midiCC = midiCC; | |||
| } | |||
| } break; | |||
| const int32_t index = argv[0]->i; | |||
| const float step = argv[1]->f; | |||
| const float stepSmall = argv[2]->f; | |||
| const float stepLarge = argv[3]->f; | |||
| case kPluginBridgeNonRtServerParameterData2: { | |||
| // uint/index, uint/size, str[] (name), uint/size, str[] (unit) | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| // name | |||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | |||
| char name[nameSize+1]; | |||
| carla_zeroChar(name, nameSize+1); | |||
| fShmNonRtServerControl.readCustomData(name, nameSize); | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| { | |||
| pData->param.ranges[index].step = step; | |||
| pData->param.ranges[index].stepSmall = stepSmall; | |||
| pData->param.ranges[index].stepLarge = stepLarge; | |||
| } | |||
| break; | |||
| } | |||
| // unit | |||
| const uint32_t unitSize(fShmNonRtServerControl.readUInt()); | |||
| char unit[unitSize+1]; | |||
| carla_zeroChar(unit, unitSize+1); | |||
| fShmNonRtServerControl.readCustomData(unit, unitSize); | |||
| case kPluginBridgeOscParameterValue: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "if"); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| const int32_t index = argv[0]->i; | |||
| const float value = argv[1]->f; | |||
| if (index < pData->param.count) | |||
| { | |||
| fParams[index].name = name; | |||
| fParams[index].unit = unit; | |||
| } | |||
| } break; | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| case kPluginBridgeNonRtServerParameterRanges1: { | |||
| // uint/index, float/def, float/min, float/max | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const float def = fShmNonRtServerControl.readFloat(); | |||
| const float min = fShmNonRtServerControl.readFloat(); | |||
| const float max = fShmNonRtServerControl.readFloat(); | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| { | |||
| const uint32_t uindex(static_cast<uint32_t>(index)); | |||
| const float fixedValue(pData->param.getFixedValue(uindex, value)); | |||
| fParams[uindex].value = fixedValue; | |||
| CARLA_SAFE_ASSERT_BREAK(min < max); | |||
| CARLA_SAFE_ASSERT_BREAK(def >= min); | |||
| CARLA_SAFE_ASSERT_BREAK(def <= max); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| CarlaPlugin::setParameterValue(uindex, fixedValue, false, true, true); | |||
| } | |||
| break; | |||
| } | |||
| if (index < pData->param.count) | |||
| { | |||
| pData->param.ranges[index].def = def; | |||
| pData->param.ranges[index].min = min; | |||
| pData->param.ranges[index].max = max; | |||
| } | |||
| } break; | |||
| case kPluginBridgeOscDefaultValue: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "if"); | |||
| case kPluginBridgeNonRtServerParameterRanges2: { | |||
| // uint/index float/step, float/stepSmall, float/stepLarge | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const float step = fShmNonRtServerControl.readFloat(); | |||
| const float stepSmall = fShmNonRtServerControl.readFloat(); | |||
| const float stepLarge = fShmNonRtServerControl.readFloat(); | |||
| const int32_t index = argv[0]->i; | |||
| const float value = argv[1]->f; | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count); | |||
| if (index < pData->param.count) | |||
| { | |||
| pData->param.ranges[index].step = step; | |||
| pData->param.ranges[index].stepSmall = stepSmall; | |||
| pData->param.ranges[index].stepLarge = stepLarge; | |||
| } | |||
| } break; | |||
| if (index < static_cast<int32_t>(pData->param.count)) | |||
| pData->param.ranges[index].def = value; | |||
| break; | |||
| } | |||
| case kPluginBridgeNonRtServerParameterValue: { | |||
| // uint/index float/value | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const float value = fShmNonRtServerControl.readFloat(); | |||
| case kPluginBridgeOscCurrentProgram: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| const int32_t index = argv[0]->i; | |||
| if (index < pData->param.count) | |||
| { | |||
| const float fixedValue(pData->param.getFixedValue(index, value)); | |||
| fParams[index].value = fixedValue; | |||
| CARLA_SAFE_ASSERT_BREAK(index >= -1); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->prog.count), index, pData->prog.count); | |||
| CarlaPlugin::setParameterValue(index, fixedValue, false, true, true); | |||
| } | |||
| } break; | |||
| CarlaPlugin::setProgram(index, false, true, true); | |||
| break; | |||
| } | |||
| case kPluginBridgeNonRtServerDefaultValue: { | |||
| // uint/index float/value | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const float value = fShmNonRtServerControl.readFloat(); | |||
| case kPluginBridgeOscCurrentMidiProgram: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | |||
| const int32_t index = argv[0]->i; | |||
| if (index < pData->param.count) | |||
| pData->param.ranges[index].def = value; | |||
| } break; | |||
| CARLA_SAFE_ASSERT_BREAK(index >= -1); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->midiprog.count), index, pData->midiprog.count); | |||
| case kPluginBridgeNonRtServerCurrentProgram: { | |||
| // int/index | |||
| const int32_t index = fShmNonRtServerControl.readInt(); | |||
| CarlaPlugin::setMidiProgram(index, false, true, true); | |||
| break; | |||
| } | |||
| CARLA_SAFE_ASSERT_BREAK(index >= -1); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->prog.count), index, pData->prog.count); | |||
| case kPluginBridgeOscProgramName: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "is"); | |||
| CarlaPlugin::setProgram(index, false, true, true); | |||
| } break; | |||
| const int32_t index = argv[0]->i; | |||
| const char* const name = (const char*)&argv[1]->s; | |||
| case kPluginBridgeNonRtServerCurrentMidiProgram: { | |||
| // int/index | |||
| const int32_t index = fShmNonRtServerControl.readInt(); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(name != nullptr); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->prog.count), index, pData->prog.count); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= -1); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->midiprog.count), index, pData->midiprog.count); | |||
| if (index < static_cast<int32_t>(pData->prog.count)) | |||
| { | |||
| if (pData->prog.names[index] != nullptr) | |||
| delete[] pData->prog.names[index]; | |||
| pData->prog.names[index] = carla_strdup(name); | |||
| } | |||
| break; | |||
| } | |||
| CarlaPlugin::setMidiProgram(index, false, true, true); | |||
| } break; | |||
| case kPluginBridgeOscMidiProgramData: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(4, "iiis"); | |||
| case kPluginBridgeNonRtServerProgramName: { | |||
| // uint/index, uint/size, str[] (name) | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const int32_t index = argv[0]->i; | |||
| const int32_t bank = argv[1]->i; | |||
| const int32_t program = argv[2]->i; | |||
| const char* const name = (const char*)&argv[3]->s; | |||
| // name | |||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | |||
| char name[nameSize+1]; | |||
| carla_zeroChar(name, nameSize+1); | |||
| fShmNonRtServerControl.readCustomData(name, nameSize); | |||
| CARLA_SAFE_ASSERT_BREAK(index >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(bank >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(program >= 0); | |||
| CARLA_SAFE_ASSERT_BREAK(name != nullptr); | |||
| CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->midiprog.count), index, pData->midiprog.count); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->prog.count, index, pData->prog.count); | |||
| if (index < static_cast<int32_t>(pData->midiprog.count)) | |||
| { | |||
| if (pData->midiprog.data[index].name != nullptr) | |||
| delete[] pData->midiprog.data[index].name; | |||
| pData->midiprog.data[index].bank = static_cast<uint32_t>(bank); | |||
| pData->midiprog.data[index].program = static_cast<uint32_t>(program); | |||
| pData->midiprog.data[index].name = carla_strdup(name); | |||
| } | |||
| break; | |||
| } | |||
| if (index < pData->prog.count) | |||
| { | |||
| if (pData->prog.names[index] != nullptr) | |||
| delete[] pData->prog.names[index]; | |||
| pData->prog.names[index] = carla_strdup(name); | |||
| } | |||
| } break; | |||
| case kPluginBridgeOscConfigure: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ss"); | |||
| case kPluginBridgeNonRtServerMidiProgramData: { | |||
| // uint/index, uint/bank, uint/program, uint/size, str[] (name) | |||
| const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t bank = fShmNonRtServerControl.readUInt(); | |||
| const uint32_t program = fShmNonRtServerControl.readUInt(); | |||
| const char* const key = (const char*)&argv[0]->s; | |||
| const char* const value = (const char*)&argv[1]->s; | |||
| // name | |||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | |||
| char name[nameSize+1]; | |||
| carla_zeroChar(name, nameSize+1); | |||
| fShmNonRtServerControl.readCustomData(name, nameSize); | |||
| CARLA_SAFE_ASSERT_BREAK(key != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(value != nullptr); | |||
| CARLA_SAFE_ASSERT_INT2(index < pData->midiprog.count, index, pData->midiprog.count); | |||
| if (std::strcmp(key, CARLA_BRIDGE_MSG_HIDE_GUI) == 0) | |||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
| else if (std::strcmp(key, CARLA_BRIDGE_MSG_SAVED) == 0) | |||
| fSaved = true; | |||
| break; | |||
| } | |||
| if (index < pData->midiprog.count) | |||
| { | |||
| if (pData->midiprog.data[index].name != nullptr) | |||
| delete[] pData->midiprog.data[index].name; | |||
| pData->midiprog.data[index].bank = bank; | |||
| pData->midiprog.data[index].program = program; | |||
| pData->midiprog.data[index].name = carla_strdup(name); | |||
| } | |||
| } break; | |||
| case kPluginBridgeOscSetCustomData: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "sss"); | |||
| case kPluginBridgeNonRtServerSetCustomData: { | |||
| // uint/size, str[], uint/size, str[], uint/size, str[] (compressed) | |||
| const char* const type = (const char*)&argv[0]->s; | |||
| const char* const key = (const char*)&argv[1]->s; | |||
| const char* const value = (const char*)&argv[2]->s; | |||
| // type | |||
| const uint32_t typeSize(fShmNonRtServerControl.readUInt()); | |||
| char type[typeSize+1]; | |||
| carla_zeroChar(type, typeSize+1); | |||
| fShmNonRtServerControl.readCustomData(type, typeSize); | |||
| CARLA_SAFE_ASSERT_BREAK(type != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(key != nullptr); | |||
| CARLA_SAFE_ASSERT_BREAK(value != nullptr); | |||
| // key | |||
| const uint32_t keySize(fShmNonRtServerControl.readUInt()); | |||
| char key[keySize+1]; | |||
| carla_zeroChar(key, keySize+1); | |||
| fShmNonRtServerControl.readCustomData(key, keySize); | |||
| CarlaPlugin::setCustomData(type, key, value, false); | |||
| break; | |||
| } | |||
| // value | |||
| const uint32_t valueSize(fShmNonRtServerControl.readUInt()); | |||
| char value[valueSize+1]; | |||
| carla_zeroChar(value, valueSize+1); | |||
| fShmNonRtServerControl.readCustomData(value, valueSize); | |||
| case kPluginBridgeOscSetChunkDataFile: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "s"); | |||
| CarlaPlugin::setCustomData(type, key, value, false); | |||
| } break; | |||
| const char* const chunkFilePath = (const char*)&argv[0]->s; | |||
| case kPluginBridgeNonRtServerSetChunkDataFile: { | |||
| // uint/size, str[] (filename) | |||
| CARLA_SAFE_ASSERT_BREAK(chunkFilePath != nullptr); | |||
| // chunkFilePath | |||
| const uint32_t chunkFilePathSize(fShmNonRtServerControl.readUInt()); | |||
| char chunkFilePath[chunkFilePathSize+1]; | |||
| carla_zeroChar(chunkFilePath, chunkFilePathSize+1); | |||
| fShmNonRtServerControl.readCustomData(chunkFilePath, chunkFilePathSize); | |||
| String realChunkFilePath(chunkFilePath); | |||
| carla_stdout("chunk save path BEFORE => %s", realChunkFilePath.toRawUTF8()); | |||
| String realChunkFilePath(chunkFilePath); | |||
| carla_stdout("chunk save path BEFORE => %s", realChunkFilePath.toRawUTF8()); | |||
| #ifndef CARLA_OS_WIN | |||
| // Using Wine, fix temp dir | |||
| if (fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64) | |||
| { | |||
| // Get WINEPREFIX | |||
| String wineDir; | |||
| if (const char* const WINEPREFIX = getenv("WINEPREFIX")) | |||
| wineDir = String(WINEPREFIX); | |||
| else | |||
| wineDir = File::getSpecialLocation(File::userHomeDirectory).getFullPathName() + "/.wine"; | |||
| const StringArray driveLetterSplit(StringArray::fromTokens(realChunkFilePath, ":/", "")); | |||
| realChunkFilePath = wineDir; | |||
| realChunkFilePath += "/drive_"; | |||
| realChunkFilePath += driveLetterSplit[0].toLowerCase(); | |||
| realChunkFilePath += "/"; | |||
| realChunkFilePath += driveLetterSplit[1]; | |||
| realChunkFilePath = realChunkFilePath.replace("\\", "/"); | |||
| carla_stdout("chunk save path AFTER => %s", realChunkFilePath.toRawUTF8()); | |||
| } | |||
| // Using Wine, fix temp dir | |||
| if (fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64) | |||
| { | |||
| // Get WINEPREFIX | |||
| String wineDir; | |||
| if (const char* const WINEPREFIX = getenv("WINEPREFIX")) | |||
| wineDir = String(WINEPREFIX); | |||
| else | |||
| wineDir = File::getSpecialLocation(File::userHomeDirectory).getFullPathName() + "/.wine"; | |||
| const StringArray driveLetterSplit(StringArray::fromTokens(realChunkFilePath, ":/", "")); | |||
| realChunkFilePath = wineDir; | |||
| realChunkFilePath += "/drive_"; | |||
| realChunkFilePath += driveLetterSplit[0].toLowerCase(); | |||
| realChunkFilePath += "/"; | |||
| realChunkFilePath += driveLetterSplit[1]; | |||
| realChunkFilePath = realChunkFilePath.replace("\\", "/"); | |||
| carla_stdout("chunk save path AFTER => %s", realChunkFilePath.toRawUTF8()); | |||
| } | |||
| #endif | |||
| File chunkFile(realChunkFilePath); | |||
| File chunkFile(realChunkFilePath); | |||
| if (chunkFile.existsAsFile()) | |||
| { | |||
| fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); | |||
| chunkFile.deleteFile(); | |||
| carla_stderr("chunk data final"); | |||
| } | |||
| break; | |||
| } | |||
| if (chunkFile.existsAsFile()) | |||
| { | |||
| fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); | |||
| chunkFile.deleteFile(); | |||
| carla_stderr("chunk data final"); | |||
| } | |||
| } break; | |||
| case kPluginBridgeOscLatency: | |||
| // TODO | |||
| break; | |||
| case kPluginBridgeNonRtServerSetLatency: { | |||
| // uint | |||
| } break; | |||
| case kPluginBridgeOscReady: | |||
| fInitiated = true; | |||
| break; | |||
| case kPluginBridgeNonRtServerReady: | |||
| fInitiated = true; | |||
| break; | |||
| case kPluginBridgeOscError: { | |||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "s"); | |||
| case kPluginBridgeNonRtServerSaved: | |||
| fSaved = true; | |||
| break; | |||
| const char* const error = (const char*)&argv[0]->s; | |||
| case kPluginBridgeNonRtServerUiClosed: | |||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
| break; | |||
| CARLA_ASSERT(error != nullptr); | |||
| case kPluginBridgeNonRtServerError: { | |||
| // error | |||
| const uint32_t errorSize(fShmNonRtServerControl.readUInt()); | |||
| char error[errorSize+1]; | |||
| carla_zeroChar(error, errorSize+1); | |||
| fShmNonRtServerControl.readCustomData(error, errorSize); | |||
| pData->engine->setLastError(error); | |||
| pData->engine->setLastError(error); | |||
| fInitError = true; | |||
| fInitiated = true; | |||
| break; | |||
| } | |||
| fInitError = true; | |||
| fInitiated = true; | |||
| } break; | |||
| } | |||
| } | |||
| return 0; | |||
| } | |||
| #endif | |||
| // ------------------------------------------------------------------- | |||
| @@ -2179,19 +2147,15 @@ public: | |||
| fShmNonRtClientControl.commitWrite(); | |||
| // register plugin now so we can receive OSC (and wait for it) | |||
| pData->hints |= PLUGIN_IS_BRIDGE; | |||
| pData->engine->registerEnginePlugin(pData->id, this); | |||
| // init OSC | |||
| // init bridge thread | |||
| { | |||
| char shmIdsStr[6*4+1]; | |||
| carla_zeroChar(shmIdsStr, 6*4+1); | |||
| std::strncpy(shmIdsStr, &fShmAudioPool.filename[fShmAudioPool.filename.length()-6], 6); | |||
| std::strncat(shmIdsStr, &fShmRtClientControl.filename[fShmRtClientControl.filename.length()-6], 6); | |||
| std::strncat(shmIdsStr, &fShmNonRtClientControl.filename[fShmNonRtClientControl.filename.length()-6], 6); | |||
| std::strncat(shmIdsStr, &fShmNonRtServerControl.filename[fShmNonRtServerControl.filename.length()-6], 6); | |||
| std::strncpy(shmIdsStr+6*0, &fShmAudioPool.filename[fShmAudioPool.filename.length()-6], 6); | |||
| std::strncpy(shmIdsStr+6*1, &fShmRtClientControl.filename[fShmRtClientControl.filename.length()-6], 6); | |||
| std::strncpy(shmIdsStr+6*2, &fShmNonRtClientControl.filename[fShmNonRtClientControl.filename.length()-6], 6); | |||
| std::strncpy(shmIdsStr+6*3, &fShmNonRtServerControl.filename[fShmNonRtServerControl.filename.length()-6], 6); | |||
| fBridgeThread.setData(bridgeBinary, label, shmIdsStr, fPluginType); | |||
| fBridgeThread.startThread(); | |||
| @@ -2297,7 +2261,7 @@ private: | |||
| BridgeParamInfo* fParams; | |||
| void resizeAudioAndCVPool(const uint32_t bufferSize) | |||
| void resizeAudioPool(const uint32_t bufferSize) | |||
| { | |||
| fShmAudioPool.resize(bufferSize, fInfo.aIns+fInfo.aOuts, fInfo.cvIns+fInfo.cvOuts); | |||
| @@ -77,7 +77,7 @@ enum PluginBridgeNonRtServerOpcode { | |||
| kPluginBridgeNonRtServerParameterCount, // uint/ins, uint/outs | |||
| kPluginBridgeNonRtServerProgramCount, // uint/count | |||
| kPluginBridgeNonRtServerMidiProgramCount, // uint/count | |||
| kPluginBridgeNonRtServerParameterData1, // uint/index, int/rindex, uint/type, uint/hints, int/cc | |||
| kPluginBridgeNonRtServerParameterData1, // uint/index, int/rindex, uint/type, uint/hints, short/cc | |||
| kPluginBridgeNonRtServerParameterData2, // uint/index, uint/size, str[] (name), uint/size, str[] (unit) | |||
| kPluginBridgeNonRtServerParameterRanges1, // uint/index, float/def, float/min, float/max | |||
| kPluginBridgeNonRtServerParameterRanges2, // uint/index float/step, float/stepSmall, float/stepLarge | |||
| @@ -87,7 +87,6 @@ enum PluginBridgeNonRtServerOpcode { | |||
| kPluginBridgeNonRtServerCurrentMidiProgram, // int/index | |||
| kPluginBridgeNonRtServerProgramName, // uint/index, uint/size, str[] (name) | |||
| kPluginBridgeNonRtServerMidiProgramData, // uint/index, uint/bank, uint/program, uint/size, str[] (name) | |||
| kPluginBridgeNonRtServerConfigure, // uint/size, str[], uint/size, str[] | |||
| kPluginBridgeNonRtServerSetCustomData, // uint/size, str[], uint/size, str[], uint/size, str[] (compressed) | |||
| kPluginBridgeNonRtServerSetChunkDataFile, // uint/size, str[] (filename) | |||
| kPluginBridgeNonRtServerSetLatency, // uint | |||
| @@ -283,8 +282,6 @@ const char* PluginBridgeNonRtServerOpcode2str(const PluginBridgeNonRtServerOpcod | |||
| return "kPluginBridgeNonRtServerProgramName"; | |||
| case kPluginBridgeNonRtServerMidiProgramData: | |||
| return "kPluginBridgeNonRtServerMidiProgramData"; | |||
| case kPluginBridgeNonRtServerConfigure: | |||
| return "kPluginBridgeNonRtServerConfigure"; | |||
| case kPluginBridgeNonRtServerSetCustomData: | |||
| return "kPluginBridgeNonRtServerSetCustomData"; | |||
| case kPluginBridgeNonRtServerSetChunkDataFile: | |||