| @@ -158,6 +158,13 @@ enum GuiType { | |||||
| * These options must be set before calling CarlaEngine::init() or after CarlaEngine::close(). | * These options must be set before calling CarlaEngine::init() or after CarlaEngine::close(). | ||||
| */ | */ | ||||
| enum OptionsType { | enum OptionsType { | ||||
| /*! | |||||
| * Try to set the current process name.\n | |||||
| * | |||||
| * \note Not available on all platforms. | |||||
| */ | |||||
| OPTION_PROCESS_NAME = 0, | |||||
| /*! | /*! | ||||
| * Set the engine processing mode.\n | * Set the engine processing mode.\n | ||||
| * Default is PROCESS_MODE_MULTIPLE_CLIENTS. | * Default is PROCESS_MODE_MULTIPLE_CLIENTS. | ||||
| @@ -18,6 +18,8 @@ | |||||
| #include "carla_backend_standalone.h" | #include "carla_backend_standalone.h" | ||||
| #include "carla_plugin.h" | #include "carla_plugin.h" | ||||
| // ------------------------------------------------------------------------------------------------------------------- | |||||
| // Single, standalone engine | // Single, standalone engine | ||||
| static CarlaBackend::CarlaEngine* carlaEngine = nullptr; | static CarlaBackend::CarlaEngine* carlaEngine = nullptr; | ||||
| static CarlaBackend::CallbackFunc carlaFunc = nullptr; | static CarlaBackend::CallbackFunc carlaFunc = nullptr; | ||||
| @@ -111,6 +111,8 @@ bool CarlaEngine::init(const char* const clientName) | |||||
| m_oscData = m_osc.getControllerData(); | m_oscData = m_osc.getControllerData(); | ||||
| #endif | #endif | ||||
| carla_setprocname(clientName); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -1547,11 +1547,12 @@ public: | |||||
| for (size_t i=0; i < custom.size(); i++) | for (size_t i=0; i < custom.size(); i++) | ||||
| { | { | ||||
| if (m_type == PLUGIN_LV2) | |||||
| osc_send_lv2_transfer_event(&osc.data, getCustomDataTypeString(custom[i].type), /*custom[i].key,*/ custom[i].value); | |||||
| else if (custom[i].type == CUSTOM_DATA_STRING) | |||||
| // TODO | |||||
| //if (m_type == PLUGIN_LV2) | |||||
| //osc_send_lv2_transfer_event(&osc.data, getCustomDataTypeString(custom[i].type), /*custom[i].key,*/ custom[i].value); | |||||
| //else | |||||
| if (custom[i].type == CUSTOM_DATA_STRING) | |||||
| osc_send_configure(&osc.data, custom[i].key, custom[i].value); | osc_send_configure(&osc.data, custom[i].key, custom[i].value); | ||||
| // FIXME | |||||
| } | } | ||||
| if (prog.current >= 0) | if (prog.current >= 0) | ||||
| @@ -202,6 +202,8 @@ const char* OptionsType2str(const OptionsType type) | |||||
| { | { | ||||
| switch (type) | switch (type) | ||||
| { | { | ||||
| case OPTION_PROCESS_NAME: | |||||
| return "OPTION_PROCESS_NAME"; | |||||
| case OPTION_PROCESS_MODE: | case OPTION_PROCESS_MODE: | ||||
| return "OPTION_PROCESS_MODE"; | return "OPTION_PROCESS_MODE"; | ||||
| case OPTION_PROCESS_HIGH_PRECISION: | case OPTION_PROCESS_HIGH_PRECISION: | ||||
| @@ -524,6 +526,9 @@ void setOption(const OptionsType option, const int value, const char* const valu | |||||
| switch (option) | switch (option) | ||||
| { | { | ||||
| case OPTION_PROCESS_NAME: | |||||
| carla_setprocname(valueStr); | |||||
| break; | |||||
| case OPTION_PROCESS_MODE: | case OPTION_PROCESS_MODE: | ||||
| if (value < PROCESS_MODE_SINGLE_CLIENT || value > PROCESS_MODE_CONTINUOUS_RACK) | if (value < PROCESS_MODE_SINGLE_CLIENT || value > PROCESS_MODE_CONTINUOUS_RACK) | ||||
| return qCritical("CarlaBackend::setOption(%s, %i, \"%s\") - invalid value", OptionsType2str(option), value, valueStr); | return qCritical("CarlaBackend::setOption(%s, %i, \"%s\") - invalid value", OptionsType2str(option), value, valueStr); | ||||
| @@ -1223,7 +1223,8 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (gui.type == GUI_EXTERNAL_OSC) | if (gui.type == GUI_EXTERNAL_OSC) | ||||
| { | { | ||||
| osc_send_lv2_transfer_event(&osc.data, nullptr, nullptr); | |||||
| QByteArray chunk((const char*)atom, sizeof(LV2_Atom) + atom->size); | |||||
| osc_send_lv2_transfer_event(&osc.data, portIndex, chunk.toBase64().constData()); | |||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| @@ -171,7 +171,8 @@ public: | |||||
| virtual void setProgram(const uint32_t index) = 0; | virtual void setProgram(const uint32_t index) = 0; | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
| virtual void setMidiProgram(const uint32_t index) = 0; | virtual void setMidiProgram(const uint32_t index) = 0; | ||||
| #else | |||||
| #endif | |||||
| #ifdef BUILD_BRIDGE_UI | |||||
| virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0; | virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0; | ||||
| #endif | #endif | ||||
| virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; | virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; | ||||
| @@ -257,16 +258,16 @@ public: | |||||
| #endif | #endif | ||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| void sendOscLv2TransferAtom(const char* const type, const char* const value) | |||||
| void sendOscLv2TransferAtom(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| qDebug("CarlaClient::sendOscLv2TransferAtom(\"%s\", \"%s\")", type, value); | |||||
| m_osc.sendOscLv2TransferAtom(type, value); | |||||
| qDebug("CarlaClient::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf); | |||||
| m_osc.sendOscLv2TransferAtom(portIndex, atomBuf); | |||||
| } | } | ||||
| void sendOscLv2TransferEvent(const char* const type, const char* const value) | |||||
| void sendOscLv2TransferEvent(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| qDebug("CarlaClient::sendOscLv2TransferEvent(\"%s\", \"%s\")", type, value); | |||||
| m_osc.sendOscLv2TransferEvent(type, value); | |||||
| qDebug("CarlaClient::sendOscLv2TransferEvent(%i, \"%s\")", portIndex, atomBuf); | |||||
| m_osc.sendOscLv2TransferEvent(portIndex, atomBuf); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -316,7 +317,7 @@ protected: | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| private: | private: | ||||
| CarlaOsc m_osc; | |||||
| CarlaBridgeOsc m_osc; | |||||
| CarlaToolkit* const m_toolkit; | CarlaToolkit* const m_toolkit; | ||||
| struct { | struct { | ||||
| @@ -40,10 +40,10 @@ void osc_error_handler(const int num, const char* const msg, const char* const p | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| CarlaOsc::CarlaOsc(CarlaClient* const client_, const char* const name) | |||||
| CarlaBridgeOsc::CarlaBridgeOsc(CarlaClient* const client_, const char* const name) | |||||
| : client(client_) | : client(client_) | ||||
| { | { | ||||
| qDebug("CarlaOsc::CarlaOsc(%p, \"%s\")", client, name); | |||||
| qDebug("CarlaBridgeOsc::CarlaOsc(%p, \"%s\")", client, name); | |||||
| Q_ASSERT(client); | Q_ASSERT(client); | ||||
| Q_ASSERT(name); | Q_ASSERT(name); | ||||
| @@ -57,17 +57,17 @@ CarlaOsc::CarlaOsc(CarlaClient* const client_, const char* const name) | |||||
| m_nameSize = strlen(m_name); | m_nameSize = strlen(m_name); | ||||
| } | } | ||||
| CarlaOsc::~CarlaOsc() | |||||
| CarlaBridgeOsc::~CarlaBridgeOsc() | |||||
| { | { | ||||
| qDebug("CarlaOsc::~CarlaOsc()"); | |||||
| qDebug("CarlaBridgeOsc::~CarlaOsc()"); | |||||
| if (m_name) | if (m_name) | ||||
| free(m_name); | free(m_name); | ||||
| } | } | ||||
| bool CarlaOsc::init(const char* const url) | |||||
| bool CarlaBridgeOsc::init(const char* const url) | |||||
| { | { | ||||
| qDebug("CarlaOsc::init(\"%s\")", url); | |||||
| qDebug("CarlaBridgeOsc::init(\"%s\")", url); | |||||
| Q_ASSERT(! m_serverPath); | Q_ASSERT(! m_serverPath); | ||||
| Q_ASSERT(! m_serverThread); | Q_ASSERT(! m_serverThread); | ||||
| Q_ASSERT(url); | Q_ASSERT(url); | ||||
| @@ -83,7 +83,7 @@ bool CarlaOsc::init(const char* const url) | |||||
| if (! m_controlData.path) | if (! m_controlData.path) | ||||
| { | { | ||||
| qCritical("CarlaOsc::init(\"%s\") - failed to init OSC", url); | |||||
| qCritical("CarlaBridgeOsc::init(\"%s\") - failed to init OSC", url); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -102,9 +102,9 @@ bool CarlaOsc::init(const char* const url) | |||||
| return true; | return true; | ||||
| } | } | ||||
| void CarlaOsc::close() | |||||
| void CarlaBridgeOsc::close() | |||||
| { | { | ||||
| qDebug("CarlaOsc::close()"); | |||||
| qDebug("CarlaBridgeOsc::close()"); | |||||
| Q_ASSERT(m_serverPath); | Q_ASSERT(m_serverPath); | ||||
| Q_ASSERT(m_serverThread); | Q_ASSERT(m_serverThread); | ||||
| @@ -120,9 +120,9 @@ void CarlaOsc::close() | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | |||||
| int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||||
| qDebug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||||
| Q_ASSERT(m_serverPath); | Q_ASSERT(m_serverPath); | ||||
| Q_ASSERT(m_serverThread); | Q_ASSERT(m_serverThread); | ||||
| Q_ASSERT(path); | Q_ASSERT(path); | ||||
| @@ -130,7 +130,7 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||||
| // Check if message is for this client | // Check if message is for this client | ||||
| if ((! path) || strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) | if ((! path) || strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) | ||||
| { | { | ||||
| qWarning("CarlaOsc::handleMessage() - message not for this client: '%s' != '/%s/'", path, m_name); | |||||
| qWarning("CarlaBridgeOsc::handleMessage() - message not for this client: '%s' != '/%s/'", path, m_name); | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| @@ -174,13 +174,13 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||||
| return osc_set_parameter_midi_channel_handler(argv); | return osc_set_parameter_midi_channel_handler(argv); | ||||
| #endif | #endif | ||||
| qWarning("CarlaOsc::handleMessage(\"%s\", ...) - got unsupported OSC method '%s'", path, method); | |||||
| qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - got unsupported OSC method '%s'", path, method); | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgConfigure()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgConfigure()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | ||||
| if (! client) | if (! client) | ||||
| @@ -218,9 +218,9 @@ int CarlaOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgControl()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgControl()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); | ||||
| if (! client) | if (! client) | ||||
| @@ -233,9 +233,9 @@ int CarlaOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgProgram()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgProgram()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | ||||
| if (! client) | if (! client) | ||||
| @@ -247,9 +247,9 @@ int CarlaOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgMidiProgram()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgMidiProgram()"); | |||||
| #ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | ||||
| #else | #else | ||||
| @@ -271,9 +271,9 @@ int CarlaOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgMidi()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgMidi()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "m"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "m"); | ||||
| if (! client) | if (! client) | ||||
| @@ -304,9 +304,9 @@ int CarlaOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgShow() | |||||
| int CarlaBridgeOsc::handleMsgShow() | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgShow()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgShow()"); | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| @@ -316,9 +316,9 @@ int CarlaOsc::handleMsgShow() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgHide() | |||||
| int CarlaBridgeOsc::handleMsgHide() | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgHide()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgHide()"); | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| @@ -328,9 +328,9 @@ int CarlaOsc::handleMsgHide() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgQuit() | |||||
| int CarlaBridgeOsc::handleMsgQuit() | |||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgQuit()"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgQuit()"); | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| @@ -29,7 +29,7 @@ | |||||
| /* check argument count */ \ | /* check argument count */ \ | ||||
| if (argc != argcToCompare) \ | if (argc != argcToCompare) \ | ||||
| { \ | { \ | ||||
| qCritical("CarlaOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | |||||
| qCritical("CarlaBridgeOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | |||||
| return 1; \ | return 1; \ | ||||
| } \ | } \ | ||||
| if (argc > 0) \ | if (argc > 0) \ | ||||
| @@ -37,13 +37,13 @@ | |||||
| /* check for nullness */ \ | /* check for nullness */ \ | ||||
| if (! (types && typesToCompare)) \ | if (! (types && typesToCompare)) \ | ||||
| { \ | { \ | ||||
| qCritical("CarlaOsc::%s() - argument types are null", __FUNCTION__); \ | |||||
| qCritical("CarlaBridgeOsc::%s() - argument types are null", __FUNCTION__); \ | |||||
| return 1; \ | return 1; \ | ||||
| } \ | } \ | ||||
| /* check argument types */ \ | /* check argument types */ \ | ||||
| if (strcmp(types, typesToCompare) != 0) \ | if (strcmp(types, typesToCompare) != 0) \ | ||||
| { \ | { \ | ||||
| qCritical("CarlaOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | |||||
| qCritical("CarlaBridgeOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | |||||
| return 1; \ | return 1; \ | ||||
| } \ | } \ | ||||
| } | } | ||||
| @@ -57,11 +57,11 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| * @{ | * @{ | ||||
| */ | */ | ||||
| class CarlaOsc | |||||
| class CarlaBridgeOsc | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaOsc(CarlaClient* const client, const char* const name); | |||||
| ~CarlaOsc(); | |||||
| CarlaBridgeOsc(CarlaClient* const client, const char* const name); | |||||
| ~CarlaBridgeOsc(); | |||||
| bool init(const char* const url); | bool init(const char* const url); | ||||
| void close(); | void close(); | ||||
| @@ -140,20 +140,20 @@ public: | |||||
| #endif | #endif | ||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| void sendOscLv2TransferAtom(const char* const type, const char* const value) | |||||
| void sendOscLv2TransferAtom(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| Q_ASSERT(m_controlData.target); | Q_ASSERT(m_controlData.target); | ||||
| if (m_controlData.target) | if (m_controlData.target) | ||||
| osc_send_lv2_transfer_atom(&m_controlData, type, value); | |||||
| osc_send_lv2_transfer_atom(&m_controlData, portIndex, atomBuf); | |||||
| } | } | ||||
| void sendOscLv2TransferEvent(const char* const type, const char* const value) | |||||
| void sendOscLv2TransferEvent(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| Q_ASSERT(m_controlData.target); | Q_ASSERT(m_controlData.target); | ||||
| if (m_controlData.target) | if (m_controlData.target) | ||||
| osc_send_lv2_transfer_event(&m_controlData, type, value); | |||||
| osc_send_lv2_transfer_event(&m_controlData, portIndex, atomBuf); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -191,7 +191,8 @@ 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) | 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; | |||||
| Q_ASSERT(user_data); | |||||
| CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data; | |||||
| return _this_->handleMessage(path, argc, argv, types, msg); | return _this_->handleMessage(path, argc, argv, types, msg); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -20,6 +20,7 @@ | |||||
| #include "carla_bridge_client.h" | #include "carla_bridge_client.h" | ||||
| #include "carla_lv2.h" | #include "carla_lv2.h" | ||||
| #include "carla_midi.h" | #include "carla_midi.h" | ||||
| #include "rtmempool/rtmempool.h" | |||||
| #include <vector> | #include <vector> | ||||
| #include <QtCore/QDir> | #include <QtCore/QDir> | ||||
| @@ -429,19 +430,20 @@ public: | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| void handleTransferAtom(const char* const type, const char* const value) | |||||
| void handleTransferAtom(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| qDebug("CarlaLv2Client::handleTransferEvent(%s, %s)", type, value); | |||||
| Q_ASSERT(type); | |||||
| Q_ASSERT(value); | |||||
| qDebug("CarlaLv2Client::handleTransferEvent(%i, \"%s\")", portIndex, atomBuf); | |||||
| Q_ASSERT(portIndex >= 0); | |||||
| Q_ASSERT(atomBuf); | |||||
| } | } | ||||
| void handleTransferEvent(const char* const type, const char* const value) | |||||
| void handleTransferEvent(const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| qDebug("CarlaLv2Client::handleTransferEvent(%s, %s)", type, value); | |||||
| Q_ASSERT(type); | |||||
| Q_ASSERT(value); | |||||
| qDebug("CarlaLv2Client::handleTransferEvent(%i, \"%s\")", portIndex, atomBuf); | |||||
| Q_ASSERT(portIndex >= 0); | |||||
| Q_ASSERT(atomBuf); | |||||
| #if 0 | |||||
| if (handle && descriptor && descriptor->port_event) | if (handle && descriptor && descriptor->port_event) | ||||
| { | { | ||||
| LV2_URID_Map* const URID_Map = (LV2_URID_Map*)features[lv2_feature_id_urid_map]->data; | LV2_URID_Map* const URID_Map = (LV2_URID_Map*)features[lv2_feature_id_urid_map]->data; | ||||
| @@ -481,6 +483,7 @@ public: | |||||
| free((void*)chunk.buf); | free((void*)chunk.buf); | ||||
| sratom_free(sratom); | sratom_free(sratom); | ||||
| } | } | ||||
| #endif | |||||
| } | } | ||||
| void handleProgramChanged(int32_t /*index*/) | void handleProgramChanged(int32_t /*index*/) | ||||
| @@ -527,23 +530,23 @@ public: | |||||
| } | } | ||||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | ||||
| { | { | ||||
| const LV2_Atom* const atom = (const LV2_Atom*)buffer; | |||||
| //const LV2_Atom* const atom = (const LV2_Atom*)buffer; | |||||
| QByteArray chunk((const char*)buffer, bufferSize); | QByteArray chunk((const char*)buffer, bufferSize); | ||||
| sendOscLv2TransferAtom(getCustomURIString(atom->type), chunk.toBase64().constData()); | |||||
| sendOscLv2TransferAtom(portIndex, chunk.toBase64().constData()); | |||||
| if (descriptor && descriptor->port_event) | |||||
| descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM, atom); | |||||
| //if (descriptor && descriptor->port_event) | |||||
| // descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM, atom); | |||||
| } | } | ||||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | ||||
| { | { | ||||
| const LV2_Atom* const atom = (const LV2_Atom*)buffer; | |||||
| //const LV2_Atom* const atom = (const LV2_Atom*)buffer; | |||||
| QByteArray chunk((const char*)buffer, bufferSize); | QByteArray chunk((const char*)buffer, bufferSize); | ||||
| sendOscLv2TransferEvent(getCustomURIString(atom->type), chunk.toBase64().constData()); | |||||
| sendOscLv2TransferEvent(portIndex, chunk.toBase64().constData()); | |||||
| if (descriptor && descriptor->port_event) | |||||
| descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); | |||||
| //if (descriptor && descriptor->port_event) | |||||
| // descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); | |||||
| } | } | ||||
| } | } | ||||
| @@ -812,36 +815,36 @@ private: | |||||
| std::vector<const char*> customURIDs; | std::vector<const char*> customURIDs; | ||||
| }; | }; | ||||
| int CarlaOsc::handleMsgLv2TransferAtom(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgLv2TransferAtom(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handle_lv2_atom_transfer()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgLv2TransferAtom()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| const char* type = (const char*)&argv[0]->s; | |||||
| const char* value = (const char*)&argv[2]->s; | |||||
| const int32_t portIndex = argv[0]->i; | |||||
| const char* const atomBuf = (const char*)&argv[1]->s; | |||||
| CarlaLv2Client* const lv2client = (CarlaLv2Client*)client; | CarlaLv2Client* const lv2client = (CarlaLv2Client*)client; | ||||
| lv2client->handleTransferAtom(type, value); | |||||
| lv2client->handleTransferAtom(portIndex, atomBuf); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handleMsgLv2TransferEvent(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgLv2TransferEvent(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| { | { | ||||
| qDebug("CarlaOsc::handle_lv2_event_transfer()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | |||||
| qDebug("CarlaBridgeOsc::handleMsgLv2TransferEvent()"); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| const char* type = (const char*)&argv[0]->s; | |||||
| const char* value = (const char*)&argv[2]->s; | |||||
| const int32_t portIndex = argv[0]->i; | |||||
| const char* const atomBuf = (const char*)&argv[1]->s; | |||||
| CarlaLv2Client* const lv2client = (CarlaLv2Client*)client; | CarlaLv2Client* const lv2client = (CarlaLv2Client*)client; | ||||
| lv2client->handleTransferEvent(type, value); | |||||
| lv2client->handleTransferEvent(portIndex, atomBuf); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -93,6 +93,22 @@ | |||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| // carla_setprocname | |||||
| #ifdef Q_OS_LINUX | |||||
| # include <sys/prctl.h> | |||||
| # include <linux/prctl.h> | |||||
| static inline | |||||
| void carla_setprocname(const char* const name) | |||||
| { | |||||
| prctl(PR_SET_NAME, name); | |||||
| } | |||||
| #else | |||||
| static inline | |||||
| void carla_setprocname(const char* const /*name*/) | |||||
| { | |||||
| } | |||||
| #endif | |||||
| static inline | static inline | ||||
| const char* bool2str(bool yesno) | const char* bool2str(bool yesno) | ||||
| { | { | ||||
| @@ -282,36 +282,36 @@ void osc_send_bridge_update(const CarlaOscData* const oscData, const char* const | |||||
| #endif | #endif | ||||
| static inline | static inline | ||||
| void osc_send_lv2_transfer_atom(const CarlaOscData* const oscData, const char* const type, const char* const value) | |||||
| void osc_send_lv2_transfer_atom(const CarlaOscData* const oscData, const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| Q_ASSERT(oscData && oscData->path); | Q_ASSERT(oscData && oscData->path); | ||||
| Q_ASSERT(type); | |||||
| Q_ASSERT(value); | |||||
| qDebug("osc_send_lv2_transfer_atom(path:\"%s\", \"%s\", \"%s\")", oscData->path, type, value); | |||||
| Q_ASSERT(portIndex >= 0); | |||||
| Q_ASSERT(atomBuf); | |||||
| qDebug("osc_send_lv2_transfer_atom(path:\"%s\", %i, \"%s\")", oscData->path, portIndex, atomBuf); | |||||
| if (oscData->target) | if (oscData->target) | ||||
| { | { | ||||
| char targetPath[strlen(oscData->path)+19]; | char targetPath[strlen(oscData->path)+19]; | ||||
| strcpy(targetPath, oscData->path); | strcpy(targetPath, oscData->path); | ||||
| strcat(targetPath, "/lv2_atom_transfer"); | strcat(targetPath, "/lv2_atom_transfer"); | ||||
| lo_send(oscData->target, targetPath, "ss", type, value); | |||||
| lo_send(oscData->target, targetPath, "is", portIndex, atomBuf); | |||||
| } | } | ||||
| } | } | ||||
| static inline | static inline | ||||
| void osc_send_lv2_transfer_event(const CarlaOscData* const oscData, const char* const type, const char* const value) | |||||
| void osc_send_lv2_transfer_event(const CarlaOscData* const oscData, const int32_t portIndex, const char* const atomBuf) | |||||
| { | { | ||||
| Q_ASSERT(oscData && oscData->path); | Q_ASSERT(oscData && oscData->path); | ||||
| Q_ASSERT(type); | |||||
| Q_ASSERT(value); | |||||
| qDebug("osc_send_lv2_transfer_event(path:\"%s\", \"%s\", \"%s\")", oscData->path, type, value); | |||||
| Q_ASSERT(portIndex >= 0); | |||||
| Q_ASSERT(atomBuf); | |||||
| qDebug("osc_send_lv2_transfer_event(path:\"%s\", %i, \"%s\")", oscData->path, portIndex, atomBuf); | |||||
| if (oscData->target) | if (oscData->target) | ||||
| { | { | ||||
| char targetPath[strlen(oscData->path)+20]; | char targetPath[strlen(oscData->path)+20]; | ||||
| strcpy(targetPath, oscData->path); | strcpy(targetPath, oscData->path); | ||||
| strcat(targetPath, "/lv2_event_transfer"); | strcat(targetPath, "/lv2_event_transfer"); | ||||
| lo_send(oscData->target, targetPath, "ss", type, value); | |||||
| lo_send(oscData->target, targetPath, "is", portIndex, atomBuf); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1 @@ | |||||
| ../carla-rtmempool/ | |||||
| @@ -0,0 +1,75 @@ | |||||
| #!/usr/bin/make -f | |||||
| # Makefile for static rtmempool # | |||||
| # ----------------------------------------- # | |||||
| # Created by falkTX | |||||
| # | |||||
| CC ?= gcc | |||||
| AR ?= ar | |||||
| BUILD_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fvisibility=hidden -fPIC -mtune=generic -msse -mfpmath=sse -std=c99 -Wall $(CFLAGS) | |||||
| BUILD_FLAGS += -I../carla-includes | |||||
| 32BIT_FLAGS = -m32 | |||||
| 64BIT_FLAGS = -m64 | |||||
| OBJS = rtmempool.o | |||||
| OBJS_posix32 = rtmempool_posix32.o | |||||
| OBJS_posix64 = rtmempool_posix64.o | |||||
| OBJS_win32 = rtmempool_win32.o | |||||
| OBJS_win64 = rtmempool_win64.o | |||||
| # -------------------------------------------------------------- | |||||
| all: carla_rtmempool.a | |||||
| carla_rtmempool.a: $(OBJS) | |||||
| $(AR) rs $@ $^ | |||||
| rtmempool.o: rtmempool.c | |||||
| $(CC) $< $(BUILD_FLAGS) -c -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| posix32: carla_rtmempool_posix32.a | |||||
| carla_rtmempool_posix32.a: $(OBJS_posix32) | |||||
| $(AR) rs $@ $^ | |||||
| rtmempool_posix32.o: rtmempool.c | |||||
| $(CC) $< $(BUILD_FLAGS) $(32BIT_FLAGS) -c -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| posix64: carla_rtmempool_posix64.a | |||||
| carla_rtmempool_posix64.a: $(OBJS_posix64) | |||||
| $(AR) rs $@ $^ | |||||
| rtmempool_posix64.o: rtmempool.c | |||||
| $(CC) $< $(BUILD_FLAGS) $(64BIT_FLAGS) -c -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| win32: carla_rtmempool_win32.a | |||||
| carla_rtmempool_win32.a: $(OBJS_win32) | |||||
| $(AR) rs $@ $^ | |||||
| rtmempool_win32.o: rtmempool.c | |||||
| $(CC) $< $(BUILD_FLAGS) $(32BIT_FLAGS) -c -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| win64: carla_rtmempool_win64.a | |||||
| carla_rtmempool_win64.a: $(OBJS_win64) | |||||
| $(AR) rs $@ $^ | |||||
| rtmempool_win64.o: rtmempool.c | |||||
| $(CC) $< $(BUILD_FLAGS) $(64BIT_FLAGS) -c -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| clean: | |||||
| rm -f *.a *.o | |||||
| @@ -2021,6 +2021,7 @@ if __name__ == '__main__': | |||||
| Carla.Host = Host(libPrefix) | Carla.Host = Host(libPrefix) | ||||
| Carla.Host.set_callback_function(callback_function) | Carla.Host.set_callback_function(callback_function) | ||||
| Carla.Host.set_option(OPTION_PROCESS_NAME, 0, "carla") | |||||
| # Set available drivers | # Set available drivers | ||||
| driverCount = Carla.Host.get_engine_driver_count() | driverCount = Carla.Host.get_engine_driver_count() | ||||
| @@ -136,6 +136,7 @@ GUI_EXTERNAL_SUIL = 6 | |||||
| GUI_EXTERNAL_OSC = 7 | GUI_EXTERNAL_OSC = 7 | ||||
| # enum OptionsType | # enum OptionsType | ||||
| OPTION_PROCESS_NAME = 0 | |||||
| OPTION_PROCESS_MODE = 1 | OPTION_PROCESS_MODE = 1 | ||||
| OPTION_PROCESS_HIGH_PRECISION = 2 | OPTION_PROCESS_HIGH_PRECISION = 2 | ||||
| OPTION_MAX_PARAMETERS = 3 | OPTION_MAX_PARAMETERS = 3 | ||||