| @@ -140,7 +140,7 @@ private: | |||
| #ifdef WANT_LV2 | |||
| int handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2); | |||
| int handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2); | |||
| int handleMsgLv2UridMap(CARLA_ENGINE_OSC_HANDLE_ARGS2); | |||
| #endif | |||
| // ----------------------------------------------------------------------- | |||
| @@ -43,109 +43,101 @@ CARLA_BACKEND_START_NAMESPACE | |||
| } | |||
| #endif | |||
| /*! | |||
| * @defgroup PluginHints Plugin Hints | |||
| * @{ | |||
| */ | |||
| const unsigned int PLUGIN_HAS_EXTENSION_OPTIONS = 0x100; //!< LV2 Plugin has Options extension | |||
| const unsigned int PLUGIN_HAS_EXTENSION_PROGRAMS = 0x200; //!< LV2 Plugin has Programs extension | |||
| const unsigned int PLUGIN_HAS_EXTENSION_STATE = 0x400; //!< LV2 Plugin has State extension | |||
| const unsigned int PLUGIN_HAS_EXTENSION_WORKER = 0x800; //!< LV2 Plugin has Worker extension | |||
| /**@}*/ | |||
| /*! | |||
| * @defgroup ParameterHints Parameter Hints | |||
| * @{ | |||
| */ | |||
| const unsigned int PARAMETER_IS_STRICT_BOUNDS = 0x1000; //!< LV2 Parameter needs strict bounds | |||
| const unsigned int PARAMETER_IS_TRIGGER = 0x2000; //!< LV2 Parameter is trigger (current value should be changed to its default after run()) | |||
| /**@}*/ | |||
| const unsigned int MAX_EVENT_BUFFER = 8192; // 0x2000 | |||
| /*! | |||
| * @defgroup Lv2EventTypes LV2 Event Data/Types | |||
| * | |||
| * Data and buffer types for LV2 EventData ports. | |||
| * @{ | |||
| */ | |||
| // Extra Plugin Hints | |||
| const unsigned int PLUGIN_HAS_EXTENSION_OPTIONS = 0x1000; | |||
| const unsigned int PLUGIN_HAS_EXTENSION_PROGRAMS = 0x2000; | |||
| const unsigned int PLUGIN_HAS_EXTENSION_STATE = 0x4000; | |||
| const unsigned int PLUGIN_HAS_EXTENSION_WORKER = 0x8000; | |||
| // Extra Parameter Hints | |||
| const unsigned int PARAMETER_IS_STRICT_BOUNDS = 0x1000; | |||
| const unsigned int PARAMETER_IS_TRIGGER = 0x2000; | |||
| // LV2 Event Data/Types | |||
| const unsigned int CARLA_EVENT_DATA_ATOM = 0x01; | |||
| const unsigned int CARLA_EVENT_DATA_EVENT = 0x02; | |||
| const unsigned int CARLA_EVENT_DATA_MIDI_LL = 0x04; | |||
| const unsigned int CARLA_EVENT_TYPE_MESSAGE = 0x10; | |||
| const unsigned int CARLA_EVENT_TYPE_MESSAGE = 0x10; // unused | |||
| const unsigned int CARLA_EVENT_TYPE_MIDI = 0x20; | |||
| const unsigned int CARLA_EVENT_TYPE_TIME = 0x40; | |||
| /**@}*/ | |||
| /*! | |||
| * @defgroup Lv2UriMapIds LV2 URI Map Ids | |||
| * | |||
| * Static index list of the internal LV2 URI Map Ids. | |||
| * @{ | |||
| */ | |||
| // LV2 URI Map Ids | |||
| const uint32_t CARLA_URI_MAP_ID_NULL = 0; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_BLANK = 1; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_CHUNK = 2; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_DOUBLE = 3; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_FLOAT = 4; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_INT = 5; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PATH = 6; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_SEQUENCE = 7; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 8; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM = 9; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT = 10; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MAX_LENGTH = 11; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MIN_LENGTH = 12; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE = 13; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_ERROR = 14; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_NOTE = 15; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_TRACE = 16; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_WARNING = 17; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_POSITION = 18; // base type | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR = 19; // values | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR_BEAT = 20; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT = 21; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT_UNIT = 22; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_BAR = 23; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_MINUTE = 24; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAME = 25; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAMES_PER_SECOND = 26; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_SPEED = 27; | |||
| const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 28; | |||
| const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 29; | |||
| const uint32_t CARLA_URI_MAP_ID_COUNT = 30; | |||
| /**@}*/ | |||
| /*! | |||
| * @defgroup Lv2FeatureIds LV2 Feature Ids | |||
| * | |||
| * Static index list of the internal LV2 Feature Ids. | |||
| * @{ | |||
| */ | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_BOOL = 2; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_CHUNK = 3; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_DOUBLE = 4; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_FLOAT = 5; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_INT = 6; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_LITERAL = 7; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_LONG = 8; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PATH = 9; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PROPERTY = 10; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_RESOURCE = 11; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_SEQUENCE = 12; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 13; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TUPLE = 14; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_URI = 15; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_URID = 16; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_VECTOR = 17; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM = 18; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT = 19; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MAX_LENGTH = 20; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MIN_LENGTH = 21; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE = 22; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_ERROR = 23; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_NOTE = 24; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_TRACE = 25; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_WARNING = 26; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_POSITION = 27; // base type | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR = 28; // values | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR_BEAT = 29; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT = 30; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT_UNIT = 31; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_BAR = 32; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_MINUTE = 33; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAME = 34; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAMES_PER_SECOND = 35; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_SPEED = 36; | |||
| const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 37; | |||
| const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 38; | |||
| const uint32_t CARLA_URI_MAP_ID_COUNT = 39; | |||
| // LV2 Feature Ids | |||
| const uint32_t kFeatureIdBufSizeBounded = 0; | |||
| const uint32_t kFeatureIdBufSizeFixed = 1; | |||
| const uint32_t kFeatureIdBufSizePowerOf2 = 2; | |||
| const uint32_t kFeatureIdEvent = 3; | |||
| const uint32_t kFeatureIdLogs = 4; | |||
| const uint32_t kFeatureIdOptions = 5; | |||
| const uint32_t kFeatureIdPrograms = 6; | |||
| const uint32_t kFeatureIdRtMemPool = 7; | |||
| const uint32_t kFeatureIdStateMakePath = 8; | |||
| const uint32_t kFeatureIdStateMapPath = 9; | |||
| const uint32_t kFeatureIdStrictBounds = 10; | |||
| const uint32_t kFeatureIdUriMap = 11; | |||
| const uint32_t kFeatureIdUridMap = 12; | |||
| const uint32_t kFeatureIdUridUnmap = 13; | |||
| const uint32_t kFeatureIdWorker = 14; | |||
| const uint32_t kFeatureIdUiDataAccess = 15; | |||
| const uint32_t kFeatureIdUiInstanceAccess = 16; | |||
| const uint32_t kFeatureIdUiParent = 17; | |||
| const uint32_t kFeatureIdUiPortMap = 18; | |||
| const uint32_t kFeatureIdUiResize = 19; | |||
| const uint32_t kFeatureIdExternalUi = 20; | |||
| const uint32_t kFeatureIdExternalUiOld = 21; | |||
| const uint32_t kFeatureCount = 22; | |||
| /**@}*/ | |||
| const unsigned int MAX_EVENT_BUFFER = 8192; // 0x2000 | |||
| const uint32_t kFeatureIdHardRtCapable = 4; | |||
| const uint32_t kFeatureIdInPlaceBroken = 5; | |||
| const uint32_t kFeatureIdIsLive = 6; | |||
| const uint32_t kFeatureIdLogs = 7; | |||
| const uint32_t kFeatureIdOptions = 8; | |||
| const uint32_t kFeatureIdPrograms = 9; | |||
| const uint32_t kFeatureIdRtMemPool = 10; | |||
| const uint32_t kFeatureIdStateMakePath = 11; | |||
| const uint32_t kFeatureIdStateMapPath = 12; | |||
| const uint32_t kFeatureIdStrictBounds = 13; | |||
| const uint32_t kFeatureIdUriMap = 14; | |||
| const uint32_t kFeatureIdUridMap = 15; | |||
| const uint32_t kFeatureIdUridUnmap = 16; | |||
| const uint32_t kFeatureIdWorker = 17; | |||
| const uint32_t kFeatureIdUiDataAccess = 18; | |||
| const uint32_t kFeatureIdUiInstanceAccess = 19; | |||
| const uint32_t kFeatureIdUiIdle = 20; | |||
| const uint32_t kFeatureIdUiFixedSize = 21; | |||
| const uint32_t kFeatureIdUiMakeResident = 22; | |||
| const uint32_t kFeatureIdUiNoUserResize = 23; | |||
| const uint32_t kFeatureIdUiParent = 24; | |||
| const uint32_t kFeatureIdUiPortMap = 25; | |||
| const uint32_t kFeatureIdUiPortSubscribe = 26; | |||
| const uint32_t kFeatureIdUiResize = 27; | |||
| const uint32_t kFeatureIdUiTouch = 28; | |||
| const uint32_t kFeatureIdExternalUi = 29; | |||
| const uint32_t kFeatureIdExternalUiOld = 30; | |||
| const uint32_t kFeatureCount = 31; | |||
| enum Lv2PluginGuiType { | |||
| PLUGIN_UI_NULL, | |||
| @@ -228,7 +220,7 @@ struct Lv2EventData { | |||
| struct Lv2PluginEventData { | |||
| uint32_t count; | |||
| Lv2EventData* data; | |||
| Lv2EventData* ctrl; // default port, either \a data[x] or PluginEventData.portIn/Out | |||
| Lv2EventData* ctrl; // default port, either this->data[x] or kData->portIn/Out | |||
| uint32_t ctrlIndex; | |||
| Lv2PluginEventData() | |||
| @@ -293,30 +285,23 @@ struct Lv2PluginEventData { | |||
| }; | |||
| struct Lv2PluginOptions { | |||
| int minBufferSize; | |||
| int maxBufferSize; | |||
| int minBufferSize; | |||
| int sequenceSize; | |||
| double sampleRate; | |||
| LV2_Options_Option optMinBlockLenth; | |||
| LV2_Options_Option optMaxBlockLenth; | |||
| LV2_Options_Option optMinBlockLenth; | |||
| LV2_Options_Option optSequenceSize; | |||
| LV2_Options_Option optSampleRate; | |||
| LV2_Options_Option optNull; | |||
| LV2_Options_Option* opts[5]; | |||
| Lv2PluginOptions() | |||
| : minBufferSize(0), | |||
| maxBufferSize(0), | |||
| : maxBufferSize(0), | |||
| minBufferSize(0), | |||
| sequenceSize(MAX_EVENT_BUFFER), | |||
| sampleRate(0.0) | |||
| { | |||
| optMinBlockLenth.context = LV2_OPTIONS_INSTANCE; | |||
| optMinBlockLenth.subject = 0; | |||
| optMinBlockLenth.key = CARLA_URI_MAP_ID_BUF_MIN_LENGTH; | |||
| optMinBlockLenth.size = sizeof(int); | |||
| optMinBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optMinBlockLenth.value = &minBufferSize; | |||
| optMaxBlockLenth.context = LV2_OPTIONS_INSTANCE; | |||
| optMaxBlockLenth.subject = 0; | |||
| optMaxBlockLenth.key = CARLA_URI_MAP_ID_BUF_MAX_LENGTH; | |||
| @@ -324,6 +309,13 @@ struct Lv2PluginOptions { | |||
| optMaxBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optMaxBlockLenth.value = &maxBufferSize; | |||
| optMinBlockLenth.context = LV2_OPTIONS_INSTANCE; | |||
| optMinBlockLenth.subject = 0; | |||
| optMinBlockLenth.key = CARLA_URI_MAP_ID_BUF_MIN_LENGTH; | |||
| optMinBlockLenth.size = sizeof(int); | |||
| optMinBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optMinBlockLenth.value = &minBufferSize; | |||
| optSequenceSize.context = LV2_OPTIONS_INSTANCE; | |||
| optSequenceSize.subject = 0; | |||
| optSequenceSize.key = CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE; | |||
| @@ -355,11 +347,6 @@ struct Lv2PluginOptions { | |||
| CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(Lv2PluginOptions) | |||
| }; | |||
| LV2_Atom_Event* getLv2AtomEvent(LV2_Atom_Sequence* const atom, const uint32_t offset) | |||
| { | |||
| return (LV2_Atom_Event*)((char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atom) + offset); | |||
| } | |||
| // ----------------------------------------------------- | |||
| class Lv2Plugin : public CarlaPlugin, | |||
| @@ -386,22 +373,22 @@ public: | |||
| fCustomURIDs.append(nullptr); | |||
| fAtomForge.Blank = CARLA_URI_MAP_ID_ATOM_BLANK; | |||
| fAtomForge.Bool = carla_lv2_urid_map(this, LV2_ATOM__Bool); | |||
| fAtomForge.Bool = CARLA_URI_MAP_ID_ATOM_BOOL; | |||
| fAtomForge.Chunk = CARLA_URI_MAP_ID_ATOM_CHUNK; | |||
| fAtomForge.Double = CARLA_URI_MAP_ID_ATOM_DOUBLE; | |||
| fAtomForge.Float = CARLA_URI_MAP_ID_ATOM_FLOAT; | |||
| fAtomForge.Int = CARLA_URI_MAP_ID_ATOM_INT; | |||
| fAtomForge.Long = carla_lv2_urid_map(this, LV2_ATOM__Long); | |||
| fAtomForge.Literal = carla_lv2_urid_map(this, LV2_ATOM__Literal); | |||
| fAtomForge.Path = carla_lv2_urid_map(this, LV2_ATOM__Path); | |||
| fAtomForge.Property = carla_lv2_urid_map(this, LV2_ATOM__Property); | |||
| fAtomForge.Resource = carla_lv2_urid_map(this, LV2_ATOM__Resource); | |||
| fAtomForge.Literal = CARLA_URI_MAP_ID_ATOM_LITERAL; | |||
| fAtomForge.Long = CARLA_URI_MAP_ID_ATOM_LONG; | |||
| fAtomForge.Path = CARLA_URI_MAP_ID_ATOM_PATH; | |||
| fAtomForge.Property = CARLA_URI_MAP_ID_ATOM_PROPERTY; | |||
| fAtomForge.Resource = CARLA_URI_MAP_ID_ATOM_RESOURCE; | |||
| fAtomForge.Sequence = CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
| fAtomForge.String = CARLA_URI_MAP_ID_ATOM_STRING; | |||
| fAtomForge.Tuple = carla_lv2_urid_map(this, LV2_ATOM__Tuple); | |||
| fAtomForge.URI = carla_lv2_urid_map(this, LV2_ATOM__URI); | |||
| fAtomForge.URID = carla_lv2_urid_map(this, LV2_ATOM__URID); | |||
| fAtomForge.Vector = carla_lv2_urid_map(this, LV2_ATOM__Vector); | |||
| fAtomForge.Tuple = CARLA_URI_MAP_ID_ATOM_TUPLE; | |||
| fAtomForge.URI = CARLA_URI_MAP_ID_ATOM_URI; | |||
| fAtomForge.URID = CARLA_URI_MAP_ID_ATOM_URID; | |||
| fAtomForge.Vector = CARLA_URI_MAP_ID_ATOM_VECTOR; | |||
| } | |||
| ~Lv2Plugin() override | |||
| @@ -1254,19 +1241,7 @@ public: | |||
| if (kData->osc.data.target != nullptr) | |||
| { | |||
| QByteArray chunk((const char*)atom, lv2_atom_total_size(atom)); | |||
| const char* typeStr = carla_lv2_urid_unmap(this, atom->type); | |||
| const char* bodyStr = ""; | |||
| if (atom->type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
| { | |||
| const LV2_Atom_Object* const obj((const LV2_Atom_Object*)atom); | |||
| if (obj->body.otype != CARLA_URI_MAP_ID_NULL) | |||
| bodyStr = carla_lv2_urid_unmap(this, obj->body.otype); | |||
| } | |||
| osc_send_lv2_transfer_event(&kData->osc.data, portIndex, typeStr, bodyStr, chunk.toBase64().constData()); | |||
| osc_send_lv2_atom_transfer(&kData->osc.data, portIndex, chunk.toBase64().constData()); | |||
| } | |||
| } | |||
| else if (fUi.type != PLUGIN_UI_NULL) | |||
| @@ -3510,7 +3485,12 @@ protected: | |||
| fCustomURIDs.append(carla_strdup(uri)); | |||
| return fCustomURIDs.count()-1; | |||
| const LV2_URID urid(fCustomURIDs.count()-1); | |||
| if (fUi.type == PLUGIN_UI_OSC && kData->osc.data.target != nullptr) | |||
| osc_send_lv2_urid_map(&kData->osc.data, urid, uri); | |||
| return urid; | |||
| } | |||
| const char* getCustomURIString(const LV2_URID urid) | |||
| @@ -3805,7 +3785,7 @@ protected: | |||
| } | |||
| } | |||
| } | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM || format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
| { | |||
| CARLA_ASSERT(buffer != nullptr); | |||
| @@ -3814,18 +3794,6 @@ protected: | |||
| fAtomQueueIn.put(rindex, (const LV2_Atom*)buffer); | |||
| } | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
| { | |||
| CARLA_ASSERT(buffer != nullptr); | |||
| if (buffer == nullptr) | |||
| return; | |||
| fAtomQueueIn.put(rindex, (const LV2_Atom*)buffer); | |||
| const LV2_Atom* atom((const LV2_Atom*)buffer); | |||
| carla_stdout("UI WRITE DATA: %i | size:%i, realSize:%i, type:\"%s\"", rindex, atom->size, lv2_atom_total_size(atom), carla_lv2_urid_unmap(this, atom->type)); | |||
| } | |||
| else | |||
| { | |||
| carla_stdout("Lv2Plugin::handleUiWrite(%i, %i, %i:\"%s\", %p) - unknown format", rindex, bufferSize, format, carla_lv2_urid_unmap(this, format), buffer); | |||
| @@ -4665,39 +4633,26 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| void handleTransferAtom(const int32_t portIndex, const char* const typeStr, LV2_Atom* const atom) | |||
| void handleTransferAtom(const uint32_t portIndex, const LV2_Atom* const atom) | |||
| { | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(atom != nullptr); | |||
| CARLA_ASSERT(typeStr != nullptr); | |||
| carla_debug("Lv2Plugin::handleTransferAtom(%i, \"%s\", %p)", portIndex, typeStr, atom); | |||
| atom->type = carla_lv2_urid_map(this, typeStr); | |||
| carla_debug("Lv2Plugin::handleTransferAtom(%i, %p)", portIndex, atom); | |||
| fAtomQueueIn.put(portIndex, atom); | |||
| } | |||
| void handleTransferEvent(const int32_t portIndex, const char* const typeStr, const char* const bodyStr, LV2_Atom* const atom) | |||
| void handleUridMap(const LV2_URID urid, const char* const uri) | |||
| { | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(typeStr != nullptr); | |||
| CARLA_ASSERT(bodyStr != nullptr); | |||
| CARLA_ASSERT(atom != nullptr); | |||
| carla_debug("Lv2Plugin::handleTransferEvent(%i, \"%s\", \"%s\", %p)", portIndex, typeStr, bodyStr, atom); | |||
| atom->type = carla_lv2_urid_map(this, typeStr); | |||
| if (atom->type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
| { | |||
| LV2_Atom_Object* const obj((LV2_Atom_Object*)atom); | |||
| CARLA_ASSERT(urid != CARLA_URI_MAP_ID_NULL); | |||
| CARLA_ASSERT(uri != nullptr); | |||
| carla_debug("Lv2Plugin::handleUridMap(%i, \"%s\")", urid, uri); | |||
| if (obj->body.otype != CARLA_URI_MAP_ID_NULL) | |||
| obj->body.otype = carla_lv2_urid_map(this, bodyStr); | |||
| } | |||
| CARLA_SAFE_ASSERT_INT2(urid == fCustomURIDs.count(), urid, fCustomURIDs.count()); | |||
| carla_stdout("FROM OSC UI WRITE DATA: %i | size:%i, realSize:%i, type:\"%s\"", portIndex, atom->size, lv2_atom_total_size(atom), carla_lv2_urid_unmap(this, atom->type)); | |||
| if (urid != fCustomURIDs.count()) | |||
| return; | |||
| fAtomQueueIn.put(portIndex, atom); | |||
| fCustomURIDs.append(carla_strdup(uri)); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -5229,36 +5184,35 @@ private: | |||
| int CarlaEngineOsc::handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2) | |||
| { | |||
| CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaOsc::handleMsgLv2AtomTransfer()"); | |||
| CARLA_ENGINE_OSC_CHECK_OSC_TYPES(3, "iss"); | |||
| const int32_t portIndex = argv[0]->i; | |||
| const char* const typeStr = (const char*)&argv[1]->s; | |||
| const char* const atomBuf = (const char*)&argv[2]->s; | |||
| const char* const atomBuf = (const char*)&argv[1]->s; | |||
| if (portIndex < 0) | |||
| return 0; | |||
| QByteArray chunk; | |||
| chunk = QByteArray::fromBase64(atomBuf); | |||
| LV2_Atom* const atom = (LV2_Atom*)chunk.data(); | |||
| lv2PluginPtr->handleTransferAtom(portIndex, typeStr, atom); | |||
| lv2PluginPtr->handleTransferAtom(portIndex, atom); | |||
| return 0; | |||
| } | |||
| int CarlaEngineOsc::handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2) | |||
| int CarlaEngineOsc::handleMsgLv2UridMap(CARLA_ENGINE_OSC_HANDLE_ARGS2) | |||
| { | |||
| CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaOsc::handleMsgLv2EventTransfer()"); | |||
| CARLA_ENGINE_OSC_CHECK_OSC_TYPES(4, "isss"); | |||
| const int32_t portIndex = argv[0]->i; | |||
| const char* const typeStr = (const char*)&argv[1]->s; | |||
| const char* const bodyStr = (const char*)&argv[2]->s; | |||
| const char* const atomBuf = (const char*)&argv[3]->s; | |||
| const int32_t urid = argv[0]->i; | |||
| const char* const uri = (const char*)&argv[1]->s; | |||
| QByteArray chunk; | |||
| chunk = QByteArray::fromBase64(atomBuf); | |||
| if (urid <= 0) | |||
| return 0; | |||
| LV2_Atom* const atom = (LV2_Atom*)chunk.data(); | |||
| lv2PluginPtr->handleTransferEvent(portIndex, typeStr, bodyStr, atom); | |||
| lv2PluginPtr->handleUridMap(urid, uri); | |||
| return 0; | |||
| } | |||
| @@ -28,9 +28,7 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| // forward declarations of commonly used Carla-Bridge classes | |||
| class CarlaBridgeClient; | |||
| #ifdef BUILD_BRIDGE_UI | |||
| class CarlaBridgeToolkit; | |||
| #endif | |||
| CARLA_BRIDGE_END_NAMESPACE | |||
| @@ -29,26 +29,17 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | |||
| : kOsc(this), | |||
| #ifdef BUILD_BRIDGE_UI | |||
| kUiToolkit(CarlaBridgeToolkit::createNew(this, uiTitle)), | |||
| fUiFilename(nullptr), | |||
| fUiLib(nullptr), | |||
| fUiQuit(false), | |||
| fUI(CarlaBridgeToolkit::createNew(this, uiTitle)), | |||
| #endif | |||
| fOscData(nullptr) | |||
| { | |||
| CARLA_ASSERT(uiTitle != nullptr); | |||
| carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | |||
| } | |||
| CarlaBridgeClient::~CarlaBridgeClient() | |||
| { | |||
| carla_debug("CarlaBridgeClient::~CarlaBridgeClient()"); | |||
| #ifdef BUILD_BRIDGE_UI | |||
| if (fUiFilename != nullptr) | |||
| delete[] fUiFilename; | |||
| delete kUiToolkit; | |||
| #endif | |||
| } | |||
| #ifdef BUILD_BRIDGE_UI | |||
| @@ -66,8 +57,7 @@ bool CarlaBridgeClient::uiInit(const char* const, const char* const) | |||
| initiated = true; | |||
| } | |||
| fUiQuit = false; | |||
| kUiToolkit->init(); | |||
| fUI.init(); | |||
| return false; | |||
| } | |||
| @@ -76,15 +66,10 @@ void CarlaBridgeClient::uiClose() | |||
| { | |||
| carla_debug("CarlaBridgeClient::uiClose()"); | |||
| if (! fUiQuit) | |||
| { | |||
| fUiQuit = true; | |||
| if (isOscControlRegistered() && ! fUI.quit) | |||
| sendOscExiting(); | |||
| if (isOscControlRegistered()) | |||
| sendOscExiting(); | |||
| } | |||
| kUiToolkit->quit(); | |||
| fUI.close(); | |||
| } | |||
| #endif | |||
| @@ -104,7 +89,7 @@ bool CarlaBridgeClient::oscIdle() | |||
| kOsc.idle(); | |||
| #ifdef BUILD_BRIDGE_UI | |||
| return ! fUiQuit; | |||
| return ! fUI.quit; | |||
| #else | |||
| return true; | |||
| #endif | |||
| @@ -112,11 +97,11 @@ bool CarlaBridgeClient::oscIdle() | |||
| void CarlaBridgeClient::oscClose() | |||
| { | |||
| carla_debug("CarlaBridgeClient::oscClose()"); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::oscClose()"); | |||
| kOsc.close(); | |||
| fOscData = nullptr; | |||
| kOsc.close(); | |||
| } | |||
| bool CarlaBridgeClient::isOscControlRegistered() const | |||
| @@ -126,8 +111,8 @@ bool CarlaBridgeClient::isOscControlRegistered() const | |||
| void CarlaBridgeClient::sendOscUpdate() | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscUpdate()"); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscUpdate()"); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_update(fOscData, kOsc.getServerPath()); | |||
| @@ -136,9 +121,9 @@ void CarlaBridgeClient::sendOscUpdate() | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| void CarlaBridgeClient::sendOscBridgeUpdate() | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscBridgeUpdate()"); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| CARLA_ASSERT(fOscData->target != nullptr && fOscData->path != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscBridgeUpdate()"); | |||
| if (fOscData != nullptr && fOscData->target != nullptr && fOscData->path != nullptr) | |||
| osc_send_bridge_update(fOscData, fOscData->path); | |||
| @@ -146,9 +131,9 @@ void CarlaBridgeClient::sendOscBridgeUpdate() | |||
| void CarlaBridgeClient::sendOscBridgeError(const char* const error) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| CARLA_ASSERT(error != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | |||
| if (fOscData != nullptr && fOscData->target != nullptr && error != nullptr) | |||
| osc_send_bridge_error(fOscData, error); | |||
| @@ -163,36 +148,35 @@ void CarlaBridgeClient::toolkitShow() | |||
| { | |||
| carla_debug("CarlaBridgeClient::toolkitShow()"); | |||
| kUiToolkit->show(); | |||
| fUI.toolkit->show(); | |||
| } | |||
| void CarlaBridgeClient::toolkitHide() | |||
| { | |||
| carla_debug("CarlaBridgeClient::toolkitHide()"); | |||
| kUiToolkit->hide(); | |||
| fUI.toolkit->hide(); | |||
| } | |||
| void CarlaBridgeClient::toolkitResize(const int width, const int height) | |||
| { | |||
| carla_debug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); | |||
| kUiToolkit->resize(width, height); | |||
| fUI.toolkit->resize(width, height); | |||
| } | |||
| void CarlaBridgeClient::toolkitExec(const bool showGui) | |||
| { | |||
| carla_debug("CarlaBridgeClient::toolkitExec(%s)", bool2str(showGui)); | |||
| kUiToolkit->exec(showGui); | |||
| fUI.toolkit->exec(showGui); | |||
| } | |||
| void CarlaBridgeClient::toolkitQuit() | |||
| { | |||
| carla_debug("CarlaBridgeClient::toolkitQuit()"); | |||
| fUiQuit = true; | |||
| kUiToolkit->quit(); | |||
| fUI.close(); | |||
| } | |||
| #endif | |||
| @@ -200,8 +184,8 @@ void CarlaBridgeClient::toolkitQuit() | |||
| void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_configure(fOscData, key, value); | |||
| @@ -209,8 +193,8 @@ void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* cons | |||
| void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_control(fOscData, index, value); | |||
| @@ -218,28 +202,26 @@ void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||
| void CarlaBridgeClient::sendOscProgram(const int32_t index) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_program(fOscData, index); | |||
| } | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_midi_program(fOscData, index); | |||
| } | |||
| #endif | |||
| void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_midi(fOscData, midiBuf); | |||
| @@ -247,30 +229,30 @@ void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||
| void CarlaBridgeClient::sendOscExiting() | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscExiting()"); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscExiting()"); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_exiting(fOscData); | |||
| } | |||
| #ifdef BRIDGE_LV2 | |||
| void CarlaBridgeClient::sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
| void CarlaBridgeClient::sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_lv2_transfer_atom(fOscData, portIndex, typeStr, atomBuf); | |||
| osc_send_lv2_atom_transfer(fOscData, portIndex, atomBuf); | |||
| } | |||
| void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const bodyStr, const char* const atomBuf) | |||
| void CarlaBridgeClient::sendOscLv2UridMap(const uint32_t urid, const char* const uri) | |||
| { | |||
| carla_debug("CarlaBridgeClient::sendOscLv2TransferEvent(%i, \"%s\", \"%s\", \"%s\")", portIndex, typeStr, bodyStr, atomBuf); | |||
| CARLA_ASSERT(fOscData != nullptr); | |||
| carla_debug("CarlaBridgeClient::sendOscLv2UridMap(%i, \"%s\")", urid, uri); | |||
| if (fOscData != nullptr && fOscData->target != nullptr) | |||
| osc_send_lv2_transfer_event(fOscData, portIndex, typeStr, bodyStr, atomBuf); | |||
| osc_send_lv2_urid_map(fOscData, urid, uri); | |||
| } | |||
| #endif | |||
| @@ -279,50 +261,45 @@ void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const c | |||
| #ifdef BUILD_BRIDGE_UI | |||
| void* CarlaBridgeClient::getContainerId() | |||
| { | |||
| return kUiToolkit->getContainerId(); | |||
| return fUI.toolkit->getContainerId(); | |||
| } | |||
| bool CarlaBridgeClient::uiLibOpen(const char* const filename) | |||
| { | |||
| CARLA_ASSERT(fUiLib == nullptr); | |||
| CARLA_ASSERT(fUiFilename == nullptr); | |||
| CARLA_ASSERT(fUI.lib == nullptr); | |||
| CARLA_ASSERT(filename != nullptr); | |||
| if (fUiFilename != nullptr) | |||
| delete[] fUiFilename; | |||
| fUI.lib = lib_open(filename); | |||
| fUI.filename = filename; | |||
| fUiLib = lib_open(filename); | |||
| fUiFilename = carla_strdup(filename ? filename : ""); | |||
| return (fUiLib != nullptr); | |||
| return (fUI.lib != nullptr); | |||
| } | |||
| bool CarlaBridgeClient::uiLibClose() | |||
| { | |||
| CARLA_ASSERT(fUiLib != nullptr); | |||
| CARLA_ASSERT(fUI.lib != nullptr); | |||
| if (fUiLib != nullptr) | |||
| { | |||
| const bool closed = lib_close(fUiLib); | |||
| fUiLib = nullptr; | |||
| return closed; | |||
| } | |||
| if (fUI.lib == nullptr) | |||
| return false; | |||
| return false; | |||
| const bool closed = lib_close(fUI.lib); | |||
| fUI.lib = nullptr; | |||
| return closed; | |||
| } | |||
| void* CarlaBridgeClient::uiLibSymbol(const char* const symbol) | |||
| { | |||
| CARLA_ASSERT(fUiLib != nullptr); | |||
| CARLA_ASSERT(fUI.lib != nullptr); | |||
| if (fUiLib != nullptr) | |||
| return lib_symbol(fUiLib, symbol); | |||
| if (fUI.lib == nullptr) | |||
| return nullptr; | |||
| return nullptr; | |||
| return lib_symbol(fUI.lib, symbol); | |||
| } | |||
| const char* CarlaBridgeClient::uiLibError() | |||
| { | |||
| return lib_error(fUiFilename); | |||
| return lib_error(fUI.filename); | |||
| } | |||
| #endif | |||
| @@ -19,6 +19,7 @@ | |||
| #define __CARLA_BRIDGE_CLIENT_HPP__ | |||
| #include "CarlaBridgeOsc.hpp" | |||
| #include "CarlaBridgeToolkit.hpp" | |||
| CARLA_BRIDGE_START_NAMESPACE | |||
| @@ -107,15 +108,13 @@ protected: | |||
| void sendOscConfigure(const char* const key, const char* const value); | |||
| void sendOscControl(const int32_t index, const float value); | |||
| void sendOscProgram(const int32_t index); | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| void sendOscMidiProgram(const int32_t index); | |||
| #endif | |||
| void sendOscMidi(const uint8_t midiBuf[4]); | |||
| void sendOscExiting(); | |||
| #ifdef BRIDGE_LV2 | |||
| void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf); | |||
| void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const bodyStr, const char* const atomBuf); | |||
| void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf); | |||
| void sendOscLv2UridMap(const uint32_t urid, const char* const uri); | |||
| #endif | |||
| // --------------------------------------------------------------------- | |||
| @@ -134,11 +133,35 @@ private: | |||
| CarlaBridgeOsc kOsc; | |||
| #ifdef BUILD_BRIDGE_UI | |||
| CarlaBridgeToolkit* const kUiToolkit; | |||
| const char* fUiFilename; | |||
| void* fUiLib; | |||
| bool fUiQuit; | |||
| struct UI { | |||
| CarlaBridgeToolkit* const toolkit; | |||
| CarlaString filename; | |||
| void* lib; | |||
| bool quit; | |||
| UI(CarlaBridgeToolkit* const toolkit_) | |||
| : toolkit(toolkit_), | |||
| lib(nullptr), | |||
| quit(false) {} | |||
| ~UI() | |||
| { | |||
| delete toolkit; | |||
| } | |||
| void init() | |||
| { | |||
| toolkit->init(); | |||
| quit = false; | |||
| } | |||
| void close() | |||
| { | |||
| quit = true; | |||
| toolkit->quit(); | |||
| } | |||
| } fUI; | |||
| #else | |||
| friend class CarlaPluginClient; | |||
| #endif | |||
| @@ -29,25 +29,25 @@ CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client) | |||
| : kClient(client), | |||
| fServer(nullptr) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); | |||
| CARLA_ASSERT(client != nullptr); | |||
| carla_debug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); | |||
| } | |||
| CarlaBridgeOsc::~CarlaBridgeOsc() | |||
| { | |||
| carla_debug("CarlaBridgeOsc::~CarlaBridgeOsc()"); | |||
| CARLA_ASSERT(fName.isEmpty()); | |||
| CARLA_ASSERT(fServerPath.isEmpty()); | |||
| CARLA_ASSERT(fServer == nullptr); | |||
| carla_debug("CarlaBridgeOsc::~CarlaBridgeOsc()"); | |||
| } | |||
| void CarlaBridgeOsc::init(const char* const url) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::init(\"%s\")", url); | |||
| CARLA_ASSERT(fName.isEmpty()); | |||
| CARLA_ASSERT(fServerPath.isEmpty()); | |||
| CARLA_ASSERT(fServer == nullptr); | |||
| CARLA_ASSERT(url != nullptr); | |||
| carla_debug("CarlaBridgeOsc::init(\"%s\")", url); | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| fName = "carla-bridge-plugin"; | |||
| @@ -94,10 +94,10 @@ void CarlaBridgeOsc::idle() | |||
| void CarlaBridgeOsc::close() | |||
| { | |||
| carla_debug("CarlaBridgeOsc::close()"); | |||
| CARLA_ASSERT(fName.isNotEmpty()); | |||
| CARLA_ASSERT(fServerPath.isNotEmpty()); | |||
| CARLA_ASSERT(fServer != nullptr); | |||
| carla_debug("CarlaBridgeOsc::close()"); | |||
| fName.clear(); | |||
| @@ -120,11 +120,11 @@ void CarlaBridgeOsc::close() | |||
| int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||
| CARLA_ASSERT(fName.isNotEmpty()); | |||
| CARLA_ASSERT(fServerPath.isNotEmpty()); | |||
| CARLA_ASSERT(fServer != nullptr); | |||
| CARLA_ASSERT(path != nullptr); | |||
| carla_debug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||
| if (path == nullptr) | |||
| { | |||
| @@ -182,9 +182,9 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
| #ifdef BRIDGE_LV2 | |||
| // LV2 UI methods | |||
| if (std::strcmp(method, "lv2_atom_transfer") == 0) | |||
| return handleMsgLv2TransferAtom(argc, argv, types); | |||
| if (std::strcmp(method, "lv2_event_transfer") == 0) | |||
| return handleMsgLv2TransferEvent(argc, argv, types); | |||
| return handleMsgLv2AtomTransfer(argc, argv, types); | |||
| if (std::strcmp(method, "lv2_urid_map") == 0) | |||
| return handleMsgLv2UridMap(argc, argv, types); | |||
| #endif | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| @@ -210,9 +210,9 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
| int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgConfigure()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgConfigure()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -226,9 +226,9 @@ int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgControl()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgControl()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -249,9 +249,9 @@ int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| #ifndef BUILD_BRIDGE_PLUGIN | |||
| int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgProgram()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgProgram()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -270,9 +270,9 @@ int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgMidiProgram()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgMidiProgram()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -295,9 +295,9 @@ int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgMidi()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "m"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgMidi()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -344,8 +344,8 @@ int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| #ifdef BUILD_BRIDGE_UI | |||
| int CarlaBridgeOsc::handleMsgShow() | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgShow()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| carla_debug("CarlaBridgeOsc::handleMsgShow()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -357,8 +357,8 @@ int CarlaBridgeOsc::handleMsgShow() | |||
| int CarlaBridgeOsc::handleMsgHide() | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgHide()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| carla_debug("CarlaBridgeOsc::handleMsgHide()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -370,8 +370,8 @@ int CarlaBridgeOsc::handleMsgHide() | |||
| int CarlaBridgeOsc::handleMsgQuit() | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgQuit()"); | |||
| CARLA_ASSERT(kClient != nullptr); | |||
| carla_debug("CarlaBridgeOsc::handleMsgQuit()"); | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| @@ -25,27 +25,27 @@ | |||
| #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) \ | |||
| /* check argument count */ \ | |||
| if (argc != argcToCompare) \ | |||
| { \ | |||
| #define CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ | |||
| /* check argument count */ \ | |||
| if (argc != argcToCompare) \ | |||
| { \ | |||
| carla_stderr("CarlaBridgeOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | |||
| return 1; \ | |||
| } \ | |||
| if (argc > 0) \ | |||
| { \ | |||
| /* check for nullness */ \ | |||
| if (! (types && typesToCompare)) \ | |||
| { \ | |||
| return 1; \ | |||
| } \ | |||
| if (argc > 0) \ | |||
| { \ | |||
| /* check for nullness */ \ | |||
| if (types == nullptr || typesToCompare == nullptr) \ | |||
| { \ | |||
| carla_stderr("CarlaBridgeOsc::%s() - argument types are null", __FUNCTION__); \ | |||
| return 1; \ | |||
| } \ | |||
| /* check argument types */ \ | |||
| if (std::strcmp(types, typesToCompare) != 0) \ | |||
| { \ | |||
| return 1; \ | |||
| } \ | |||
| /* check argument types */ \ | |||
| if (std::strcmp(types, typesToCompare) != 0) \ | |||
| { \ | |||
| carla_stderr("CarlaBridgeOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | |||
| return 1; \ | |||
| } \ | |||
| return 1; \ | |||
| } \ | |||
| } | |||
| CARLA_BRIDGE_START_NAMESPACE | |||
| @@ -109,8 +109,8 @@ private: | |||
| int handleMsgQuit(); | |||
| #ifdef BRIDGE_LV2 | |||
| int handleMsgLv2TransferAtom(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
| int handleMsgLv2TransferEvent(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
| int handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
| int handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
| #endif | |||
| #ifdef BUILD_BRIDGE_PLUGIN | |||
| @@ -24,9 +24,9 @@ CarlaBridgeToolkit::CarlaBridgeToolkit(CarlaBridgeClient* const client, const ch | |||
| : kClient(client), | |||
| kUiTitle(carla_strdup((uiTitle != nullptr) ? uiTitle : "(null)")) | |||
| { | |||
| carla_debug("CarlaBridgeToolkit::CarlaBridgeToolkit(%p, \"%s\")", client, uiTitle); | |||
| CARLA_ASSERT(client != nullptr); | |||
| CARLA_ASSERT(uiTitle != nullptr); | |||
| carla_debug("CarlaBridgeToolkit::CarlaBridgeToolkit(%p, \"%s\")", client, uiTitle); | |||
| } | |||
| CarlaBridgeToolkit::~CarlaBridgeToolkit() | |||
| @@ -19,6 +19,7 @@ | |||
| #define __CARLA_BRIDGE_TOOLKIT_HPP__ | |||
| #include "CarlaBridge.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| CARLA_BRIDGE_START_NAMESPACE | |||
| @@ -53,7 +54,9 @@ public: | |||
| protected: | |||
| CarlaBridgeClient* const kClient; | |||
| const char* kUiTitle; | |||
| const char* const kUiTitle; | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkit) | |||
| }; | |||
| /**@}*/ | |||
| @@ -17,6 +17,7 @@ | |||
| #include "CarlaBridgeClient.hpp" | |||
| #include "CarlaBridgeToolkit.hpp" | |||
| #include "CarlaStyle.hpp" | |||
| #include <QtCore/QSettings> | |||
| #include <QtCore/QThread> | |||
| @@ -110,6 +111,24 @@ public: | |||
| app = new QApplication(qargc, qargv); | |||
| { | |||
| QSettings settings("falkTX", "Carla"); | |||
| if (settings.value("Main/UseProTheme", true).toBool()) | |||
| { | |||
| CarlaStyle* const style(new CarlaStyle()); | |||
| app->setStyle(style); | |||
| style->ready(app); | |||
| QString color(settings.value("Main/ProThemeColor", "Black").toString()); | |||
| if (color == "System") | |||
| pass(); //style->setColorScheme(CarlaStyle::COLOR_SYSTEM); | |||
| else | |||
| style->setColorScheme(CarlaStyle::COLOR_BLACK); | |||
| } | |||
| } | |||
| window = new QMainWindow(nullptr); | |||
| window->resize(30, 30); | |||
| window->hide(); | |||
| @@ -18,13 +18,16 @@ | |||
| #include "CarlaBridgeClient.hpp" | |||
| #include "CarlaLv2Utils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include "RtList.hpp" | |||
| #include <QtCore/QDir> | |||
| extern "C" { | |||
| #include "rtmempool/rtmempool-lv2.h" | |||
| } | |||
| #include <vector> | |||
| #include <QtCore/QDir> | |||
| // ----------------------------------------------------- | |||
| // Our LV2 World class object | |||
| Lv2WorldClass gLv2World; | |||
| @@ -33,74 +36,154 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| // ------------------------------------------------------------------------- | |||
| // fake values | |||
| uint32_t bufferSize = 512; | |||
| double sampleRate = 44100.0; | |||
| static uint32_t gBufferSize = 1024; | |||
| static double gSampleRate = 44100.0; | |||
| // static max values | |||
| const unsigned int MAX_EVENT_BUFFER = 8192; // 0x2000 | |||
| // feature ids | |||
| const uint32_t lv2_feature_id_bufsize_bounded = 0; | |||
| const uint32_t lv2_feature_id_bufsize_fixed = 1; | |||
| const uint32_t lv2_feature_id_bufsize_powerof2 = 2; | |||
| const uint32_t lv2_feature_id_event = 3; | |||
| const uint32_t lv2_feature_id_logs = 4; | |||
| const uint32_t lv2_feature_id_options = 5; | |||
| const uint32_t lv2_feature_id_programs = 6; | |||
| const uint32_t lv2_feature_id_rtmempool = 7; | |||
| const uint32_t lv2_feature_id_state_make_path = 8; | |||
| const uint32_t lv2_feature_id_state_map_path = 9; | |||
| const uint32_t lv2_feature_id_strict_bounds = 10; | |||
| const uint32_t lv2_feature_id_uri_map = 11; | |||
| const uint32_t lv2_feature_id_urid_map = 12; | |||
| const uint32_t lv2_feature_id_urid_unmap = 13; | |||
| const uint32_t lv2_feature_id_ui_parent = 14; | |||
| const uint32_t lv2_feature_id_ui_port_map = 15; | |||
| const uint32_t lv2_feature_id_ui_resize = 16; | |||
| const uint32_t lv2_feature_count = 17; | |||
| // pre-set uri[d] map ids | |||
| const uint32_t CARLA_URI_MAP_ID_NULL = 0; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_BLANK = 1; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_CHUNK = 2; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_DOUBLE = 3; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_INT = 4; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PATH = 5; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_SEQUENCE = 6; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 7; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_WORKER = 8; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM = 9; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT = 10; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MAX_LENGTH = 11; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MIN_LENGTH = 12; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE = 13; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_ERROR = 14; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_NOTE = 15; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_TRACE = 16; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_WARNING = 17; | |||
| const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 18; | |||
| const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 19; | |||
| const uint32_t CARLA_URI_MAP_ID_COUNT = 20; | |||
| // LV2 URI Map Ids | |||
| const uint32_t CARLA_URI_MAP_ID_NULL = 0; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_BLANK = 1; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_BOOL = 2; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_CHUNK = 3; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_DOUBLE = 4; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_FLOAT = 5; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_INT = 6; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_LITERAL = 7; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_LONG = 8; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PATH = 9; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_PROPERTY = 10; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_RESOURCE = 11; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_SEQUENCE = 12; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 13; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TUPLE = 14; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_URI = 15; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_URID = 16; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_VECTOR = 17; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM = 18; | |||
| const uint32_t CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT = 19; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MAX_LENGTH = 20; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_MIN_LENGTH = 21; | |||
| const uint32_t CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE = 22; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_ERROR = 23; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_NOTE = 24; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_TRACE = 25; | |||
| const uint32_t CARLA_URI_MAP_ID_LOG_WARNING = 26; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_POSITION = 27; // base type | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR = 28; // values | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BAR_BEAT = 29; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT = 30; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEAT_UNIT = 31; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_BAR = 32; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_BEATS_PER_MINUTE = 33; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAME = 34; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_FRAMES_PER_SECOND = 35; | |||
| const uint32_t CARLA_URI_MAP_ID_TIME_SPEED = 36; | |||
| const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 37; | |||
| const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 38; | |||
| const uint32_t CARLA_URI_MAP_ID_COUNT = 39; | |||
| // LV2 Feature Ids | |||
| const uint32_t kFeatureIdBufSizeBounded = 0; | |||
| const uint32_t kFeatureIdBufSizeFixed = 1; | |||
| const uint32_t kFeatureIdBufSizePowerOf2 = 2; | |||
| const uint32_t kFeatureIdEvent = 3; | |||
| const uint32_t kFeatureIdHardRtCapable = 4; | |||
| const uint32_t kFeatureIdInPlaceBroken = 5; | |||
| const uint32_t kFeatureIdIsLive = 6; | |||
| const uint32_t kFeatureIdLogs = 7; | |||
| const uint32_t kFeatureIdOptions = 8; | |||
| const uint32_t kFeatureIdPrograms = 9; | |||
| const uint32_t kFeatureIdRtMemPool = 10; | |||
| const uint32_t kFeatureIdStateMakePath = 11; | |||
| const uint32_t kFeatureIdStateMapPath = 12; | |||
| const uint32_t kFeatureIdStrictBounds = 13; | |||
| const uint32_t kFeatureIdUriMap = 14; | |||
| const uint32_t kFeatureIdUridMap = 15; | |||
| const uint32_t kFeatureIdUridUnmap = 16; | |||
| const uint32_t kFeatureIdWorker = 17; | |||
| const uint32_t kFeatureIdUiDataAccess = 18; | |||
| const uint32_t kFeatureIdUiInstanceAccess = 19; | |||
| const uint32_t kFeatureIdUiIdle = 20; | |||
| const uint32_t kFeatureIdUiFixedSize = 21; | |||
| const uint32_t kFeatureIdUiMakeResident = 22; | |||
| const uint32_t kFeatureIdUiNoUserResize = 23; | |||
| const uint32_t kFeatureIdUiParent = 24; | |||
| const uint32_t kFeatureIdUiPortMap = 25; | |||
| const uint32_t kFeatureIdUiPortSubscribe = 26; | |||
| const uint32_t kFeatureIdUiResize = 27; | |||
| const uint32_t kFeatureIdUiTouch = 28; | |||
| const uint32_t kFeatureIdExternalUi = 29; | |||
| const uint32_t kFeatureIdExternalUiOld = 30; | |||
| const uint32_t kFeatureCount = 31; | |||
| // ------------------------------------------------------------------------- | |||
| struct Lv2PluginOptions { | |||
| uint32_t eventSize; | |||
| uint32_t bufferSize; | |||
| double sampleRate; | |||
| LV2_Options_Option oNull; | |||
| LV2_Options_Option oMaxBlockLenth; | |||
| LV2_Options_Option oMinBlockLenth; | |||
| LV2_Options_Option oSequenceSize; | |||
| LV2_Options_Option oSampleRate; | |||
| int maxBufferSize; | |||
| int minBufferSize; | |||
| int sequenceSize; | |||
| double sampleRate; | |||
| LV2_Options_Option optMaxBlockLenth; | |||
| LV2_Options_Option optMinBlockLenth; | |||
| LV2_Options_Option optSequenceSize; | |||
| LV2_Options_Option optSampleRate; | |||
| LV2_Options_Option optNull; | |||
| LV2_Options_Option* opts[5]; | |||
| Lv2PluginOptions() | |||
| : eventSize(MAX_EVENT_BUFFER), | |||
| bufferSize(0), | |||
| sampleRate(0.0) {} | |||
| : maxBufferSize(0), | |||
| minBufferSize(0), | |||
| sequenceSize(MAX_EVENT_BUFFER), | |||
| sampleRate(0.0) | |||
| { | |||
| optMaxBlockLenth.context = LV2_OPTIONS_INSTANCE; | |||
| optMaxBlockLenth.subject = 0; | |||
| optMaxBlockLenth.key = CARLA_URI_MAP_ID_BUF_MAX_LENGTH; | |||
| optMaxBlockLenth.size = sizeof(int); | |||
| optMaxBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optMaxBlockLenth.value = &maxBufferSize; | |||
| optMinBlockLenth.context = LV2_OPTIONS_INSTANCE; | |||
| optMinBlockLenth.subject = 0; | |||
| optMinBlockLenth.key = CARLA_URI_MAP_ID_BUF_MIN_LENGTH; | |||
| optMinBlockLenth.size = sizeof(int); | |||
| optMinBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optMinBlockLenth.value = &minBufferSize; | |||
| optSequenceSize.context = LV2_OPTIONS_INSTANCE; | |||
| optSequenceSize.subject = 0; | |||
| optSequenceSize.key = CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE; | |||
| optSequenceSize.size = sizeof(int); | |||
| optSequenceSize.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| optSequenceSize.value = &sequenceSize; | |||
| optSampleRate.context = LV2_OPTIONS_INSTANCE; | |||
| optSampleRate.subject = 0; | |||
| optSampleRate.key = CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE; | |||
| optSampleRate.size = sizeof(double); | |||
| optSampleRate.type = CARLA_URI_MAP_ID_ATOM_DOUBLE; | |||
| optSampleRate.value = &sampleRate; | |||
| optNull.context = LV2_OPTIONS_INSTANCE; | |||
| optNull.subject = 0; | |||
| optNull.key = CARLA_URI_MAP_ID_NULL; | |||
| optNull.size = 0; | |||
| optNull.type = CARLA_URI_MAP_ID_NULL; | |||
| optNull.value = nullptr; | |||
| opts[0] = &optMinBlockLenth; | |||
| opts[1] = &optMaxBlockLenth; | |||
| opts[2] = &optSequenceSize; | |||
| opts[3] = &optSampleRate; | |||
| opts[4] = &optNull; | |||
| } | |||
| CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(Lv2PluginOptions) | |||
| }; | |||
| Lv2PluginOptions lv2Options; | |||
| // ------------------------------------------------------------------------- | |||
| class CarlaLv2Client : public CarlaBridgeClient | |||
| { | |||
| @@ -126,40 +209,9 @@ public: | |||
| for (uint32_t i=0; i < CARLA_URI_MAP_ID_COUNT; ++i) | |||
| customURIDs.push_back(nullptr); | |||
| for (uint32_t i=0; i < lv2_feature_count+1; ++i) | |||
| for (uint32_t i=0; i < kFeatureCount+1; ++i) | |||
| features[i] = nullptr; | |||
| // ----------------------------------------------------------------- | |||
| // initialize options | |||
| lv2Options.bufferSize = bufferSize; | |||
| lv2Options.sampleRate = sampleRate; | |||
| lv2Options.oNull.key = CARLA_URI_MAP_ID_NULL; | |||
| lv2Options.oNull.size = 0; | |||
| lv2Options.oNull.type = CARLA_URI_MAP_ID_NULL; | |||
| lv2Options.oNull.value = nullptr; | |||
| lv2Options.oMaxBlockLenth.key = CARLA_URI_MAP_ID_BUF_MAX_LENGTH; | |||
| lv2Options.oMaxBlockLenth.size = sizeof(uint32_t); | |||
| lv2Options.oMaxBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| lv2Options.oMaxBlockLenth.value = &lv2Options.bufferSize; | |||
| lv2Options.oMinBlockLenth.key = CARLA_URI_MAP_ID_BUF_MIN_LENGTH; | |||
| lv2Options.oMinBlockLenth.size = sizeof(uint32_t); | |||
| lv2Options.oMinBlockLenth.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| lv2Options.oMinBlockLenth.value = &lv2Options.bufferSize; | |||
| lv2Options.oSequenceSize.key = CARLA_URI_MAP_ID_BUF_SEQUENCE_SIZE; | |||
| lv2Options.oSequenceSize.size = sizeof(uint32_t); | |||
| lv2Options.oSequenceSize.type = CARLA_URI_MAP_ID_ATOM_INT; | |||
| lv2Options.oSequenceSize.value = &lv2Options.eventSize; | |||
| lv2Options.oSampleRate.key = CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE; | |||
| lv2Options.oSampleRate.size = sizeof(double); | |||
| lv2Options.oSampleRate.type = CARLA_URI_MAP_ID_ATOM_DOUBLE; | |||
| lv2Options.oSampleRate.value = &lv2Options.sampleRate; | |||
| // ----------------------------------------------------------------- | |||
| // initialize features | |||
| @@ -209,13 +261,7 @@ public: | |||
| uiResizeFt->handle = this; | |||
| uiResizeFt->ui_resize = carla_lv2_ui_resize; | |||
| LV2_Options_Option* const optionsFt = new LV2_Options_Option [5]; | |||
| optionsFt[0] = lv2Options.oMaxBlockLenth; | |||
| optionsFt[1] = lv2Options.oMinBlockLenth; | |||
| optionsFt[2] = lv2Options.oSequenceSize; | |||
| optionsFt[3] = lv2Options.oSampleRate; | |||
| optionsFt[4] = lv2Options.oNull; | |||
| #if 0 | |||
| features[lv2_feature_id_bufsize_bounded] = new LV2_Feature; | |||
| features[lv2_feature_id_bufsize_bounded]->URI = LV2_BUF_SIZE__boundedBlockLength; | |||
| features[lv2_feature_id_bufsize_bounded]->data = nullptr; | |||
| @@ -283,6 +329,7 @@ public: | |||
| features[lv2_feature_id_ui_resize] = new LV2_Feature; | |||
| features[lv2_feature_id_ui_resize]->URI = LV2_UI__resize; | |||
| features[lv2_feature_id_ui_resize]->data = uiResizeFt; | |||
| #endif | |||
| } | |||
| ~CarlaLv2Client() | |||
| @@ -290,6 +337,7 @@ public: | |||
| if (rdf_descriptor) | |||
| delete rdf_descriptor; | |||
| #if 0 | |||
| const LV2_Options_Option* const options = (const LV2_Options_Option*)features[lv2_feature_id_options]->data; | |||
| delete[] options; | |||
| @@ -304,10 +352,11 @@ public: | |||
| delete (LV2_URID_Unmap*)features[lv2_feature_id_urid_unmap]->data; | |||
| delete (LV2UI_Port_Map*)features[lv2_feature_id_ui_port_map]->data; | |||
| delete (LV2UI_Resize*)features[lv2_feature_id_ui_resize]->data; | |||
| #endif | |||
| for (uint32_t i=0; i < lv2_feature_count; ++i) | |||
| for (uint32_t i=0; i < kFeatureCount; ++i) | |||
| { | |||
| if (features[i]) | |||
| if (features[i] != nullptr) | |||
| delete features[i]; | |||
| } | |||
| @@ -557,24 +606,22 @@ public: | |||
| // --------------------------------------------------------------------- | |||
| void handleTransferAtom(const int32_t portIndex, const LV2_Atom* const atom) | |||
| void handleAtomTransfer(const uint32_t portIndex, const LV2_Atom* const atom) | |||
| { | |||
| carla_debug("CarlaLv2Client::handleTransferEvent(%i, %p)", portIndex, atom); | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(atom != nullptr); | |||
| carla_debug("CarlaLv2Client::handleTransferEvent(%i, %p)", portIndex, atom); | |||
| if (atom != nullptr && handle != nullptr && descriptor != nullptr && descriptor->port_event != nullptr) | |||
| descriptor->port_event(handle, portIndex, lv2_atom_total_size(atom), CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM, atom); | |||
| } | |||
| void handleTransferEvent(const int32_t portIndex, const LV2_Atom* const atom) | |||
| void handleUridMap(const LV2_URID urid, const char* const uri) | |||
| { | |||
| carla_debug("CarlaLv2Client::handleTransferEvent(%i, %p)", portIndex, atom); | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(atom != nullptr); | |||
| CARLA_ASSERT(urid != CARLA_URI_MAP_ID_NULL); | |||
| CARLA_ASSERT(uri != nullptr); | |||
| carla_debug("CarlaLv2Client::handleUridMap(%i, \"%s\")", urid, uri); | |||
| if (atom != nullptr && handle != nullptr && descriptor != nullptr && descriptor->port_event != nullptr) | |||
| descriptor->port_event(handle, portIndex, lv2_atom_total_size(atom), CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); | |||
| // TODO | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| @@ -617,14 +664,6 @@ public: | |||
| void handleUiWrite(uint32_t portIndex, uint32_t bufferSize, uint32_t format, const void* buffer) | |||
| { | |||
| #ifdef DEBUG | |||
| if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
| { | |||
| const LV2_Atom* const atom((const LV2_Atom*)buffer); | |||
| carla_stdout("OSC UI WRITE DATA: %i | size:%i, realSize:%i, bufferSize:%i, type:\"%s\"", portIndex, atom->size, lv2_atom_total_size(atom), bufferSize, carla_lv2_urid_unmap(this, atom->type)); | |||
| } | |||
| #endif | |||
| if (buffer == nullptr || ! isOscControlRegistered()) | |||
| return; | |||
| @@ -639,47 +678,15 @@ public: | |||
| sendOscControl(portIndex, value); | |||
| } | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | |||
| { | |||
| CARLA_ASSERT(bufferSize != 0); | |||
| if (bufferSize == 0) | |||
| return; | |||
| const LV2_Atom* const atom((const LV2_Atom*)buffer); | |||
| const char* const typeStr(carla_lv2_urid_unmap(this, atom->type)); | |||
| QByteArray chunk((const char*)buffer, bufferSize); | |||
| sendOscLv2TransferAtom(portIndex, typeStr, chunk.toBase64().constData()); | |||
| } | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM || CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
| { | |||
| CARLA_ASSERT(bufferSize != 0); | |||
| if (bufferSize == 0) | |||
| return; | |||
| const LV2_Atom* const atom((const LV2_Atom*)buffer); | |||
| const char* typeStr = carla_lv2_urid_unmap(this, atom->type); | |||
| const char* bodyStr = ""; | |||
| if (atom->type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
| { | |||
| const LV2_Atom_Object* const obj((const LV2_Atom_Object*)atom); | |||
| carla_stdout("OSC UI WRITE DATA: IS BLANK! %i", obj->body.otype); | |||
| carla_stdout("OSC UI WRITE DATA: TEST %i", carla_lv2_urid_map(this, "http://gareus.org/oss/lv2/balance#meteron")); | |||
| if (obj->body.otype != CARLA_URI_MAP_ID_NULL) | |||
| { | |||
| bodyStr = carla_lv2_urid_unmap(this, obj->body.otype); | |||
| carla_stdout("OSC UI WRITE DATA: IS BLANK! AND BODY STR:\"%s\"", bodyStr); | |||
| } | |||
| } | |||
| QByteArray chunk((const char*)buffer, bufferSize); | |||
| sendOscLv2TransferEvent(portIndex, typeStr, bodyStr, chunk.toBase64().constData()); | |||
| sendOscLv2AtomTransfer(portIndex, chunk.toBase64().constData()); | |||
| } | |||
| } | |||
| @@ -997,7 +1004,7 @@ private: | |||
| LV2UI_Handle handle; | |||
| LV2UI_Widget widget; | |||
| const LV2UI_Descriptor* descriptor; | |||
| LV2_Feature* features[lv2_feature_count+1]; | |||
| LV2_Feature* features[kFeatureCount+1]; | |||
| const LV2_RDF_Descriptor* rdf_descriptor; | |||
| const LV2_RDF_UI* rdf_ui_descriptor; | |||
| @@ -1008,64 +1015,51 @@ private: | |||
| std::vector<const char*> customURIDs; | |||
| }; | |||
| int CarlaBridgeOsc::handleMsgLv2TransferAtom(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| #define lv2ClientPtr ((CarlaLv2Client*)kClient) | |||
| int CarlaBridgeOsc::handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2TransferAtom()"); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(3, "iss"); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2AtomTransfer()"); | |||
| if (! kClient) | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| const int32_t portIndex = argv[0]->i; | |||
| const char* const typeStr = (const char*)&argv[1]->s; | |||
| const char* const atomBuf = (const char*)&argv[2]->s; | |||
| const char* const atomBuf = (const char*)&argv[1]->s; | |||
| if (portIndex < 0) | |||
| return 0; | |||
| QByteArray chunk; | |||
| chunk = QByteArray::fromBase64(atomBuf); | |||
| LV2_Atom* const atom = (LV2_Atom*)chunk.constData(); | |||
| CarlaLv2Client* const lv2Client = (CarlaLv2Client*)kClient; | |||
| atom->type = CarlaLv2Client::carla_lv2_urid_map(lv2Client, typeStr); | |||
| lv2Client->handleTransferAtom(portIndex, atom); | |||
| lv2ClientPtr->handleAtomTransfer(portIndex, atom); | |||
| return 0; | |||
| } | |||
| int CarlaBridgeOsc::handleMsgLv2TransferEvent(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2TransferEvent()"); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(4, "isss"); | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2UridMap()"); | |||
| if (! kClient) | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| const int32_t portIndex = argv[0]->i; | |||
| const char* const typeStr = (const char*)&argv[1]->s; | |||
| const char* const bodyStr = (const char*)&argv[2]->s; | |||
| const char* const atomBuf = (const char*)&argv[3]->s; | |||
| QByteArray chunk; | |||
| chunk = QByteArray::fromBase64(atomBuf); | |||
| LV2_Atom* const atom = (LV2_Atom*)chunk.constData(); | |||
| CarlaLv2Client* const lv2Client = (CarlaLv2Client*)kClient; | |||
| const int32_t urid = argv[0]->i; | |||
| const char* const uri = (const char*)&argv[1]->s; | |||
| atom->type = CarlaLv2Client::carla_lv2_urid_map(lv2Client, typeStr); | |||
| if (atom->type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
| { | |||
| LV2_Atom_Object* const obj((LV2_Atom_Object*)atom); | |||
| if (obj->body.otype != CARLA_URI_MAP_ID_NULL) | |||
| obj->body.otype = CarlaLv2Client::carla_lv2_urid_map(this, bodyStr); | |||
| } | |||
| lv2Client->handleTransferEvent(portIndex, atom); | |||
| if (urid <= 0) | |||
| return 0; | |||
| lv2ClientPtr->handleUridMap(urid, uri); | |||
| return 0; | |||
| } | |||
| #undef lv2ClientPtr | |||
| CARLA_BRIDGE_END_NAMESPACE | |||
| int main(int argc, char* argv[]) | |||
| @@ -1087,7 +1081,7 @@ int main(int argc, char* argv[]) | |||
| // try to get sampleRate value | |||
| if (const char* const sampleRateStr = getenv("CARLA_SAMPLE_RATE")) | |||
| sampleRate = atof(sampleRateStr); | |||
| gSampleRate = atof(sampleRateStr); | |||
| // Init LV2 client | |||
| CarlaLv2Client client(uiTitle); | |||
| @@ -37,8 +37,7 @@ endif | |||
| # -------------------------------------------------------------- | |||
| # Plugin bridges | |||
| BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) | |||
| BUILD_PLUGIN_FLAGS += -DBUILD_BRIDGE_PLUGIN -DBRIDGE_PLUGIN | |||
| BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) -DBUILD_BRIDGE_PLUGIN | |||
| BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin -I../libs -I../theme | |||
| LINK_PLUGIN_FLAGS = $(LINK_FLAGS) -lpthread | |||
| @@ -248,7 +247,7 @@ OBJS_UI_LV2_QT4 = CarlaBridgeUI-LV2__lv2-qt4.o \ | |||
| CarlaBridgeClient__lv2.o CarlaBridgeOsc__lv2.o \ | |||
| CarlaBridgeToolkit__lv2.o CarlaBridgeToolkitQt__lv2-qt4.o | |||
| carla-bridge-lv2-qt4: $(OBJS_UI_LV2_QT4) $(OBJS_UI_LV2_LIBS) | |||
| carla-bridge-lv2-qt4: $(OBJS_UI_LV2_QT4) $(OBJS_UI_LV2_LIBS) ../libs/theme.a | |||
| $(CXX) $^ $(LINK_UI_LV2_QT4_FLAGS) -o $@ && $(STRIP) $@ | |||
| %__lv2-qt4.o: %.cpp | |||
| @@ -261,7 +260,7 @@ OBJS_UI_LV2_QT5 = CarlaBridgeUI-LV2__lv2-qt5.o \ | |||
| CarlaBridgeClient__lv2.o CarlaBridgeOsc__lv2.o \ | |||
| CarlaBridgeToolkit__lv2.o CarlaBridgeToolkitQt__lv2-qt5.o | |||
| carla-bridge-lv2-qt5: $(OBJS_UI_LV2_QT5) $(OBJS_UI_LV2_LIBS) | |||
| carla-bridge-lv2-qt5: $(OBJS_UI_LV2_QT5) $(OBJS_UI_LV2_LIBS) ../libs/theme.a | |||
| $(CXX) $^ $(LINK_UI_LV2_QT5_FLAGS) -o $@ && $(STRIP) $@ | |||
| %__lv2-qt5.o: %.cpp | |||
| @@ -2,42 +2,58 @@ | |||
| QT = core gui | |||
| CONFIG = debug link_pkgconfig qt warn_on | |||
| PKGCONFIG = liblo | |||
| TARGET = carla-bridge-lv2-qt4 | |||
| TEMPLATE = app | |||
| VERSION = 0.5.0 | |||
| # ------------------------------------------------------- | |||
| CONFIG = debug | |||
| CONFIG += link_pkgconfig qt warn_on | |||
| DEFINES = DEBUG | |||
| DEFINES += HAVE_CPP11_SUPPORT | |||
| DEFINES += QTCREATOR_TEST | |||
| DEFINES += BUILD_BRIDGE | |||
| DEFINES += BUILD_BRIDGE_UI | |||
| DEFINES += BRIDGE_LV2 | |||
| DEFINES += BRIDGE_QT4 | |||
| DEFINES += BRIDGE_LV2_QT4 | |||
| PKGCONFIG = liblo | |||
| SOURCES = \ | |||
| ../carla_bridge_client.cpp \ | |||
| ../carla_bridge_osc.cpp \ | |||
| ../carla_bridge_toolkit.cpp \ | |||
| ../carla_bridge_toolkit-qt.cpp \ | |||
| ../carla_bridge_ui-lv2.cpp | |||
| ../CarlaBridgeClient.cpp \ | |||
| ../CarlaBridgeOsc.cpp \ | |||
| ../CarlaBridgeToolkit.cpp \ | |||
| ../CarlaBridgeToolkitQt.cpp \ | |||
| ../CarlaBridgeUI-LV2.cpp | |||
| HEADERS = \ | |||
| ../carla_bridge.hpp \ | |||
| ../carla_bridge_client.hpp \ | |||
| ../carla_bridge_osc.hpp \ | |||
| ../carla_bridge_toolkit.hpp \ | |||
| ../../carla-includes/carla_defines.hpp \ | |||
| ../../carla-includes/carla_midi.h \ | |||
| ../../carla-includes/lv2_rdf.hpp \ | |||
| ../../carla-utils/carla_lib_utils.hpp \ | |||
| ../../carla-utils/carla_osc_utils.hpp \ | |||
| ../../carla-utils/carla_lv2_utils.hpp | |||
| ../CarlaBridge.hpp \ | |||
| ../CarlaBridgeClient.hpp \ | |||
| ../CarlaBridgeOsc.hpp \ | |||
| ../CarlaBridgeToolkit.hpp \ | |||
| ../../includes/CarlaDefines.hpp \ | |||
| ../../includes/CarlaMIDI.h \ | |||
| ../../includes/lv2_rdf.hpp \ | |||
| ../../utils/CarlaJuceUtils.hpp \ | |||
| ../../utils/CarlaLibUtils.hpp \ | |||
| ../../utils/CarlaLv2Utils.hpp \ | |||
| ../../utils/CarlaOscUtils.hpp \ | |||
| ../../utils/CarlaUtils.hpp \ | |||
| ../../utils/CarlaString.hpp \ | |||
| ../../utils/RtList.hpp | |||
| INCLUDEPATH = .. \ | |||
| ../../carla-includes \ | |||
| ../../carla-utils | |||
| LIBS = \ | |||
| ../../carla-lilv/carla_lilv.a \ | |||
| ../../carla-rtmempool/carla_rtmempool.a | |||
| DEFINES = QTCREATOR_TEST | |||
| DEFINES += DEBUG | |||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_QT4 BRIDGE_LV2_QT4 | |||
| ../../includes \ | |||
| ../../libs \ | |||
| ../../theme \ | |||
| ../../utils | |||
| LIBS = -ldl | |||
| LIBS += ../../libs/lilv.a | |||
| LIBS += ../../libs/rtmempool.a | |||
| LIBS += ../../libs/theme.a | |||
| QMAKE_CXXFLAGS *= -std=c++0x | |||
| @@ -1,21 +1,21 @@ | |||
| # QtCreator project file | |||
| QT = core gui xml | |||
| TARGET = carla-bridge-qtcreator | |||
| TEMPLATE = app | |||
| VERSION = 1.0 | |||
| # ------------------------------------------------------- | |||
| QT = core gui xml | |||
| CONFIG = debug | |||
| CONFIG += link_pkgconfig qt shared warn_on | |||
| CONFIG += link_pkgconfig qt warn_on | |||
| DEFINES = DEBUG | |||
| DEFINES += HAVE_CPP11_SUPPORT | |||
| DEFINES += QTCREATOR_TEST | |||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BRIDGE_PLUGIN | |||
| DEFINES += BUILD_BRIDGE | |||
| DEFINES += BUILD_BRIDGE_PLUGIN | |||
| # Shared | |||
| DEFINES += WANT_NATIVE | |||
| @@ -34,7 +34,7 @@ DEFINES += WANT_ZYNADDSUBFX | |||
| DEFINES += WANT_ZYNADDSUBFX_UI | |||
| # Engine | |||
| PKGCONFIG += liblo | |||
| PKGCONFIG = liblo | |||
| # RtAudio | |||
| DEFINES += HAVE_GETTIMEOFDAY | |||
| @@ -52,7 +52,7 @@ DEFINES += __LINUX_PULSE__ | |||
| PKGCONFIG += libpulse-simple | |||
| # DISTRHO Plugin | |||
| DEFINES += DISTRHO_PLUGIN_TARGET_VST | |||
| DEFINES += DISTRHO_PLUGIN_TARGET_DSSI | |||
| # FluidSynth | |||
| PKGCONFIG += fluidsynth | |||
| @@ -161,7 +161,6 @@ HEADERS += \ | |||
| ../../utils/CarlaUtils.hpp \ | |||
| ../../utils/CarlaMutex.hpp \ | |||
| ../../utils/CarlaString.hpp \ | |||
| ../../utils/CarlaThread.hpp \ | |||
| ../../utils/Lv2AtomQueue.hpp \ | |||
| ../../utils/RtList.hpp | |||
| @@ -176,11 +175,12 @@ INCLUDEPATH = .. \ | |||
| # ----------------------------------------------------------- | |||
| LIBS = -ldl \ | |||
| ../../backend/libcarla_native.a \ | |||
| ../../libs/dgl.a \ | |||
| ../../libs/lilv.a \ | |||
| ../../libs/rtmempool.a \ | |||
| ../../libs/widgets.a | |||
| LIBS = -ldl | |||
| LIBS += ../../backend/libcarla_native.a | |||
| LIBS += ../../libs/dgl.a | |||
| LIBS += ../../libs/lilv.a | |||
| LIBS += ../../libs/rtmempool.a | |||
| LIBS += ../../libs/theme.a | |||
| LIBS += ../../libs/widgets.a | |||
| QMAKE_CXXFLAGS *= -std=gnu++0x | |||
| @@ -1249,7 +1249,7 @@ bool is_lv2_feature_supported(const LV2_URI uri) | |||
| if (std::strcmp(uri, LV2_URID__unmap) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_WORKER__schedule) == 0) | |||
| return false; // TODO | |||
| return true; | |||
| return false; | |||
| } | |||
| @@ -1282,11 +1282,11 @@ bool is_lv2_ui_feature_supported(const LV2_URI uri) | |||
| if (std::strcmp(uri, LV2_UI__portMap) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__portSubscribe) == 0) | |||
| return false; // TODO | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__resize) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__touch) == 0) | |||
| return false; // TODO | |||
| return true; | |||
| if (std::strcmp(uri, LV2_EXTERNAL_UI__Widget) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0) | |||
| @@ -314,39 +314,36 @@ void osc_send_bridge_error(const CarlaOscData* const oscData, const char* const | |||
| #if defined(BRIDGE_LV2) || defined(WANT_LV2) | |||
| static inline | |||
| void osc_send_lv2_transfer_atom(const CarlaOscData* const oscData, const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
| void osc_send_lv2_atom_transfer(const CarlaOscData* const oscData, const int32_t portIndex, const char* const atomBuf) | |||
| { | |||
| CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr); | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(typeStr != nullptr); | |||
| CARLA_ASSERT(atomBuf != nullptr); | |||
| carla_debug("osc_send_lv2_transfer_atom(path:\"%s\", %i, \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, atomBuf); | |||
| carla_debug("osc_send_lv2_atom_transfer(path:\"%s\", %i, <atomBuf:%p>)", oscData->path, portIndex, atomBuf); | |||
| if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && portIndex >= 0 && typeStr != nullptr && atomBuf != nullptr) | |||
| if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && portIndex >= 0 && atomBuf != nullptr) | |||
| { | |||
| char targetPath[std::strlen(oscData->path)+19]; | |||
| std::strcpy(targetPath, oscData->path); | |||
| std::strcat(targetPath, "/lv2_atom_transfer"); | |||
| lo_send(oscData->target, targetPath, "iss", portIndex, typeStr, atomBuf); | |||
| lo_send(oscData->target, targetPath, "is", portIndex, atomBuf); | |||
| } | |||
| } | |||
| static inline | |||
| void osc_send_lv2_transfer_event(const CarlaOscData* const oscData, const int32_t portIndex, const char* const typeStr, const char* const bodyStr, const char* const atomBuf) | |||
| void osc_send_lv2_urid_map(const CarlaOscData* const oscData, const uint32_t urid, const char* const uri) | |||
| { | |||
| CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr); | |||
| CARLA_ASSERT(portIndex >= 0); | |||
| CARLA_ASSERT(typeStr != nullptr); | |||
| CARLA_ASSERT(bodyStr != nullptr); | |||
| CARLA_ASSERT(atomBuf != nullptr); | |||
| carla_debug("osc_send_lv2_transfer_event(path:\"%s\", %i, \"%s\", \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, bodyStr, atomBuf); | |||
| CARLA_ASSERT(urid > 0); | |||
| CARLA_ASSERT(uri != nullptr); | |||
| carla_debug("osc_send_lv2_urid_map(path:\"%s\", %i, \"%s\")", oscData->path, urid, uri); | |||
| if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && portIndex >= 0 && typeStr != nullptr && bodyStr != nullptr && atomBuf != nullptr) | |||
| if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && urid > 0 && uri != nullptr) | |||
| { | |||
| char targetPath[std::strlen(oscData->path)+20]; | |||
| char targetPath[std::strlen(oscData->path)+14]; | |||
| std::strcpy(targetPath, oscData->path); | |||
| std::strcat(targetPath, "/lv2_event_transfer"); | |||
| lo_send(oscData->target, targetPath, "isss", portIndex, typeStr, bodyStr, atomBuf); | |||
| std::strcat(targetPath, "/lv2_urid_map"); | |||
| lo_send(oscData->target, targetPath, "is", urid, uri); | |||
| } | |||
| } | |||
| #endif | |||
| @@ -211,7 +211,8 @@ const char* carla_strdup(const char* const strBuf) | |||
| const size_t bufferLen = (strBuf != nullptr) ? std::strlen(strBuf) : 0; | |||
| char* const buffer = new char[bufferLen+1]; | |||
| std::strcpy(buffer, strBuf); | |||
| if (strBuf != nullptr && bufferLen > 0) | |||
| std::strcpy(buffer, strBuf); | |||
| buffer[bufferLen] = '\0'; | |||