| @@ -98,7 +98,7 @@ public: | |||
| { | |||
| osc_send_hide(&osc.data); | |||
| osc_send_quit(&osc.data); | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| } | |||
| if (osc.thread) | |||
| @@ -25,15 +25,22 @@ unsigned int uintMin(unsigned int value1, unsigned int value2) | |||
| return value1 < value2 ? value1 : value2; | |||
| } | |||
| void osc_error_handler(const int num, const char* const msg, const char* const path) | |||
| void osc_error_handlerTCP(const int num, const char* const msg, const char* const path) | |||
| { | |||
| qCritical("CarlaBackend::osc_error_handler(%i, \"%s\", \"%s\")", num, msg, path); | |||
| qCritical("CarlaBackend::osc_error_handlerTCP(%i, \"%s\", \"%s\")", num, msg, path); | |||
| } | |||
| void osc_error_handlerUDP(const int num, const char* const msg, const char* const path) | |||
| { | |||
| qCritical("CarlaBackend::osc_error_handlerUDP(%i, \"%s\", \"%s\")", num, msg, path); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| CarlaOsc::CarlaOsc(CarlaEngine* const engine_) | |||
| : engine(engine_) | |||
| { | |||
| qDebug("CarlaOsc::CarlaOsc(%p)", engine_); | |||
| qDebug("CarlaOsc::CarlaOsc(%p)", engine); | |||
| CARLA_ASSERT(engine); | |||
| m_serverPathTCP = nullptr; | |||
| @@ -58,7 +65,7 @@ void CarlaOsc::init(const char* const name) | |||
| qDebug("CarlaOsc::init(\"%s\")", name); | |||
| CARLA_ASSERT(! m_serverPathTCP); | |||
| CARLA_ASSERT(! m_serverPathUDP); | |||
| CARLA_ASSERT(! m_serverThreadUDP); | |||
| CARLA_ASSERT(! m_serverThreadTCP); | |||
| CARLA_ASSERT(! m_serverThreadUDP); | |||
| CARLA_ASSERT(name); | |||
| CARLA_ASSERT(m_nameSize == 0); | |||
| @@ -67,8 +74,8 @@ void CarlaOsc::init(const char* const name) | |||
| m_nameSize = strlen(m_name); | |||
| // create new OSC thread | |||
| m_serverThreadTCP = lo_server_thread_new_with_proto(nullptr, LO_TCP, osc_error_handler); | |||
| m_serverThreadUDP = lo_server_thread_new_with_proto(nullptr, LO_UDP, osc_error_handler); | |||
| m_serverThreadTCP = lo_server_thread_new_with_proto(nullptr, LO_TCP, osc_error_handlerTCP); | |||
| m_serverThreadUDP = lo_server_thread_new_with_proto(nullptr, LO_UDP, osc_error_handlerUDP); | |||
| // get our full OSC server path | |||
| char* const threadPathTCP = lo_server_thread_get_url(m_serverThreadTCP); | |||
| @@ -91,11 +98,11 @@ void CarlaOsc::close() | |||
| qDebug("CarlaOsc::close()"); | |||
| CARLA_ASSERT(m_serverPathTCP); | |||
| CARLA_ASSERT(m_serverPathUDP); | |||
| CARLA_ASSERT(m_serverThreadUDP); | |||
| CARLA_ASSERT(m_serverThreadTCP); | |||
| CARLA_ASSERT(m_serverThreadUDP); | |||
| CARLA_ASSERT(m_name); | |||
| osc_clear_data(&m_controlData); | |||
| m_controlData.free(); | |||
| lo_server_thread_stop(m_serverThreadTCP); | |||
| lo_server_thread_stop(m_serverThreadUDP); | |||
| @@ -108,13 +115,15 @@ void CarlaOsc::close() | |||
| free((void*)m_serverPathUDP); | |||
| m_serverPathTCP = nullptr; | |||
| m_serverPathUDP = nullptr; | |||
| m_serverThreadTCP = nullptr; | |||
| m_serverThreadUDP = nullptr; | |||
| free(m_name); | |||
| m_name = nullptr; | |||
| m_nameSize = 0; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------- | |||
| int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | |||
| { | |||
| @@ -158,7 +167,7 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||
| if (pluginId < 0 || pluginId > CarlaEngine::maxPluginNumber()) | |||
| { | |||
| qCritical("CarlaOsc::handleMessage() - failed to get plugin, wrong id -> %i", pluginId); | |||
| qCritical("CarlaOsc::handleMessage() - failed to get plugin, wrong id '%i'", pluginId); | |||
| return 1; | |||
| } | |||
| @@ -167,19 +176,19 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||
| if (plugin == nullptr || plugin->id() != pluginId) | |||
| { | |||
| qWarning("CarlaOsc::handleMessage() - invalid plugin '%i', probably has been removed", pluginId); | |||
| qWarning("CarlaOsc::handleMessage() - invalid plugin id '%i', probably has been removed", pluginId); | |||
| return 1; | |||
| } | |||
| // Get method from path, "/Carla/i/method" | |||
| int offset = (pluginId >= 10) ? 4 : 3; | |||
| char method[32] = { 0 }; | |||
| const int offset = (pluginId >= 10) ? 4 : 3; | |||
| char method[32] = { 0 }; | |||
| memcpy(method, path + (m_nameSize + offset), uintMin(strlen(path), 32)); | |||
| if (method[0] == 0) | |||
| if (method[0] == 0 || method[0] != '/') | |||
| return 1; | |||
| // Common OSC methods | |||
| // Common OSC methods (DSSI and internal UIs) | |||
| if (strcmp(method, "/update") == 0) | |||
| { | |||
| const lo_address source = lo_message_get_source(msg); | |||
| @@ -231,51 +240,51 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||
| #endif | |||
| // Plugin Bridges | |||
| if (plugin->hints() & PLUGIN_IS_BRIDGE) | |||
| if (strncmp(method, "/bridge_", 8) == 0 && (plugin->hints() & PLUGIN_IS_BRIDGE) > 0) | |||
| { | |||
| if (strcmp(method, "/bridge_set_input_peak_value") == 0) | |||
| if (strcmp(method+8, "set_input_peak_value") == 0) | |||
| return handleMsgBridgeSetInputPeakValue(plugin, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_output_peak_value") == 0) | |||
| if (strcmp(method+8, "set_output_peak_value") == 0) | |||
| return handleMsgBridgeSetOutputPeakValue(plugin, argc, argv, types); | |||
| if (strcmp(method, "/bridge_audio_count") == 0) | |||
| if (strcmp(method+8, "audio_count") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeAudioCount, argc, argv, types); | |||
| if (strcmp(method, "/bridge_midi_count") == 0) | |||
| if (strcmp(method+8, "midi_count") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeMidiCount, argc, argv, types); | |||
| if (strcmp(method, "/bridge_parameter_count") == 0) | |||
| if (strcmp(method+8, "parameter_count") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeParameterCount, argc, argv, types); | |||
| if (strcmp(method, "/bridge_program_count") == 0) | |||
| if (strcmp(method+8, "program_count") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeProgramCount, argc, argv, types); | |||
| if (strcmp(method, "/bridge_midi_program_count") == 0) | |||
| if (strcmp(method+8, "midi_program_count") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeMidiProgramCount, argc, argv, types); | |||
| if (strcmp(method, "/bridge_plugin_info") == 0) | |||
| if (strcmp(method+8, "plugin_info") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgePluginInfo, argc, argv, types); | |||
| if (strcmp(method, "/bridge_parameter_info") == 0) | |||
| if (strcmp(method+8, "parameter_info") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeParameterInfo, argc, argv, types); | |||
| if (strcmp(method, "/bridge_parameter_data") == 0) | |||
| if (strcmp(method+8, "parameter_data") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeParameterData, argc, argv, types); | |||
| if (strcmp(method, "/bridge_parameter_ranges") == 0) | |||
| if (strcmp(method+8, "parameter_ranges") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeParameterRanges, argc, argv, types); | |||
| if (strcmp(method, "/bridge_program_info") == 0) | |||
| if (strcmp(method+8, "program_info") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeProgramInfo, argc, argv, types); | |||
| if (strcmp(method, "/bridge_midi_program_info") == 0) | |||
| if (strcmp(method+8, "midi_program_info") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeMidiProgramInfo, argc, argv, types); | |||
| if (strcmp(method, "/bridge_configure") == 0) | |||
| if (strcmp(method+8, "configure") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeConfigure, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_parameter_value") == 0) | |||
| if (strcmp(method+8, "set_parameter_value") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetParameterValue, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_default_value") == 0) | |||
| if (strcmp(method+8, "set_default_value") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetDefaultValue, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_program") == 0) | |||
| if (strcmp(method+8, "set_program") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetProgram, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_midi_program") == 0) | |||
| if (strcmp(method+8, "set_midi_program") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetMidiProgram, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_custom_data") == 0) | |||
| if (strcmp(method+8, "set_custom_data") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetCustomData, argc, argv, types); | |||
| if (strcmp(method, "/bridge_set_chunk_data") == 0) | |||
| if (strcmp(method+8, "set_chunk_data") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeSetChunkData, argc, argv, types); | |||
| if (strcmp(method, "/bridge_update") == 0) | |||
| if (strcmp(method+8, "update") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeUpdateNow, argc, argv, types); | |||
| if (strcmp(method, "/bridge_error") == 0) | |||
| if (strcmp(method+8, "error") == 0) | |||
| return plugin->setOscBridgeInfo(PluginBridgeError, argc, argv, types); | |||
| } | |||
| @@ -283,7 +292,7 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||
| return 1; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------- | |||
| int CarlaOsc::handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source) | |||
| { | |||
| @@ -336,11 +345,11 @@ int CarlaOsc::handleMsgUnregister() | |||
| return 1; | |||
| } | |||
| osc_clear_data(&m_controlData); | |||
| m_controlData.free(); | |||
| return 0; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------- | |||
| int CarlaOsc::handleMsgUpdate(CARLA_OSC_HANDLE_ARGS2, const lo_address source) | |||
| { | |||
| @@ -450,12 +459,12 @@ int CarlaOsc::handleMsgExiting(CARLA_OSC_HANDLE_ARGS1) | |||
| // TODO - check for non-UIs (dssi-vst) and set to -1 instead | |||
| engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); | |||
| plugin->clearOscData(); | |||
| plugin->freeOscData(); | |||
| return 0; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------- | |||
| int CarlaOsc::handleMsgSetActive(CARLA_OSC_HANDLE_ARGS2) | |||
| { | |||
| @@ -94,12 +94,6 @@ private: | |||
| // ------------------------------------------------------------------- | |||
| static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const user_data) | |||
| { | |||
| CarlaOsc* const _this_ = (CarlaOsc*)user_data; | |||
| return _this_->handleMessage(path, argc, argv, types, msg); | |||
| } | |||
| int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); | |||
| int handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source); | |||
| @@ -132,6 +126,13 @@ private: | |||
| int handleMsgBridgeSetInputPeakValue(CARLA_OSC_HANDLE_ARGS2); | |||
| int handleMsgBridgeSetOutputPeakValue(CARLA_OSC_HANDLE_ARGS2); | |||
| static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const userData) | |||
| { | |||
| CARLA_ASSERT(userData); | |||
| CarlaOsc* const _this_ = (CarlaOsc*)userData; | |||
| return _this_->handleMessage(path, argc, argv, types, msg); | |||
| } | |||
| }; | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| @@ -1542,20 +1542,25 @@ public: | |||
| */ | |||
| void updateOscData(const lo_address source, const char* const url) | |||
| { | |||
| // FIXME - remove debug prints later | |||
| qWarning("CarlaPlugin::updateOscData(%p, \"%s\")", source, url); | |||
| const char* host; | |||
| const char* port; | |||
| const int proto = lo_address_get_protocol(source); | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| host = lo_address_get_hostname(source); | |||
| port = lo_address_get_port(source); | |||
| osc.data.source = lo_address_new_with_proto(proto, host, port); | |||
| qWarning("CarlaPlugin::updateOscData() - source: host \"%s\", port \"%s\"", host, port); | |||
| host = lo_url_get_hostname(url); | |||
| port = lo_url_get_port(url); | |||
| osc.data.path = lo_url_get_path(url); | |||
| osc.data.target = lo_address_new_with_proto(proto, host, port); | |||
| qWarning("CarlaPlugin::updateOscData() - target: host \"%s\", port \"%s\", path \"%s\"", host, port, osc.data.path); | |||
| free((void*)host); | |||
| free((void*)port); | |||
| @@ -1589,22 +1594,15 @@ public: | |||
| for (uint32_t i=0; i < param.count; i++) | |||
| osc_send_control(&osc.data, param.data[i].rindex, getParameterValue(i)); | |||
| // if (m_hints & PLUGIN_IS_BRIDGE) | |||
| // { | |||
| // osc_send_control(&osc.data, PARAMETER_ACTIVE, m_active ? 1.0 : 0.0); | |||
| // osc_send_control(&osc.data, PARAMETER_DRYWET, x_dryWet); | |||
| // osc_send_control(&osc.data, PARAMETER_VOLUME, x_volume); | |||
| // osc_send_control(&osc.data, PARAMETER_BALANCE_LEFT, x_balanceLeft); | |||
| // osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, x_balanceRight); | |||
| // } | |||
| qWarning("CarlaPlugin::updateOscData() - done"); | |||
| } | |||
| /*! | |||
| * Clear the plugin's internal OSC data. | |||
| * Free the plugin's internal OSC memory data. | |||
| */ | |||
| void clearOscData() | |||
| void freeOscData() | |||
| { | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| } | |||
| /*! | |||
| @@ -1613,17 +1611,22 @@ public: | |||
| */ | |||
| bool showOscGui() | |||
| { | |||
| qWarning("CarlaPlugin::showOscGui()"); | |||
| // wait for UI 'update' call | |||
| for (uint i=0; i < carlaOptions.oscUiTimeout; i++) | |||
| { | |||
| if (osc.data.target) | |||
| { | |||
| qWarning("CarlaPlugin::showOscGui() - got response, asking UI to show itself now"); | |||
| osc_send_show(&osc.data); | |||
| return true; | |||
| } | |||
| else | |||
| carla_msleep(100); | |||
| } | |||
| qWarning("CarlaPlugin::showOscGui() - Timeout while waiting for UI to respond"); | |||
| return false; | |||
| } | |||
| #endif | |||
| @@ -213,6 +213,7 @@ void CarlaPluginThread::run() | |||
| m_process->setProcessChannelMode(QProcess::ForwardedChannels); | |||
| QStringList arguments; | |||
| const char* name = plugin->name() ? plugin->name() : "(none)"; | |||
| switch (mode) | |||
| { | |||
| @@ -237,12 +238,6 @@ void CarlaPluginThread::run() | |||
| break; | |||
| case PLUGIN_THREAD_BRIDGE: | |||
| { | |||
| const char* name = plugin->name(); | |||
| if (! name) | |||
| name = "(none)"; | |||
| /* osc_url */ arguments << QString("%1/%2").arg(engine->getOscServerPathTCP()).arg(plugin->id()); | |||
| /* stype */ arguments << m_data1; | |||
| /* filename */ arguments << plugin->filename(); | |||
| @@ -250,10 +245,6 @@ void CarlaPluginThread::run() | |||
| /* label */ arguments << m_label; | |||
| break; | |||
| } | |||
| } | |||
| qDebug() << m_binary; | |||
| qDebug() << arguments; | |||
| m_process->start(m_binary, arguments); | |||
| m_process->waitForStarted(); | |||
| @@ -289,18 +280,10 @@ void CarlaPluginThread::run() | |||
| break; | |||
| case PLUGIN_THREAD_BRIDGE: | |||
| qDebug("CarlaPluginThread::run() - bridge starting..."); | |||
| m_process->waitForFinished(-1); | |||
| qDebug("CarlaPluginThread::run() - bridge ended"); | |||
| #ifdef DEBUG | |||
| if (m_process->exitCode() == 0) | |||
| qDebug("CarlaPluginThread::run() - bridge closed"); | |||
| else | |||
| qDebug("CarlaPluginThread::run() - bridge crashed"); | |||
| qDebug("%s", QString(m_process->readAllStandardOutput()).toUtf8().constData()); | |||
| #endif | |||
| if (m_process->exitCode() != 0) | |||
| qWarning("CarlaPluginThread::run() - bridge crashed"); | |||
| break; | |||
| } | |||
| @@ -319,7 +319,7 @@ public: | |||
| { | |||
| osc_send_hide(&osc.data); | |||
| osc_send_quit(&osc.data); | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| } | |||
| if (! osc.thread->wait(500)) | |||
| @@ -1193,19 +1193,19 @@ public: | |||
| for (i=0; i < aIn.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) ldescriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
| if (i == 1 && h2) ldescriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| else if (i == 1) ldescriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| } | |||
| for (i=0; i < aOut.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) ldescriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
| if (i == 1 && h2) ldescriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| else if (i == 1) ldescriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| } | |||
| if (descriptor->run_synth) | |||
| { | |||
| descriptor->run_synth(handle, frames, midiEvents, midiEventCount); | |||
| if (h2) descriptor->run_synth(handle, frames, midiEvents, midiEventCount); | |||
| if (h2) descriptor->run_synth(h2, frames, midiEvents, midiEventCount); | |||
| } | |||
| else if (descriptor->run_multiple_synths) | |||
| { | |||
| @@ -884,13 +884,13 @@ public: | |||
| for (i=0; i < aIn.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) descriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
| if (i == 1 && h2) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| else if (i == 1) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| } | |||
| for (i=0; i < aOut.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) descriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
| if (i == 1 && h2) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| else if (i == 1) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| } | |||
| descriptor->run(handle, frames); | |||
| @@ -1019,7 +1019,7 @@ public: | |||
| { | |||
| osc_send_hide(&osc.data); | |||
| osc_send_quit(&osc.data); | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| } | |||
| if (! osc.thread->wait(500)) | |||
| @@ -2474,13 +2474,13 @@ public: | |||
| for (i=0; i < aIn.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) descriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
| if (i == 1 && h2) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| else if (i == 1) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
| } | |||
| for (i=0; i < aOut.count; i++) | |||
| { | |||
| if (i == 0 || ! h2) descriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
| if (i == 1 && h2) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| else if (i == 1) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
| } | |||
| descriptor->run(handle, frames); | |||
| @@ -406,7 +406,7 @@ public: | |||
| { | |||
| osc_send_hide(&osc.data); | |||
| osc_send_quit(&osc.data); | |||
| osc_clear_data(&osc.data); | |||
| osc.data.free(); | |||
| } | |||
| if (! osc.thread->wait(500)) | |||
| @@ -2200,7 +2200,7 @@ public: | |||
| #endif | |||
| // special checks | |||
| if (effect->dispatcher(effect, effCanDo, 0, 0, (void*)"hasCockosExtensions", 0.0f) == 0xbeef0000) | |||
| if ((uintptr_t)effect->dispatcher(effect, effCanDo, 0, 0, (void*)"hasCockosExtensions", 0.0f) == 0xbeef0000) | |||
| { | |||
| qDebug("Plugin has Cockos extensions!"); | |||
| m_hints |= PLUGIN_HAS_COCKOS_EXTENSIONS; | |||
| @@ -103,13 +103,14 @@ void CarlaBridgeOsc::close() | |||
| CARLA_ASSERT(m_server); | |||
| CARLA_ASSERT(m_serverPath); | |||
| osc_clear_data(&m_controlData); | |||
| m_controlData.free(); | |||
| lo_server_del_method(m_server, nullptr, nullptr); | |||
| lo_server_free(m_server); | |||
| free((void*)m_serverPath); | |||
| m_serverPath = nullptr; | |||
| m_server = nullptr; | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -131,7 +132,7 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
| char method[32] = { 0 }; | |||
| memcpy(method, path + (m_nameSize + 1), uintMin(strlen(path), 32)); | |||
| if (method[0] == 0) | |||
| if (method[0] == 0 || method[0] != '/') | |||
| return 1; | |||
| // Common OSC methods | |||
| @@ -24,8 +24,6 @@ | |||
| #define CARLA_BRIDGE_OSC_HANDLE_ARGS const int argc, const lo_arg* const* const argv, const char* const types | |||
| #define CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ | |||
| CARLA_ASSERT(m_server); \ | |||
| CARLA_ASSERT(m_serverPath); \ | |||
| /* check argument count */ \ | |||
| if (argc != argcToCompare) \ | |||
| { \ | |||
| @@ -35,27 +35,23 @@ struct CarlaOscData { | |||
| : path(nullptr), | |||
| source(nullptr), | |||
| target(nullptr) {} | |||
| }; | |||
| static inline | |||
| void osc_clear_data(CarlaOscData* const oscData) | |||
| { | |||
| CARLA_ASSERT(oscData); | |||
| qDebug("osc_clear_data(path:\"%s\")", oscData->path); | |||
| void free() | |||
| { | |||
| if (path) | |||
| ::free((void*)path); | |||
| if (oscData->path) | |||
| free((void*)oscData->path); | |||
| if (source) | |||
| lo_address_free(source); | |||
| if (oscData->source) | |||
| lo_address_free(oscData->source); | |||
| if (target) | |||
| lo_address_free(target); | |||
| if (oscData->target) | |||
| lo_address_free(oscData->target); | |||
| oscData->path = nullptr; | |||
| oscData->source = nullptr; | |||
| oscData->target = nullptr; | |||
| } | |||
| path = nullptr; | |||
| source = nullptr; | |||
| target = nullptr; | |||
| } | |||
| }; | |||
| static inline | |||
| void osc_send_configure(const CarlaOscData* const oscData, const char* const key, const char* const value) | |||
| @@ -184,7 +180,7 @@ void osc_send_sample_rate(const CarlaOscData* const oscData, const float sampleR | |||
| { | |||
| char targetPath[strlen(oscData->path)+12]; | |||
| strcpy(targetPath, oscData->path); | |||
| strcat(targetPath, "/sample_rate"); | |||
| strcat(targetPath, "/sample-rate"); | |||
| lo_send(oscData->target, targetPath, "f", sampleRate); | |||
| } | |||
| } | |||
| @@ -16,8 +16,8 @@ | |||
| */ | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| #include <jack/jack.h> | |||
| #include <jack/midiport.h> | |||
| # include <jack/jack.h> | |||
| # include <jack/midiport.h> | |||
| #endif | |||
| #include "carla_jackbridge.h" | |||
| @@ -21,7 +21,7 @@ | |||
| #include "carla_includes.h" | |||
| #include <jack/types.h> | |||
| #include <jack/transport.h> | |||
| #include <jack/transport.h> // needed for JACK1 | |||
| typedef unsigned char jackbridge_midi_data_t; | |||