|
|
@@ -1073,399 +1073,6 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI URI) |
|
|
return nullptr; |
|
|
return nullptr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Copy RDF object |
|
|
|
|
|
static inline |
|
|
|
|
|
const LV2_RDF_Descriptor* lv2_rdf_dup(const LV2_RDF_Descriptor* const rdf_descriptor) |
|
|
|
|
|
{ |
|
|
|
|
|
CARLA_ASSERT(rdf_descriptor); |
|
|
|
|
|
|
|
|
|
|
|
LV2_RDF_Descriptor* const new_descriptor = new LV2_RDF_Descriptor; |
|
|
|
|
|
|
|
|
|
|
|
new_descriptor->Type = rdf_descriptor->Type; |
|
|
|
|
|
new_descriptor->UniqueID = rdf_descriptor->UniqueID; |
|
|
|
|
|
|
|
|
|
|
|
new_descriptor->PortCount = rdf_descriptor->PortCount; |
|
|
|
|
|
new_descriptor->PresetCount = rdf_descriptor->PresetCount; |
|
|
|
|
|
new_descriptor->FeatureCount = rdf_descriptor->FeatureCount; |
|
|
|
|
|
new_descriptor->ExtensionCount = rdf_descriptor->ExtensionCount; |
|
|
|
|
|
new_descriptor->UICount = rdf_descriptor->UICount; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->URI) |
|
|
|
|
|
new_descriptor->URI = strdup(rdf_descriptor->URI); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Name) |
|
|
|
|
|
new_descriptor->Name = strdup(rdf_descriptor->Name); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Author) |
|
|
|
|
|
new_descriptor->Author = strdup(rdf_descriptor->Author); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->License) |
|
|
|
|
|
new_descriptor->License = strdup(rdf_descriptor->License); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Binary) |
|
|
|
|
|
new_descriptor->Binary = strdup(rdf_descriptor->Binary); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Bundle) |
|
|
|
|
|
new_descriptor->Bundle = strdup(rdf_descriptor->Bundle); |
|
|
|
|
|
|
|
|
|
|
|
// Ports |
|
|
|
|
|
if (new_descriptor->PortCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->Ports = new LV2_RDF_Port[new_descriptor->PortCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0; i < new_descriptor->PortCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
LV2_RDF_Port* const Port = &new_descriptor->Ports[i]; |
|
|
|
|
|
|
|
|
|
|
|
Port->Type = rdf_descriptor->Ports[i].Type; |
|
|
|
|
|
Port->Properties = rdf_descriptor->Ports[i].Properties; |
|
|
|
|
|
Port->Designation = rdf_descriptor->Ports[i].Designation; |
|
|
|
|
|
|
|
|
|
|
|
Port->MidiMap.Type = rdf_descriptor->Ports[i].MidiMap.Type; |
|
|
|
|
|
Port->MidiMap.Number = rdf_descriptor->Ports[i].MidiMap.Number; |
|
|
|
|
|
|
|
|
|
|
|
Port->Points.Hints = rdf_descriptor->Ports[i].Points.Hints; |
|
|
|
|
|
Port->Points.Default = rdf_descriptor->Ports[i].Points.Default; |
|
|
|
|
|
Port->Points.Minimum = rdf_descriptor->Ports[i].Points.Minimum; |
|
|
|
|
|
Port->Points.Maximum = rdf_descriptor->Ports[i].Points.Maximum; |
|
|
|
|
|
|
|
|
|
|
|
Port->Unit.Type = rdf_descriptor->Ports[i].Unit.Type; |
|
|
|
|
|
Port->Unit.Hints = rdf_descriptor->Ports[i].Unit.Hints; |
|
|
|
|
|
|
|
|
|
|
|
Port->ScalePointCount = rdf_descriptor->Ports[i].ScalePointCount; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].Name) |
|
|
|
|
|
Port->Name = strdup(rdf_descriptor->Ports[i].Name); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].Symbol) |
|
|
|
|
|
Port->Symbol = strdup(rdf_descriptor->Ports[i].Symbol); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].Unit.Name) |
|
|
|
|
|
Port->Unit.Name = strdup(rdf_descriptor->Ports[i].Unit.Name); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].Unit.Render) |
|
|
|
|
|
Port->Unit.Render = strdup(rdf_descriptor->Ports[i].Unit.Render); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].Unit.Symbol) |
|
|
|
|
|
Port->Unit.Symbol = strdup(rdf_descriptor->Ports[i].Unit.Symbol); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->ScalePointCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
Port->ScalePoints = new LV2_RDF_PortScalePoint[Port->ScalePointCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t j=0; j < Port->ScalePointCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
Port->ScalePoints[j].Value = rdf_descriptor->Ports[i].ScalePoints[j].Value; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Ports[i].ScalePoints[j].Label) |
|
|
|
|
|
Port->ScalePoints[j].Label = strdup(rdf_descriptor->Ports[i].ScalePoints[j].Label); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
// Presets |
|
|
|
|
|
if (new_descriptor->PresetCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->Presets = new LV2_RDF_Preset[new_descriptor->PresetCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0; i < new_descriptor->PresetCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
LV2_RDF_Preset* const Preset = &new_descriptor->Presets[i]; |
|
|
|
|
|
|
|
|
|
|
|
Preset->PortCount = rdf_descriptor->Presets[i].PortCount; |
|
|
|
|
|
Preset->StateCount = rdf_descriptor->Presets[i].StateCount; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Presets[i].URI) |
|
|
|
|
|
Preset->URI = strdup(rdf_descriptor->Presets[i].URI); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Presets[i].Label) |
|
|
|
|
|
Preset->Label = strdup(rdf_descriptor->Presets[i].Label); |
|
|
|
|
|
|
|
|
|
|
|
// Ports |
|
|
|
|
|
if (Preset->PortCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
Preset->Ports = new LV2_RDF_PresetPort[Preset->PortCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t j=0; j < Preset->PortCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
Preset->Ports[j].Value = rdf_descriptor->Presets[i].Ports[j].Value; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Presets[i].Ports[j].Symbol) |
|
|
|
|
|
Preset->Ports[j].Symbol = strdup(rdf_descriptor->Presets[i].Ports[j].Symbol); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// States |
|
|
|
|
|
if (Preset->StateCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
Preset->States = new LV2_RDF_PresetState[Preset->StateCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t j=0; j < Preset->StateCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
Preset->States[j].Type = rdf_descriptor->Presets[i].States[j].Type; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Presets[i].States[j].Key) |
|
|
|
|
|
Preset->States[j].Key = strdup(rdf_descriptor->Presets[i].States[j].Key); |
|
|
|
|
|
|
|
|
|
|
|
// TODO - copy value |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Features |
|
|
|
|
|
if (new_descriptor->FeatureCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->Features = new LV2_RDF_Feature[new_descriptor->FeatureCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0; i < new_descriptor->FeatureCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->Features[i].Type = rdf_descriptor->Features[i].Type; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Features[i].URI) |
|
|
|
|
|
new_descriptor->Features[i].URI = strdup(rdf_descriptor->Features[i].URI); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Extensions |
|
|
|
|
|
if (new_descriptor->ExtensionCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->Extensions = new LV2_URI[new_descriptor->ExtensionCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0; i < new_descriptor->ExtensionCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (rdf_descriptor->Extensions[i]) |
|
|
|
|
|
new_descriptor->Extensions[i] = strdup(rdf_descriptor->Extensions[i]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UIs |
|
|
|
|
|
if (new_descriptor->UICount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
new_descriptor->UIs = new LV2_RDF_UI[new_descriptor->UICount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t i=0; i < new_descriptor->UICount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
LV2_RDF_UI* const UI = &new_descriptor->UIs[i]; |
|
|
|
|
|
|
|
|
|
|
|
UI->Type = rdf_descriptor->UIs[i].Type; |
|
|
|
|
|
|
|
|
|
|
|
UI->FeatureCount = rdf_descriptor->UIs[i].FeatureCount; |
|
|
|
|
|
UI->ExtensionCount = rdf_descriptor->UIs[i].ExtensionCount; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->UIs[i].URI) |
|
|
|
|
|
UI->URI = strdup(rdf_descriptor->UIs[i].URI); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->UIs[i].Binary) |
|
|
|
|
|
UI->Binary = strdup(rdf_descriptor->UIs[i].Binary); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->UIs[i].Bundle) |
|
|
|
|
|
UI->Bundle = strdup(rdf_descriptor->UIs[i].Bundle); |
|
|
|
|
|
|
|
|
|
|
|
// UI Features |
|
|
|
|
|
if (UI->FeatureCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
UI->Features = new LV2_RDF_Feature[UI->FeatureCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t j=0; j < UI->FeatureCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
UI->Features[j].Type = rdf_descriptor->UIs[i].Features[j].Type; |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->UIs[i].Features[j].URI) |
|
|
|
|
|
UI->Features[j].URI = strdup(rdf_descriptor->UIs[i].Features[j].URI); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UI Extensions |
|
|
|
|
|
if (UI->ExtensionCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
UI->Extensions = new LV2_URI[UI->ExtensionCount]; |
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t j=0; j < UI->ExtensionCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (rdf_descriptor->UIs[i].Extensions[j]) |
|
|
|
|
|
UI->Extensions[j] = strdup(rdf_descriptor->UIs[i].Extensions[j]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new_descriptor; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Delete object |
|
|
|
|
|
static inline |
|
|
|
|
|
void lv2_rdf_free(const LV2_RDF_Descriptor* const rdf_descriptor) |
|
|
|
|
|
{ |
|
|
|
|
|
if (rdf_descriptor->URI) |
|
|
|
|
|
free((void*)rdf_descriptor->URI); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Name) |
|
|
|
|
|
free((void*)rdf_descriptor->Name); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Author) |
|
|
|
|
|
free((void*)rdf_descriptor->Author); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->License) |
|
|
|
|
|
free((void*)rdf_descriptor->License); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Binary) |
|
|
|
|
|
free((void*)rdf_descriptor->Binary); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->Bundle) |
|
|
|
|
|
free((void*)rdf_descriptor->Bundle); |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->PortCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t i=0; i < rdf_descriptor->PortCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_Port* const Port = &rdf_descriptor->Ports[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (Port->Name) |
|
|
|
|
|
free((void*)Port->Name); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->Symbol) |
|
|
|
|
|
free((void*)Port->Symbol); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->Unit.Name) |
|
|
|
|
|
free((void*)Port->Unit.Name); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->Unit.Render) |
|
|
|
|
|
free((void*)Port->Unit.Render); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->Unit.Symbol) |
|
|
|
|
|
free((void*)Port->Unit.Symbol); |
|
|
|
|
|
|
|
|
|
|
|
if (Port->ScalePointCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t j=0; j < Port->ScalePointCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_PortScalePoint* const PortScalePoint = &Port->ScalePoints[j]; |
|
|
|
|
|
|
|
|
|
|
|
if (PortScalePoint->Label) |
|
|
|
|
|
free((void*)PortScalePoint->Label); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] Port->ScalePoints; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
delete[] rdf_descriptor->Ports; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
if (rdf_descriptor->PresetCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t i=0; i < rdf_descriptor->PresetCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_Preset* const Preset = &rdf_descriptor->Presets[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (Preset->URI) |
|
|
|
|
|
free((void*)Preset->URI); |
|
|
|
|
|
|
|
|
|
|
|
if (Preset->Label) |
|
|
|
|
|
free((void*)Preset->Label); |
|
|
|
|
|
|
|
|
|
|
|
if (Preset->PortCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t j=0; j < Preset->PortCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_PresetPort* const PresetPort = &Preset->Ports[j]; |
|
|
|
|
|
|
|
|
|
|
|
if (PresetPort->Symbol) |
|
|
|
|
|
free((void*)PresetPort->Symbol); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] Preset->Ports; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (Preset->StateCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t j=0; j < Preset->StateCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_PresetState* const PresetState = &Preset->States[j]; |
|
|
|
|
|
|
|
|
|
|
|
if (PresetState->Key) |
|
|
|
|
|
free((void*)PresetState->Key); |
|
|
|
|
|
|
|
|
|
|
|
// TODO - delete value |
|
|
|
|
|
} |
|
|
|
|
|
delete[] Preset->States; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
delete[] rdf_descriptor->Presets; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->FeatureCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t i=0; i < rdf_descriptor->FeatureCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_Feature* const Feature = &rdf_descriptor->Features[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (Feature->URI) |
|
|
|
|
|
free((void*)Feature->URI); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] rdf_descriptor->Features; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->ExtensionCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t i=0; i < rdf_descriptor->ExtensionCount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_URI Extension = rdf_descriptor->Extensions[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (Extension) |
|
|
|
|
|
free((void*)Extension); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] rdf_descriptor->Extensions; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (rdf_descriptor->UICount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t i=0; i < rdf_descriptor->UICount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_UI* const UI = &rdf_descriptor->UIs[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (UI->URI) |
|
|
|
|
|
free((void*)UI->URI); |
|
|
|
|
|
|
|
|
|
|
|
if (UI->Binary) |
|
|
|
|
|
free((void*)UI->Binary); |
|
|
|
|
|
|
|
|
|
|
|
if (UI->Bundle) |
|
|
|
|
|
free((void*)UI->Bundle); |
|
|
|
|
|
|
|
|
|
|
|
if (UI->FeatureCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t j=0; j < UI->FeatureCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_RDF_Feature* const Feature = &UI->Features[j]; |
|
|
|
|
|
|
|
|
|
|
|
if (Feature->URI) |
|
|
|
|
|
free((void*)Feature->URI); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] UI->Features; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (UI->ExtensionCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
for (uint32_t j=0; j < UI->ExtensionCount; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
const LV2_URI Extension = UI->Extensions[j]; |
|
|
|
|
|
|
|
|
|
|
|
if (Extension) |
|
|
|
|
|
free((void*)Extension); |
|
|
|
|
|
} |
|
|
|
|
|
delete[] UI->Extensions; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
delete[] rdf_descriptor->UIs; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete rdf_descriptor; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------ |
|
|
// ------------------------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
|
static inline |
|
|
static inline |
|
|
|