| @@ -1270,8 +1270,8 @@ private: | |||
| RtMidiEvents() | |||
| : dataPool(512, 512), | |||
| data(&dataPool), | |||
| dataPending(&dataPool) {} | |||
| data(dataPool), | |||
| dataPending(dataPool) {} | |||
| ~RtMidiEvents() | |||
| { | |||
| @@ -58,7 +58,7 @@ void CarlaEngineThread::stopNow() | |||
| fStopNow = true; | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| if (isRunning() && ! wait(500)) | |||
| terminate(); | |||
| @@ -77,7 +77,7 @@ void CarlaEngineThread::run() | |||
| while (kEngine->isRunning() && ! fStopNow) | |||
| { | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| #ifdef BUILD_BRIDGE | |||
| oscRegisted = kEngine->isOscBridgeRegistered(); | |||
| @@ -160,7 +160,7 @@ public: | |||
| if (isRunning() && ! wait(1000)) | |||
| terminate(); | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fPool.reset(); | |||
| } | |||
| @@ -290,7 +290,7 @@ public: | |||
| i = j = 0; | |||
| // lock, and put data asap | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| for (; i < fPool.size && j < rv; ++j) | |||
| { | |||
| @@ -197,7 +197,7 @@ public: | |||
| void clear() | |||
| { | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fData.clear(); | |||
| } | |||
| @@ -214,7 +214,7 @@ private: | |||
| { | |||
| if (fData.isEmpty()) | |||
| { | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fData.append(event); | |||
| return; | |||
| } | |||
| @@ -226,12 +226,12 @@ private: | |||
| if (event->time >= oldEvent->time) | |||
| continue; | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fData.insertAt(event, it); | |||
| return; | |||
| } | |||
| const CarlaMutex::ScopedLocker sl(&fMutex); | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fData.append(event); | |||
| } | |||
| }; | |||
| @@ -198,8 +198,8 @@ private: | |||
| InRtEvents() | |||
| : dataPool(MIN_PREALLOCATED_EVENT_COUNT, MAX_PREALLOCATED_EVENT_COUNT), | |||
| data(&dataPool), | |||
| dataPendingRT(&dataPool) {} | |||
| data(dataPool), | |||
| dataPendingRT(dataPool) {} | |||
| ~InRtEvents() | |||
| { | |||
| @@ -54,7 +54,7 @@ public: | |||
| if (filename == nullptr) | |||
| return nullptr; | |||
| const CarlaMutex::ScopedLocker sl(&mutex); | |||
| const CarlaMutex::ScopedLocker sl(mutex); | |||
| for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||
| { | |||
| @@ -89,7 +89,7 @@ public: | |||
| if (libPtr == nullptr) | |||
| return false; | |||
| const CarlaMutex::ScopedLocker sl(&mutex); | |||
| const CarlaMutex::ScopedLocker sl(mutex); | |||
| for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||
| { | |||
| @@ -1952,7 +1952,7 @@ void CarlaPlugin::postponeRtEvent(const PluginPostRtEventType type, const int32_ | |||
| void CarlaPlugin::postRtEventsRun() | |||
| { | |||
| const CarlaMutex::ScopedLocker sl(&kData->postRtEvents.mutex); | |||
| const CarlaMutex::ScopedLocker sl(kData->postRtEvents.mutex); | |||
| while (! kData->postRtEvents.data.isEmpty()) | |||
| { | |||
| @@ -429,7 +429,7 @@ struct CarlaPluginProtectedData { | |||
| ExternalNotes() | |||
| : dataPool(32, 152), | |||
| data(&dataPool) {} | |||
| data(dataPool) {} | |||
| ~ExternalNotes() | |||
| { | |||
| @@ -457,8 +457,8 @@ struct CarlaPluginProtectedData { | |||
| PostRtEvents() | |||
| : dataPool(128, 128), | |||
| data(&dataPool), | |||
| dataPendingRT(&dataPool) {} | |||
| data(dataPool), | |||
| dataPendingRT(dataPool) {} | |||
| ~PostRtEvents() | |||
| { | |||
| @@ -38,7 +38,7 @@ public: | |||
| Widget(Window* parent); | |||
| virtual ~Widget(); | |||
| bool isVisible(); | |||
| bool isVisible() const; | |||
| void setVisible(bool yesNo); | |||
| void show() | |||
| @@ -39,7 +39,7 @@ Widget::~Widget() | |||
| fParent->removeWidget(this); | |||
| } | |||
| bool Widget::isVisible() | |||
| bool Widget::isVisible() const | |||
| { | |||
| return fVisible; | |||
| } | |||
| @@ -163,17 +163,17 @@ typedef struct _jack_latency_range jack_latency_range_t; | |||
| typedef struct _jack_position jack_position_t; | |||
| typedef struct _jack_midi_event jack_midi_event_t; | |||
| typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg); | |||
| typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg); | |||
| typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg); | |||
| typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg); | |||
| typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register_, void *arg); | |||
| typedef void (*JackClientRegistrationCallback)(const char* name, int register_, void *arg); | |||
| typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void* arg); | |||
| typedef int (*JackProcessCallback)(jack_nframes_t nframes, void* arg); | |||
| typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void* arg); | |||
| typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void* arg); | |||
| typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register_, void* arg); | |||
| typedef void (*JackClientRegistrationCallback)(const char* name, int register_, void* arg); | |||
| typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg); | |||
| typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg); | |||
| typedef void (*JackFreewheelCallback)(int starting, void *arg); | |||
| typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void* arg); | |||
| typedef void (*JackFreewheelCallback)(int starting, void* arg); | |||
| typedef int (*JackXRunCallback)(void* arg); | |||
| typedef void (*JackShutdownCallback)(void *arg); | |||
| typedef void (*JackShutdownCallback)(void* arg); | |||
| #endif // ! JACKBRIDGE_DIRECT | |||
| @@ -2,7 +2,7 @@ | |||
| #ifndef _LILV_CONFIG_H_ | |||
| #define _LILV_CONFIG_H_ | |||
| #define LILV_VERSION "0.14.4" | |||
| #define LILV_VERSION "0.16.0" | |||
| #define LILV_NEW_LV2 1 | |||
| #define HAVE_LV2 1 | |||
| @@ -2,7 +2,7 @@ | |||
| #ifndef _SRATOM_CONFIG_H_ | |||
| #define _SRATOM_CONFIG_H_ | |||
| #define SRATOM_VERSION "0.4.0" | |||
| #define SRATOM_VERSION "0.4.2" | |||
| #define HAVE_LV2 1 | |||
| #define HAVE_SERD 1 | |||
| @@ -48,8 +48,8 @@ struct PostRtEvents { | |||
| PostRtEvents() | |||
| : dataPool(MIN_RT_EVENTS, MAX_RT_EVENTS), | |||
| data(&dataPool), | |||
| dataPendingRT(&dataPool) {} | |||
| data(dataPool), | |||
| dataPendingRT(dataPool) {} | |||
| ~PostRtEvents() | |||
| { | |||
| @@ -54,8 +54,8 @@ const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const o | |||
| for (unsigned long i=0; i < newDescriptor->PortCount; ++i) | |||
| { | |||
| LADSPA_RDF_Port* const oldPort = &oldDescriptor->Ports[i]; | |||
| LADSPA_RDF_Port* const newPort = &newDescriptor->Ports[i]; | |||
| LADSPA_RDF_Port* const oldPort(&oldDescriptor->Ports[i]); | |||
| LADSPA_RDF_Port* const newPort(&newDescriptor->Ports[i]); | |||
| newPort->Type = oldPort->Type; | |||
| newPort->Hints = oldPort->Hints; | |||
| @@ -72,8 +72,8 @@ const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const o | |||
| for (unsigned long j=0; j < oldPort->ScalePointCount; ++j) | |||
| { | |||
| LADSPA_RDF_ScalePoint* const oldScalePoint = &oldPort->ScalePoints[j]; | |||
| LADSPA_RDF_ScalePoint* const newScalePoint = &newPort->ScalePoints[j]; | |||
| LADSPA_RDF_ScalePoint* const oldScalePoint(&oldPort->ScalePoints[j]); | |||
| LADSPA_RDF_ScalePoint* const newScalePoint(&newPort->ScalePoints[j]); | |||
| newScalePoint->Value = oldScalePoint->Value; | |||
| @@ -77,13 +77,13 @@ const char* lib_error(const char* const filename) | |||
| #ifdef CARLA_OS_WIN | |||
| static char libError[2048]; | |||
| carla_zeroMem(libError, sizeof(char)*2048); | |||
| //carla_fill<char>(libError, 2048, '\0'); | |||
| LPVOID winErrorString; | |||
| DWORD winErrorCode = GetLastError(); | |||
| FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, winErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&winErrorString, 0, nullptr); | |||
| FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, winErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&winErrorString, 0, nullptr); | |||
| snprintf(libError, 2048, "%s: error code %li: %s", filename, winErrorCode, (const char*)winErrorString); | |||
| std::snprintf(libError, 2048, "%s: error code %li: %s", filename, winErrorCode, (const char*)winErrorString); | |||
| LocalFree(winErrorString); | |||
| return libError; | |||
| @@ -390,10 +390,10 @@ public: | |||
| return nullptr; | |||
| } | |||
| if (const LilvState* state = lilv_state_new_from_world(this->me, uridMap, uriNode)) | |||
| if (const LilvState* cState = lilv_state_new_from_world(this->me, uridMap, uriNode)) | |||
| { | |||
| lilv_node_free(uriNode); | |||
| return state; | |||
| return cState; | |||
| } | |||
| else | |||
| { | |||
| @@ -567,7 +567,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| const QString replaceId(replaceURI.split(":").last()); | |||
| bool ok; | |||
| ulong uniqueId = replaceId.toULong(&ok); | |||
| const ulong uniqueId(replaceId.toULong(&ok)); | |||
| if (ok && uniqueId != 0) | |||
| rdfDescriptor->UniqueID = uniqueId; | |||
| @@ -587,7 +587,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| for (uint32_t j = 0; j < rdfDescriptor->PortCount; ++j) | |||
| { | |||
| Lilv::Port lilvPort(lilvPlugin.get_port_by_index(j)); | |||
| LV2_RDF_Port* const rdfPort = &rdfDescriptor->Ports[j]; | |||
| LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[j]); | |||
| // -------------------------------------- | |||
| // Set Port Information | |||
| @@ -605,23 +605,24 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| // Input or Output | |||
| if (lilvPort.is_a(gLv2World.port_input)) | |||
| rdfPort->Types |= LV2_PORT_INPUT; | |||
| else if (lilvPort.is_a(gLv2World.port_output)) | |||
| rdfPort->Types |= LV2_PORT_OUTPUT; | |||
| else | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is not input or output", uri, rdfPort->Name); | |||
| // Data Type | |||
| if (lilvPort.is_a(gLv2World.port_control)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_CONTROL; | |||
| } | |||
| else if (lilvPort.is_a(gLv2World.port_audio)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_AUDIO; | |||
| } | |||
| else if (lilvPort.is_a(gLv2World.port_cv)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_CV; | |||
| } | |||
| else if (lilvPort.is_a(gLv2World.port_atom)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_ATOM; | |||
| @@ -655,7 +656,6 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| if (! supported) | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of atom type but has unsupported data", uri, rdfPort->Name); | |||
| } | |||
| else if (lilvPort.is_a(gLv2World.port_event)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_EVENT; | |||
| @@ -680,13 +680,11 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| if (! supported) | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of event type but has unsupported data", uri, rdfPort->Name); | |||
| } | |||
| else if (lilvPort.is_a(gLv2World.port_midi)) | |||
| { | |||
| rdfPort->Types |= LV2_PORT_MIDI_LL; | |||
| rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT; | |||
| } | |||
| else | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of unkown data type", uri, rdfPort->Name); | |||
| } | |||
| @@ -726,6 +724,66 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| if (lilvPort.has_property(gLv2World.reportsLatency)) | |||
| rdfPort->Designation = LV2_PORT_DESIGNATION_LATENCY; | |||
| // no port properties, check if port uses old ones | |||
| if (rdfPort->Properties == 0x0) | |||
| { | |||
| static const Lilv::Node oldPropArtifacts(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#causesArtifacts")); | |||
| static const Lilv::Node oldPropContinuousCV(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#continuousCV")); | |||
| static const Lilv::Node oldPropDiscreteCV(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#discreteCV")); | |||
| static const Lilv::Node oldPropExpensive(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#expensive")); | |||
| static const Lilv::Node oldPropStrictBounds(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#hasStrictBounds")); | |||
| static const Lilv::Node oldPropLogarithmic(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#logarithmic")); | |||
| static const Lilv::Node oldPropNotAutomatic(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#notAutomatic")); | |||
| static const Lilv::Node oldPropNotOnGUI(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#notOnGUI")); | |||
| static const Lilv::Node oldPropTrigger(gLv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#trigger")); | |||
| if (lilvPort.has_property(oldPropArtifacts)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_CAUSES_ARTIFACTS; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'causesArtifacts'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropContinuousCV)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_CONTINUOUS_CV; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'continuousCV'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropDiscreteCV)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_DISCRETE_CV; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'discreteCV'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropExpensive)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_EXPENSIVE; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'expensive'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropStrictBounds)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_STRICT_BOUNDS; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'hasStrictBounds'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropLogarithmic)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_LOGARITHMIC; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'logarithmic'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropNotAutomatic)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_NOT_AUTOMATIC; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'notAutomatic'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropNotOnGUI)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_NOT_ON_GUI; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'notOnGUI'", uri, rdfPort->Name); | |||
| } | |||
| if (lilvPort.has_property(oldPropTrigger)) | |||
| { | |||
| rdfPort->Properties |= LV2_PORT_TRIGGER; | |||
| carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/broken LV2 property for 'trigger'", uri, rdfPort->Name); | |||
| } | |||
| } | |||
| } | |||
| // -------------------------------------- | |||
| @@ -946,8 +1004,10 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| uint32_t h = 0; | |||
| LILV_FOREACH(scale_points, j, lilvScalePoints) | |||
| { | |||
| CARLA_ASSERT(h < rdfPort->ScalePointCount); | |||
| Lilv::ScalePoint lilvScalePoint(lilvScalePoints.get(j)); | |||
| LV2_RDF_PortScalePoint* const rdfScalePoint = &rdfPort->ScalePoints[h++]; | |||
| LV2_RDF_PortScalePoint* const rdfScalePoint(&rdfPort->ScalePoints[h++]); | |||
| if (const char* const label = Lilv::Node(lilvScalePoint.get_label()).as_string()) | |||
| rdfScalePoint->Label = carla_strdup(label); | |||
| @@ -971,7 +1031,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(nodes, j, presetNodes) | |||
| { | |||
| Lilv::Node presetNode(presetNodes.get(j)); | |||
| // FIXME - check appliesTo | |||
| // FIXME - check appliesTo? | |||
| QString presetURI(presetNode.as_uri()); | |||
| @@ -995,12 +1055,14 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| if (const char* const presetURI = presetNode.as_uri()) | |||
| { | |||
| int32_t index = presetListURIs.indexOf(QString(presetURI)); | |||
| const int index(presetListURIs.indexOf(QString(presetURI))); | |||
| CARLA_ASSERT(index >= 0); | |||
| if (index < 0) | |||
| continue; | |||
| LV2_RDF_Preset* const rdfPreset = &rdfDescriptor->Presets[index]; | |||
| LV2_RDF_Preset* const rdfPreset(&rdfDescriptor->Presets[index]); | |||
| // -------------------------------------- | |||
| // Set Preset Information | |||
| @@ -1036,9 +1098,10 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(nodes, j, lilvFeatureNodes) | |||
| { | |||
| CARLA_ASSERT(h < rdfDescriptor->FeatureCount); | |||
| Lilv::Node lilvFeatureNode(lilvFeatureNodes.get(j)); | |||
| LV2_RDF_Feature* const rdfFeature(&rdfDescriptor->Features[h++]); | |||
| LV2_RDF_Feature* const rdfFeature = &rdfDescriptor->Features[h++]; | |||
| rdfFeature->Type = lilvFeatureNodesR.contains(lilvFeatureNode) ? LV2_FEATURE_REQUIRED : LV2_FEATURE_OPTIONAL; | |||
| if (const char* const featureURI = lilvFeatureNode.as_uri()) | |||
| @@ -1061,9 +1124,9 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(nodes, j, lilvExtensionDataNodes) | |||
| { | |||
| CARLA_ASSERT(h < rdfDescriptor->ExtensionCount); | |||
| Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(j)); | |||
| LV2_URI* const rdfExtension = &rdfDescriptor->Extensions[h++]; | |||
| Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(j)); | |||
| LV2_URI* const rdfExtension(&rdfDescriptor->Extensions[h++]); | |||
| if (const char* const extURI = lilvExtensionDataNode.as_uri()) | |||
| *rdfExtension = carla_strdup(extURI); | |||
| @@ -1085,9 +1148,9 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(uis, j, lilvUIs) | |||
| { | |||
| CARLA_ASSERT(h < rdfDescriptor->UICount); | |||
| Lilv::UI lilvUI(lilvUIs.get(j)); | |||
| LV2_RDF_UI* const rdfUI = &rdfDescriptor->UIs[h++]; | |||
| Lilv::UI lilvUI(lilvUIs.get(j)); | |||
| LV2_RDF_UI* const rdfUI(&rdfDescriptor->UIs[h++]); | |||
| // -------------------------------------- | |||
| // Set UI Type | |||
| @@ -1142,9 +1205,10 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(nodes, k, lilvFeatureNodes) | |||
| { | |||
| CARLA_ASSERT(x < rdfUI->FeatureCount); | |||
| Lilv::Node lilvFeatureNode(lilvFeatureNodes.get(k)); | |||
| LV2_RDF_Feature* const rdfFeature(&rdfUI->Features[x++]); | |||
| LV2_RDF_Feature* const rdfFeature = &rdfUI->Features[x++]; | |||
| rdfFeature->Type = lilvFeatureNodesR.contains(lilvFeatureNode) ? LV2_FEATURE_REQUIRED : LV2_FEATURE_OPTIONAL; | |||
| if (const char* const featureURI = lilvFeatureNode.as_uri()) | |||
| @@ -1167,9 +1231,9 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri) | |||
| LILV_FOREACH(nodes, k, lilvExtensionDataNodes) | |||
| { | |||
| CARLA_ASSERT(x < rdfUI->ExtensionCount); | |||
| Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(k)); | |||
| LV2_URI* const rdfExtension = &rdfUI->Extensions[x++]; | |||
| Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(k)); | |||
| LV2_URI* const rdfExtension(&rdfUI->Extensions[x++]); | |||
| if (const char* const extURI = lilvExtensionDataNode.as_uri()) | |||
| *rdfExtension = carla_strdup(extURI); | |||
| @@ -1269,10 +1333,10 @@ bool is_lv2_ui_feature_supported(const LV2_URI uri) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_INSTANCE_ACCESS_URI) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__idle) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__fixedSize) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__idle) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__makeResident) == 0) | |||
| return true; | |||
| if (std::strcmp(uri, LV2_UI__noUserResize) == 0) | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Mutex | |||
| * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU General Public License as | |||
| @@ -35,7 +35,7 @@ class CarlaMutex | |||
| { | |||
| public: | |||
| CarlaMutex() | |||
| : fTryLockCalled(false) | |||
| : fTryLockWasCalled(false) | |||
| { | |||
| #ifndef CPP11_MUTEX | |||
| pthread_mutex_init(&pmutex, nullptr); | |||
| @@ -60,7 +60,7 @@ public: | |||
| bool tryLock() | |||
| { | |||
| fTryLockCalled = true; | |||
| fTryLockWasCalled = true; | |||
| #ifdef CPP11_MUTEX | |||
| return cmutex.try_lock(); | |||
| @@ -80,27 +80,27 @@ public: | |||
| bool wasTryLockCalled() | |||
| { | |||
| const bool ret = fTryLockCalled; | |||
| fTryLockCalled = false; | |||
| const bool ret = fTryLockWasCalled; | |||
| fTryLockWasCalled = false; | |||
| return ret; | |||
| } | |||
| class ScopedLocker | |||
| { | |||
| public: | |||
| ScopedLocker(CarlaMutex* const mutex) | |||
| ScopedLocker(CarlaMutex& mutex) | |||
| : fMutex(mutex) | |||
| { | |||
| fMutex->lock(); | |||
| fMutex.lock(); | |||
| } | |||
| ~ScopedLocker() | |||
| { | |||
| fMutex->unlock(); | |||
| fMutex.unlock(); | |||
| } | |||
| private: | |||
| CarlaMutex* const fMutex; | |||
| CarlaMutex& fMutex; | |||
| CARLA_PREVENT_HEAP_ALLOCATION | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ScopedLocker) | |||
| @@ -112,7 +112,7 @@ private: | |||
| #else | |||
| pthread_mutex_t pmutex; | |||
| #endif | |||
| bool fTryLockCalled; | |||
| bool fTryLockWasCalled; | |||
| CARLA_PREVENT_HEAP_ALLOCATION | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaMutex) | |||
| @@ -138,7 +138,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add_tail(&data->siblings, &fQueue); | |||
| fCount++; | |||
| ++fCount; | |||
| return true; | |||
| } | |||
| @@ -151,7 +151,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add_tail(&data->siblings, it.fEntry->next); | |||
| fCount++; | |||
| ++fCount; | |||
| return true; | |||
| } | |||
| @@ -164,7 +164,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add(&data->siblings, &fQueue); | |||
| fCount++; | |||
| ++fCount; | |||
| return true; | |||
| } | |||
| @@ -177,7 +177,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add(&data->siblings, it.fEntry->prev); | |||
| fCount++; | |||
| ++fCount; | |||
| return true; | |||
| } | |||
| @@ -203,7 +203,7 @@ public: | |||
| if (remove) | |||
| { | |||
| fCount--; | |||
| --fCount; | |||
| list_del(entry); | |||
| if (data != nullptr) | |||
| @@ -235,7 +235,7 @@ public: | |||
| if (it.fEntry != nullptr && it.fData != nullptr) | |||
| { | |||
| fCount--; | |||
| --fCount; | |||
| list_del(it.fEntry); | |||
| _deallocate(it.fData); | |||
| } | |||
| @@ -255,7 +255,7 @@ public: | |||
| if (data != nullptr && data->value == value) | |||
| { | |||
| fCount--; | |||
| --fCount; | |||
| list_del(entry); | |||
| _deallocate(data); | |||
| break; | |||
| @@ -269,9 +269,9 @@ public: | |||
| { | |||
| Data* data; | |||
| k_list_head* entry; | |||
| k_list_head* tmp; | |||
| k_list_head* entry2; | |||
| list_for_each_safe(entry, tmp, &fQueue) | |||
| list_for_each_safe(entry, entry2, &fQueue) | |||
| { | |||
| data = list_entry(entry, Data, siblings); | |||
| @@ -279,14 +279,14 @@ public: | |||
| if (data != nullptr && data->value == value) | |||
| { | |||
| fCount--; | |||
| --fCount; | |||
| list_del(entry); | |||
| _deallocate(data); | |||
| } | |||
| } | |||
| } | |||
| virtual void spliceAppend(List& list, const bool init = false) | |||
| void spliceAppend(List& list, const bool init = false) | |||
| { | |||
| if (init) | |||
| { | |||
| @@ -301,7 +301,7 @@ public: | |||
| } | |||
| } | |||
| virtual void spliceInsert(List& list, const bool init = false) | |||
| void spliceInsert(List& list, const bool init = false) | |||
| { | |||
| if (init) | |||
| { | |||
| @@ -348,7 +348,7 @@ private: | |||
| if (data != nullptr && remove) | |||
| { | |||
| fCount--; | |||
| --fCount; | |||
| list_del(entry); | |||
| _deallocate(data); | |||
| } | |||
| @@ -358,7 +358,6 @@ private: | |||
| T& _getEmpty() | |||
| { | |||
| // FIXME ? | |||
| static T value; | |||
| static bool reset = true; | |||
| @@ -391,14 +390,16 @@ public: | |||
| : fHandle(nullptr), | |||
| kDataSize(sizeof(typename List<T>::Data)) | |||
| { | |||
| rtsafe_memory_pool_create(&fHandle, nullptr, kDataSize, minPreallocated, maxPreallocated); | |||
| CARLA_ASSERT(fHandle != nullptr); | |||
| resize(minPreallocated, maxPreallocated); | |||
| } | |||
| ~Pool() | |||
| { | |||
| if (fHandle != nullptr) | |||
| { | |||
| rtsafe_memory_pool_destroy(fHandle); | |||
| fHandle = nullptr; | |||
| } | |||
| } | |||
| void* allocate_atomic() | |||
| @@ -418,8 +419,6 @@ public: | |||
| void resize(const size_t minPreallocated, const size_t maxPreallocated) | |||
| { | |||
| CARLA_ASSERT(this->fCount == 0); | |||
| if (fHandle != nullptr) | |||
| { | |||
| rtsafe_memory_pool_destroy(fHandle); | |||
| @@ -430,6 +429,16 @@ public: | |||
| CARLA_ASSERT(fHandle != nullptr); | |||
| } | |||
| bool operator==(const Pool& pool) const | |||
| { | |||
| return (fHandle == pool.fHandle && kDataSize == pool.kDataSize); | |||
| } | |||
| bool operator!=(const Pool& pool) const | |||
| { | |||
| return (fHandle != pool.fHandle || kDataSize != pool.kDataSize); | |||
| } | |||
| private: | |||
| RtMemPool_Handle fHandle; | |||
| const size_t kDataSize; | |||
| @@ -438,10 +447,9 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Now the actual list code | |||
| RtList(Pool* const memPool) | |||
| : kMemPool(memPool) | |||
| RtList(Pool& memPool) | |||
| : fMemPool(memPool) | |||
| { | |||
| CARLA_ASSERT(kMemPool != nullptr); | |||
| } | |||
| ~RtList() override | |||
| @@ -454,7 +462,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add_tail(&data->siblings, &this->fQueue); | |||
| this->fCount++; | |||
| ++this->fCount; | |||
| } | |||
| } | |||
| @@ -464,7 +472,7 @@ public: | |||
| { | |||
| std::memcpy(&data->value, &value, sizeof(T)); | |||
| list_add(&data->siblings, &this->fQueue); | |||
| this->fCount++; | |||
| ++this->fCount; | |||
| } | |||
| } | |||
| @@ -472,25 +480,25 @@ public: | |||
| { | |||
| this->clear(); | |||
| kMemPool->resize(minPreallocated, maxPreallocated); | |||
| fMemPool.resize(minPreallocated, maxPreallocated); | |||
| } | |||
| void spliceAppend(RtList& list, const bool init = false) | |||
| { | |||
| CARLA_ASSERT(kMemPool == list.kMemPool); | |||
| CARLA_ASSERT(fMemPool == list.fMemPool); | |||
| List<T>::spliceAppend(list, init); | |||
| } | |||
| void spliceInsert(RtList& list, const bool init = false) | |||
| { | |||
| CARLA_ASSERT(kMemPool == list.kMemPool); | |||
| CARLA_ASSERT(fMemPool == list.fMemPool); | |||
| List<T>::spliceInsert(list, init); | |||
| } | |||
| private: | |||
| Pool* const kMemPool; | |||
| Pool& fMemPool; | |||
| typename List<T>::Data* _allocate() override | |||
| { | |||
| @@ -499,17 +507,17 @@ private: | |||
| typename List<T>::Data* _allocate_atomic() | |||
| { | |||
| return (typename List<T>::Data*)kMemPool->allocate_atomic(); | |||
| return (typename List<T>::Data*)fMemPool.allocate_atomic(); | |||
| } | |||
| typename List<T>::Data* _allocate_sleepy() | |||
| { | |||
| return (typename List<T>::Data*)kMemPool->allocate_sleepy(); | |||
| return (typename List<T>::Data*)fMemPool.allocate_sleepy(); | |||
| } | |||
| void _deallocate(typename List<T>::Data* const dataPtr) override | |||
| { | |||
| kMemPool->deallocate(dataPtr); | |||
| fMemPool.deallocate(dataPtr); | |||
| } | |||
| LIST_DECLARATIONS(RtList) | |||
| @@ -526,7 +534,7 @@ public: | |||
| { | |||
| } | |||
| ~NonRtList() | |||
| ~NonRtList() override | |||
| { | |||
| } | |||