From 548cd198667f0e7e4bc6bb6d73cedd9181e003bf Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 7 Nov 2013 12:32:22 +0000 Subject: [PATCH] More misc fixing --- source/backend/CarlaEngine.hpp | 2 +- source/backend/engine/CarlaEngine.cpp | 34 +++++++++++++++-------- source/backend/engine/CarlaEngineJack.cpp | 17 ++---------- source/carla_host.py | 4 +-- source/carla_patchbay.py | 15 ++-------- source/modules/jackbridge/JackBridge2.cpp | 2 ++ 6 files changed, 32 insertions(+), 42 deletions(-) diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index dd7604660..115f0b8f0 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -1239,7 +1239,7 @@ public: void oscSend_control_remove_plugin(const int32_t pluginId); void oscSend_control_set_plugin_data(const int32_t pluginId, const int32_t type, const int32_t category, const int32_t hints, const char* const realName, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId); void oscSend_control_set_plugin_ports(const int32_t pluginId, const int32_t audioIns, const int32_t audioOuts, const int32_t midiIns, const int32_t midiOuts, const int32_t cIns, const int32_t cOuts, const int32_t cTotals); - void oscSend_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const label, const float current); + void oscSend_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const unit, const float current); void oscSend_control_set_parameter_ranges(const int32_t pluginId, const int32_t index, const float min, const float max, const float def, const float step, const float stepSmall, const float stepLarge); void oscSend_control_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc); void oscSend_control_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel); diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index b1cbf939f..38150593f 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -15,6 +15,16 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ +/* TODO: + * - add more checks to oscSend_* stuff + * - complete processRack(): carefully add to input, sorted events + * - implement processPatchbay() + * - implement oscSend_control_switch_plugins() + * - proper find&load plugins + * - uncomment CarlaPlugin::newAU and newCSOUND + * - something about the peaks? + */ + #include "CarlaEngineInternal.hpp" #include "CarlaBackendUtils.hpp" #include "CarlaStateUtils.hpp" @@ -1808,7 +1818,7 @@ void CarlaEngine::oscSend_control_add_plugin_start(const int32_t pluginId, const { CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); CARLA_SAFE_ASSERT_RETURN(pluginId >= 0 && pluginId < static_cast(pData->maxPluginNumber),); - CARLA_SAFE_ASSERT_RETURN(pluginName != nullptr,); + CARLA_SAFE_ASSERT_RETURN(pluginName != nullptr && pluginName[0] != '\0',); carla_debug("CarlaEngine::oscSend_control_add_plugin_start(%i, \"%s\")", pluginId, pluginName); if (pData->oscData->target != nullptr) @@ -1855,8 +1865,8 @@ void CarlaEngine::oscSend_control_set_plugin_data(const int32_t pluginId, const CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); CARLA_SAFE_ASSERT_RETURN(pluginId >= 0 && pluginId < static_cast(pData->maxPluginNumber),); CARLA_SAFE_ASSERT_RETURN(type != PLUGIN_NONE,); - CARLA_SAFE_ASSERT_RETURN(realName != nullptr,); - CARLA_SAFE_ASSERT_RETURN(label != 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_control_set_plugin_data(%i, %i, %i, %i, \"%s\", \"%s\", \"%s\", \"%s\", " P_INT64 ")", pluginId, type, category, hints, realName, label, maker, copyright, uniqueId); @@ -1885,22 +1895,22 @@ void CarlaEngine::oscSend_control_set_plugin_ports(const int32_t pluginId, const } } -void CarlaEngine::oscSend_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const label, const float current) +void CarlaEngine::oscSend_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const unit, const float current) { CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); CARLA_SAFE_ASSERT_RETURN(pluginId >= 0 && pluginId < static_cast(pData->maxPluginNumber),); CARLA_SAFE_ASSERT_RETURN(index >= 0,); CARLA_SAFE_ASSERT_RETURN(type != PARAMETER_UNKNOWN,); - CARLA_SAFE_ASSERT_RETURN(name != nullptr,); - CARLA_SAFE_ASSERT_RETURN(label != nullptr,); - carla_debug("CarlaEngine::oscSend_control_set_parameter_data(%i, %i, %i, %i, \"%s\", \"%s\", %f)", pluginId, index, type, hints, name, label, current); + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); + CARLA_SAFE_ASSERT_RETURN(unit != nullptr,); + carla_debug("CarlaEngine::oscSend_control_set_parameter_data(%i, %i, %i, %i, \"%s\", \"%s\", %f)", pluginId, index, type, hints, name, unit, current); if (pData->oscData->target != nullptr) { char targetPath[std::strlen(pData->oscData->path)+20]; std::strcpy(targetPath, pData->oscData->path); std::strcat(targetPath, "/set_parameter_data"); - lo_send(pData->oscData->target, targetPath, "iiiissf", pluginId, index, type, hints, name, label, current); + lo_send(pData->oscData->target, targetPath, "iiiissf", pluginId, index, type, hints, name, unit, current); } } @@ -2226,8 +2236,8 @@ void CarlaEngine::oscSend_bridge_midi_program_count(const int32_t count) void CarlaEngine::oscSend_bridge_plugin_info(const int32_t category, const int32_t hints, const char* const name, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId) { CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); - CARLA_SAFE_ASSERT_RETURN(name != nullptr,); - CARLA_SAFE_ASSERT_RETURN(label != nullptr,); + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[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_info(%i, %i, \"%s\", \"%s\", \"%s\", \"%s\", " P_INT64 ")", category, hints, name, label, maker, copyright, uniqueId); @@ -2244,7 +2254,7 @@ void CarlaEngine::oscSend_bridge_plugin_info(const int32_t category, const int32 void CarlaEngine::oscSend_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit) { CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); - CARLA_SAFE_ASSERT_RETURN(name != nullptr,); + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(unit != nullptr,); carla_debug("CarlaEngine::oscSend_bridge_parameter_info(%i, \"%s\", \"%s\")", index, name, unit); @@ -2316,7 +2326,7 @@ void CarlaEngine::oscSend_bridge_midi_program_info(const int32_t index, const in void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) { CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); - CARLA_SAFE_ASSERT_RETURN(key != 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); diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index e09e5ffb5..22b43906b 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -19,12 +19,7 @@ #include "CarlaBackendUtils.hpp" #include "CarlaMIDI.h" -#ifdef JACKBRIDGE_EXPORT -# include "jackbridge/JackBridge.hpp" -#else -# include "jackbridge/JackBridge1.cpp" -# include "jackbridge/JackBridge2.cpp" -#endif +#include "jackbridge/JackBridge.hpp" #include "juce_audio_basics.h" @@ -840,10 +835,7 @@ public: #ifdef BUILD_BRIDGE client = fClient = jackbridge_client_open(plugin->getName(), JackNullOption, nullptr); - CARLA_ASSERT(client != nullptr); - - if (client == nullptr) - return nullptr; + CARLA_SAFE_ASSERT_RETURN(client != nullptr, nullptr); fBufferSize = jackbridge_get_buffer_size(client); fSampleRate = jackbridge_get_sample_rate(client); @@ -865,10 +857,7 @@ public: { client = jackbridge_client_open(plugin->getName(), JackNullOption, nullptr); - CARLA_ASSERT(client != nullptr); - - if (client == nullptr) - return nullptr; + CARLA_SAFE_ASSERT_RETURN(client != nullptr, nullptr); jackbridge_custom_publish_data(client, URI_CANVAS_ICON, iconName, std::strlen(iconName)+1); diff --git a/source/carla_host.py b/source/carla_host.py index 79ffcc0b7..c52ff2020 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -130,7 +130,7 @@ class HostWindow(QMainWindow): PatchbayPortRenamedCallback = pyqtSignal(int, int, str) PatchbayConnectionAddedCallback = pyqtSignal(int, int, int) PatchbayConnectionRemovedCallback = pyqtSignal(int) - PatchbayIconChangedCallback = pyqtSignal(int, int) + PatchbayIconChangedCallback = pyqtSignal(int, str) BufferSizeChangedCallback = pyqtSignal(int) SampleRateChangedCallback = pyqtSignal(float) ProcessModeChangedCallback = pyqtSignal(int) @@ -1071,7 +1071,7 @@ def EngineCallback(ptr, action, pluginId, value1, value2, value3, valueStr): elif action == CALLBACK_PATCHBAY_CONNECTION_REMOVED: Carla.gui.PatchbayConnectionRemovedCallback.emit(value1) elif action == CALLBACK_PATCHBAY_ICON_CHANGED: - Carla.gui.PatchbayIconChangedCallback.emit(value1, value2) + Carla.gui.PatchbayIconChangedCallback.emit(value1, cString(valueStr)) elif action == CALLBACK_BUFFER_SIZE_CHANGED: Carla.gui.BufferSizeChangedCallback.emit(value1) elif action == CALLBACK_SAMPLE_RATE_CHANGED: diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index d140948c5..934288756 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -590,19 +590,8 @@ class CarlaPatchbayW(QGraphicsView): #QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()")) @pyqtSlot(int, int) - def slot_handlePatchbayIconChangedCallback(self, clientId, clientIcon): - pcIcon = patchcanvas.ICON_APPLICATION - - if clientIcon == PATCHBAY_ICON_HARDWARE: - pcIcon = patchcanvas.ICON_HARDWARE - elif clientIcon == PATCHBAY_ICON_DISTRHO: - pcIcon = patchcanvas.ICON_DISTRHO - elif clientIcon == PATCHBAY_ICON_FILE: - pcIcon = patchcanvas.ICON_FILE - elif clientIcon == PATCHBAY_ICON_PLUGIN: - pcIcon = patchcanvas.ICON_PLUGIN - - patchcanvas.setGroupIcon(clientId, pcIcon) + def slot_handlePatchbayIconChangedCallback(self, clientId, icon): + patchcanvas.setGroupIcon(clientId, icon) # ----------------------------------------------------------------- diff --git a/source/modules/jackbridge/JackBridge2.cpp b/source/modules/jackbridge/JackBridge2.cpp index 36163059d..b22855284 100644 --- a/source/modules/jackbridge/JackBridge2.cpp +++ b/source/modules/jackbridge/JackBridge2.cpp @@ -16,6 +16,8 @@ #include "CarlaDefines.hpp" +#include "JackBridge.hpp" + #ifndef JACKBRIDGE_HPP_INCLUDED // don't include the whole JACK API in this file CARLA_EXPORT bool jackbridge_sem_init(void* sem);