Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
| @@ -821,7 +821,8 @@ public: | |||||
| fPatchbayProcThreadProtectionMutex(), | fPatchbayProcThreadProtectionMutex(), | ||||
| fRetConns(), | fRetConns(), | ||||
| fPostPonedEvents(), | fPostPonedEvents(), | ||||
| fPostPonedEventsMutex() | |||||
| fPostPonedEventsMutex(), | |||||
| fIsInternalClient(false) | |||||
| #endif | #endif | ||||
| { | { | ||||
| carla_debug("CarlaEngineJack::CarlaEngineJack()"); | carla_debug("CarlaEngineJack::CarlaEngineJack()"); | ||||
| @@ -881,7 +882,7 @@ public: | |||||
| bool init(const char* const clientName) override | bool init(const char* const clientName) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr || (clientName != nullptr && clientName[0] != '\0'), false); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr || (clientName != nullptr && clientName[0] != '\0'), false); | |||||
| CARLA_SAFE_ASSERT_RETURN(jackbridge_is_ok(), false); | CARLA_SAFE_ASSERT_RETURN(jackbridge_is_ok(), false); | ||||
| carla_debug("CarlaEngineJack::init(\"%s\")", clientName); | carla_debug("CarlaEngineJack::init(\"%s\")", clientName); | ||||
| @@ -1066,11 +1067,15 @@ public: | |||||
| #endif | #endif | ||||
| } | } | ||||
| #ifndef BUILD_BRIDGE | |||||
| bool initInternal(jack_client_t* const client) | bool initInternal(jack_client_t* const client) | ||||
| { | { | ||||
| fClient = client; | fClient = client; | ||||
| fIsInternalClient = true; | |||||
| return init(nullptr); | return init(nullptr); | ||||
| } | } | ||||
| #endif | |||||
| bool close() override | bool close() override | ||||
| { | { | ||||
| @@ -1496,6 +1501,7 @@ public: | |||||
| bool patchbayRefresh(const bool sendHost, const bool sendOSC, const bool external) override | bool patchbayRefresh(const bool sendHost, const bool sendOSC, const bool external) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, false); | ||||
| carla_debug("patchbayRefresh(%s, %s, %s)", bool2str(sendHost), bool2str(sendOSC), bool2str(external)); | |||||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
| { | { | ||||
| @@ -2366,8 +2372,10 @@ private: | |||||
| } | } | ||||
| // query all jack ports | // query all jack ports | ||||
| if (const char** const ports = jackbridge_get_ports(fClient, nullptr, nullptr, 0)) | |||||
| { | { | ||||
| const char** const ports = jackbridge_get_ports(fClient, nullptr, nullptr, 0); | |||||
| CARLA_SAFE_ASSERT_RETURN(ports != nullptr,); | |||||
| for (int i=0; ports[i] != nullptr; ++i) | for (int i=0; ports[i] != nullptr; ++i) | ||||
| { | { | ||||
| const char* const fullPortName(ports[i]); | const char* const fullPortName(ports[i]); | ||||
| @@ -2617,6 +2625,8 @@ private: | |||||
| LinkedList<PostPonedJackEvent> fPostPonedEvents; | LinkedList<PostPonedJackEvent> fPostPonedEvents; | ||||
| CarlaMutex fPostPonedEventsMutex; | CarlaMutex fPostPonedEventsMutex; | ||||
| bool fIsInternalClient; | |||||
| void postPoneJackCallback(const PostPonedJackEvent& ev) | void postPoneJackCallback(const PostPonedJackEvent& ev) | ||||
| { | { | ||||
| const CarlaMutexLocker cml(fPostPonedEventsMutex); | const CarlaMutexLocker cml(fPostPonedEventsMutex); | ||||
| @@ -2633,6 +2643,9 @@ private: | |||||
| for (; ! shouldThreadExit();) | for (; ! shouldThreadExit();) | ||||
| { | { | ||||
| if (fIsInternalClient) | |||||
| idle(); | |||||
| { | { | ||||
| const CarlaMutexLocker cml(fPostPonedEventsMutex); | const CarlaMutexLocker cml(fPostPonedEventsMutex); | ||||
| @@ -2648,7 +2661,7 @@ private: | |||||
| if (events.count() == 0 && newPlugins.count() == 0) | if (events.count() == 0 && newPlugins.count() == 0) | ||||
| { | { | ||||
| carla_msleep(200); | |||||
| carla_msleep(fIsInternalClient ? 10 : 200); | |||||
| continue; | continue; | ||||
| } | } | ||||
| @@ -2897,6 +2910,7 @@ CarlaEngine* CarlaEngine::newJack() | |||||
| CARLA_BACKEND_END_NAMESPACE | CARLA_BACKEND_END_NAMESPACE | ||||
| #ifndef BUILD_BRIDGE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // internal jack client | // internal jack client | ||||
| @@ -2943,6 +2957,7 @@ int jack_initialize(jack_client_t* const client, const char* const load_init) | |||||
| #if 0 //def CARLA_OS_UNIX | #if 0 //def CARLA_OS_UNIX | ||||
| sThreadSafeFFTW.init(); | sThreadSafeFFTW.init(); | ||||
| #endif | #endif | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| else | else | ||||
| @@ -2978,3 +2993,4 @@ void jack_finish(void *arg) | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| #endif | |||||
| @@ -110,6 +110,7 @@ void CarlaEngineOsc::init(const char* const name, int tcpPort, int udpPort) noex | |||||
| } | } | ||||
| lo_server_add_method(fServerTCP, nullptr, nullptr, osc_message_handler_TCP, this); | lo_server_add_method(fServerTCP, nullptr, nullptr, osc_message_handler_TCP, this); | ||||
| carla_debug("OSC TCP server running and listening at %s", fServerPathTCP.buffer()); | |||||
| } | } | ||||
| // ---------------------------------------------------------------------------------------------------------------- | // ---------------------------------------------------------------------------------------------------------------- | ||||
| @@ -142,6 +143,7 @@ void CarlaEngineOsc::init(const char* const name, int tcpPort, int udpPort) noex | |||||
| } | } | ||||
| lo_server_add_method(fServerUDP, nullptr, nullptr, osc_message_handler_UDP, this); | lo_server_add_method(fServerUDP, nullptr, nullptr, osc_message_handler_UDP, this); | ||||
| carla_debug("OSC UDP server running and listening at %s", fServerPathUDP.buffer()); | |||||
| } | } | ||||
| // ---------------------------------------------------------------------------------------------------------------- | // ---------------------------------------------------------------------------------------------------------------- | ||||
| @@ -418,12 +418,24 @@ int CarlaEngineOsc::handleMsgControl(const char* const method, | |||||
| CARLA_SAFE_ASSERT_RETURN_OSC_ERR(types[5] == 's'); | CARLA_SAFE_ASSERT_RETURN_OSC_ERR(types[5] == 's'); | ||||
| CARLA_SAFE_ASSERT_RETURN_OSC_ERR(types[7] == 'i'); | CARLA_SAFE_ASSERT_RETURN_OSC_ERR(types[7] == 'i'); | ||||
| const int32_t btype = argv[1]->i; | |||||
| int32_t btype = argv[1]->i; | |||||
| CARLA_SAFE_ASSERT_RETURN_OSC_ERR(btype >= 0); | CARLA_SAFE_ASSERT_RETURN_OSC_ERR(btype >= 0); | ||||
| const int32_t ptype = argv[2]->i; | const int32_t ptype = argv[2]->i; | ||||
| CARLA_SAFE_ASSERT_RETURN_OSC_ERR(ptype >= 0); | CARLA_SAFE_ASSERT_RETURN_OSC_ERR(ptype >= 0); | ||||
| // Force binary type to be native in some cases | |||||
| switch (ptype) | |||||
| { | |||||
| case PLUGIN_INTERNAL: | |||||
| case PLUGIN_LV2: | |||||
| case PLUGIN_SF2: | |||||
| case PLUGIN_SFZ: | |||||
| case PLUGIN_JACK: | |||||
| btype = BINARY_NATIVE; | |||||
| break; | |||||
| } | |||||
| const char* filename = &argv[3]->s; | const char* filename = &argv[3]->s; | ||||
| if (filename != nullptr && std::strcmp(filename, "(null)") == 0) | if (filename != nullptr && std::strcmp(filename, "(null)") == 0) | ||||
| @@ -288,7 +288,7 @@ void CarlaEngineOsc::sendResponse(const int messageId, const char* const error) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fControlDataTCP.path != nullptr && fControlDataTCP.path[0] != '\0',); | CARLA_SAFE_ASSERT_RETURN(fControlDataTCP.path != nullptr && fControlDataTCP.path[0] != '\0',); | ||||
| CARLA_SAFE_ASSERT_RETURN(fControlDataTCP.target != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fControlDataTCP.target != nullptr,); | ||||
| carla_debug("CarlaEngineOsc::sendExit()"); | |||||
| carla_debug("CarlaEngineOsc::sendResponse()"); | |||||
| char targetPath[std::strlen(fControlDataTCP.path)+6]; | char targetPath[std::strlen(fControlDataTCP.path)+6]; | ||||
| std::strcpy(targetPath, fControlDataTCP.path); | std::strcpy(targetPath, fControlDataTCP.path); | ||||
| @@ -314,7 +314,6 @@ void CarlaEngineOsc::sendRuntimeInfo() const noexcept | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fControlDataUDP.path != nullptr && fControlDataUDP.path[0] != '\0',); | CARLA_SAFE_ASSERT_RETURN(fControlDataUDP.path != nullptr && fControlDataUDP.path[0] != '\0',); | ||||
| CARLA_SAFE_ASSERT_RETURN(fControlDataUDP.target != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fControlDataUDP.target != nullptr,); | ||||
| carla_debug("CarlaEngineOsc::sendRuntimeInfo()"); | |||||
| const EngineTimeInfo timeInfo(fEngine->getTimeInfo()); | const EngineTimeInfo timeInfo(fEngine->getTimeInfo()); | ||||
| @@ -42,6 +42,10 @@ from liblo import ( | |||||
| from random import random | from random import random | ||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| DEBUG = False | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Host OSC object | # Host OSC object | ||||
| @@ -217,6 +221,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/cb', 'iiiiifs') | @make_method('/ctrl/cb', 'iiiiifs') | ||||
| def carla_cb(self, path, args): | def carla_cb(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| action, pluginId, value1, value2, value3, valuef, valueStr = args | action, pluginId, value1, value2, value3, valuef, valueStr = args | ||||
| self.host._setViaCallback(action, pluginId, value1, value2, value3, valuef, valueStr) | self.host._setViaCallback(action, pluginId, value1, value2, value3, valuef, valueStr) | ||||
| @@ -224,6 +229,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/info', 'iiiihiisssssss') | @make_method('/ctrl/info', 'iiiihiisssssss') | ||||
| def carla_info(self, path, args): | def carla_info(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| ( | ( | ||||
| pluginId, type_, category, hints, uniqueId, optsAvail, optsEnabled, | pluginId, type_, category, hints, uniqueId, optsAvail, optsEnabled, | ||||
| @@ -252,6 +258,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/ports', 'iiiiiiii') | @make_method('/ctrl/ports', 'iiiiiiii') | ||||
| def carla_ports(self, path, args): | def carla_ports(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, audioIns, audioOuts, midiIns, midiOuts, paramIns, paramOuts, paramTotal = args | pluginId, audioIns, audioOuts, midiIns, midiOuts, paramIns, paramOuts, paramTotal = args | ||||
| self.host._set_audioCountInfo(pluginId, {'ins': audioIns, 'outs': audioOuts}) | self.host._set_audioCountInfo(pluginId, {'ins': audioIns, 'outs': audioOuts}) | ||||
| @@ -260,6 +267,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/param', 'iiiiiissfffffff') | @make_method('/ctrl/param', 'iiiiiissfffffff') | ||||
| def carla_param(self, path, args): | def carla_param(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| ( | ( | ||||
| pluginId, paramId, type_, hints, midiChan, midiCC, name, unit, | pluginId, paramId, type_, hints, midiChan, midiCC, name, unit, | ||||
| @@ -300,6 +308,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/count', 'iiiiii') | @make_method('/ctrl/count', 'iiiiii') | ||||
| def carla_count(self, path, args): | def carla_count(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, pcount, mpcount, cdcount, cp, cmp = args | pluginId, pcount, mpcount, cdcount, cp, cmp = args | ||||
| self.host._set_programCount(pluginId, pcount) | self.host._set_programCount(pluginId, pcount) | ||||
| @@ -309,6 +318,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/pcount', 'iii') | @make_method('/ctrl/pcount', 'iii') | ||||
| def carla_pcount(self, path, args): | def carla_pcount(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, pcount, mpcount = args | pluginId, pcount, mpcount = args | ||||
| self.host._set_programCount(pluginId, pcount) | self.host._set_programCount(pluginId, pcount) | ||||
| @@ -316,24 +326,28 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/prog', 'iis') | @make_method('/ctrl/prog', 'iis') | ||||
| def carla_prog(self, path, args): | def carla_prog(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, progId, progName = args | pluginId, progId, progName = args | ||||
| self.host._set_programName(pluginId, progId, progName) | self.host._set_programName(pluginId, progId, progName) | ||||
| @make_method('/ctrl/mprog', 'iiiis') | @make_method('/ctrl/mprog', 'iiiis') | ||||
| def carla_mprog(self, path, args): | def carla_mprog(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, midiProgId, bank, program, name = args | pluginId, midiProgId, bank, program, name = args | ||||
| self.host._set_midiProgramData(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name}) | self.host._set_midiProgramData(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name}) | ||||
| @make_method('/ctrl/cdata', 'iisss') | @make_method('/ctrl/cdata', 'iisss') | ||||
| def carla_cdata(self, path, args): | def carla_cdata(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, index, type_, key, value = args | pluginId, index, type_, key, value = args | ||||
| self.host._set_customData(pluginId, index, { 'type': type_, 'key': key, 'value': value }) | self.host._set_customData(pluginId, index, { 'type': type_, 'key': key, 'value': value }) | ||||
| @make_method('/ctrl/iparams', 'ifffffff') | @make_method('/ctrl/iparams', 'ifffffff') | ||||
| def carla_iparams(self, path, args): | def carla_iparams(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| pluginId, active, drywet, volume, balLeft, balRight, pan, ctrlChan = args | pluginId, active, drywet, volume, balLeft, balRight, pan, ctrlChan = args | ||||
| self.host._set_internalValue(pluginId, PARAMETER_ACTIVE, active) | self.host._set_internalValue(pluginId, PARAMETER_ACTIVE, active) | ||||
| @@ -346,6 +360,7 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/resp', 'is') | @make_method('/ctrl/resp', 'is') | ||||
| def carla_resp(self, path, args): | def carla_resp(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| messageId, error = args | messageId, error = args | ||||
| self.host.responses[messageId] = error | self.host.responses[messageId] = error | ||||
| @@ -353,12 +368,14 @@ class CarlaControlServerTCP(Server): | |||||
| @make_method('/ctrl/exit', '') | @make_method('/ctrl/exit', '') | ||||
| def carla_exit(self, path, args): | def carla_exit(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| #self.host.lo_target_tcp = None | #self.host.lo_target_tcp = None | ||||
| self.host.QuitCallback.emit() | self.host.QuitCallback.emit() | ||||
| @make_method('/ctrl/exit-error', 's') | @make_method('/ctrl/exit-error', 's') | ||||
| def carla_exit_error(self, path, args): | def carla_exit_error(self, path, args): | ||||
| if DEBUG: print(path, args) | |||||
| self.fReceivedMsgs = True | self.fReceivedMsgs = True | ||||
| error, = args | error, = args | ||||
| self.host.lo_target_tcp = None | self.host.lo_target_tcp = None | ||||
| @@ -912,11 +912,13 @@ class HostWindow(QMainWindow): | |||||
| self.ui.act_canvas_show_internal.setVisible(True) | self.ui.act_canvas_show_internal.setVisible(True) | ||||
| self.ui.act_canvas_show_external.setChecked(False) | self.ui.act_canvas_show_external.setChecked(False) | ||||
| self.ui.act_canvas_show_external.setVisible(True) | self.ui.act_canvas_show_external.setVisible(True) | ||||
| self.fExternalPatchbay = False | |||||
| else: | else: | ||||
| self.ui.act_canvas_show_internal.setChecked(False) | self.ui.act_canvas_show_internal.setChecked(False) | ||||
| self.ui.act_canvas_show_internal.setVisible(False) | self.ui.act_canvas_show_internal.setVisible(False) | ||||
| self.ui.act_canvas_show_external.setChecked(False) | |||||
| self.ui.act_canvas_show_external.setChecked(True) | |||||
| self.ui.act_canvas_show_external.setVisible(False) | self.ui.act_canvas_show_external.setVisible(False) | ||||
| self.fExternalPatchbay = True | |||||
| self.ui.act_canvas_show_internal.blockSignals(False) | self.ui.act_canvas_show_internal.blockSignals(False) | ||||
| self.ui.act_canvas_show_external.blockSignals(False) | self.ui.act_canvas_show_external.blockSignals(False) | ||||