@@ -100,8 +100,10 @@ def CustomDataType2String(dtype): | |||
elif (dtype == CUSTOM_DATA_FLOAT): | |||
return "float" | |||
elif (dtype == CUSTOM_DATA_STRING): | |||
print("Carla requiested type save - string", dtype) | |||
return "string" | |||
elif (dtype == CUSTOM_DATA_BINARY): | |||
print("Carla requiested type save - binary", dtype) | |||
return "binary" | |||
else: | |||
return "null" | |||
@@ -23,6 +23,7 @@ | |||
#include "lv2/lv2.h" | |||
#include "lv2/atom.h" | |||
#include "lv2/atom-util.h" | |||
#include "lv2/data-access.h" | |||
#include "lv2/event.h" | |||
#include "lv2/event-helpers.h" | |||
@@ -79,11 +80,13 @@ const unsigned int CARLA_EVENT_TYPE_MIDI = 0x10; | |||
const unsigned int CARLA_EVENT_TYPE_TIME = 0x20; | |||
// pre-set uri[d] map ids | |||
const uint32_t CARLA_URI_MAP_ID_NULL = 0; | |||
const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 1; | |||
const uint32_t CARLA_URI_MAP_ID_EVENT_MIDI = 2; | |||
const uint32_t CARLA_URI_MAP_ID_EVENT_TIME = 3; | |||
const uint32_t CARLA_URI_MAP_ID_COUNT = 4; | |||
const uint32_t CARLA_URI_MAP_ID_NULL = 0; | |||
const uint32_t CARLA_URI_MAP_ID_ATOM_CHUNK = 1; | |||
const uint32_t CARLA_URI_MAP_ID_ATOM_SEQUENCE = 2; | |||
const uint32_t CARLA_URI_MAP_ID_ATOM_STRING = 3; | |||
const uint32_t CARLA_URI_MAP_ID_EVENT_MIDI = 4; | |||
const uint32_t CARLA_URI_MAP_ID_EVENT_TIME = 5; | |||
const uint32_t CARLA_URI_MAP_ID_COUNT = 6; | |||
enum Lv2ParameterDataType { | |||
LV2_PARAMETER_TYPE_CONTROL, | |||
@@ -94,6 +97,7 @@ struct EventData { | |||
unsigned int types; | |||
jack_port_t* port; | |||
union { | |||
LV2_Atom_Sequence* a; | |||
LV2_Event_Buffer* e; | |||
LV2_MIDI* m; | |||
} buffer; | |||
@@ -316,8 +320,7 @@ public: | |||
else if (LV2_IS_DYNAMICS(Category)) | |||
return PLUGIN_CATEGORY_DYNAMICS; | |||
// TODO - try to get category from label | |||
return PLUGIN_CATEGORY_NONE; | |||
return get_category_from_name(m_name); | |||
} | |||
virtual long unique_id() | |||
@@ -550,6 +553,8 @@ public: | |||
virtual void set_custom_data(CustomDataType dtype, const char* key, const char* value, bool gui_send) | |||
{ | |||
CarlaPlugin::set_custom_data(dtype, key, value, gui_send); | |||
if ((m_hints & PLUGIN_HAS_EXTENSION_STATE) > 0 && descriptor->extension_data) | |||
{ | |||
LV2_State_Interface* state = (LV2_State_Interface*)descriptor->extension_data(LV2_STATE__interface); | |||
@@ -557,8 +562,6 @@ public: | |||
if (state) | |||
state->restore(handle, carla_lv2_state_retrieve, this, 0, features); | |||
} | |||
CarlaPlugin::set_custom_data(dtype, key, value, gui_send); | |||
} | |||
virtual void set_gui_data(int, void* ptr) | |||
@@ -646,10 +649,10 @@ public: | |||
LV2_EXTERNAL_UI_HIDE((lv2_external_ui*)ui.widget); | |||
gui.visible = false; | |||
if (ui.descriptor->cleanup) | |||
ui.descriptor->cleanup(ui.handle); | |||
//if (ui.descriptor->cleanup) | |||
// ui.descriptor->cleanup(ui.handle); | |||
ui.handle = nullptr; | |||
//ui.handle = nullptr; | |||
} | |||
} | |||
else | |||
@@ -736,6 +739,15 @@ public: | |||
else if (LV2_IS_PORT_OUTPUT(PortType)) | |||
cv_outs += 1; | |||
} | |||
else if (LV2_IS_PORT_ATOM_SEQUENCE(PortType)) | |||
{ | |||
qDebug("Atom Sequence port found, index: %i, name: %s", i, rdf_descriptor->Ports[i].Name); | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
ev_ins += 1; | |||
else if (LV2_IS_PORT_OUTPUT(PortType)) | |||
ev_outs += 1; | |||
event_data_type = CARLA_EVENT_DATA_ATOM; | |||
} | |||
else if (LV2_IS_PORT_EVENT(PortType)) | |||
{ | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
@@ -754,14 +766,16 @@ public: | |||
} | |||
else if (LV2_IS_PORT_CONTROL(PortType)) | |||
params += 1; | |||
else | |||
qDebug("Unknown port type found, index: %i, name: %s", i, rdf_descriptor->Ports[i].Name); | |||
} | |||
// if (params == 0 && (hints & PLUGIN_HAS_EXTENSION_DYNPARAM) > 0) | |||
// { | |||
// dynparam_plugin = (lv2dynparam_plugin_callbacks*)descriptor->extension_data(LV2DYNPARAM_URI); | |||
// if (dynparam_plugin) | |||
// dynparam_plugin->host_attach(handle, &dynparam_host, this); | |||
// } | |||
// if (params == 0 && (hints & PLUGIN_HAS_EXTENSION_DYNPARAM) > 0) | |||
// { | |||
// dynparam_plugin = (lv2dynparam_plugin_callbacks*)descriptor->extension_data(LV2DYNPARAM_URI); | |||
// if (dynparam_plugin) | |||
// dynparam_plugin->host_attach(handle, &dynparam_host, this); | |||
// } | |||
if (ains > 0) | |||
{ | |||
@@ -785,8 +799,12 @@ public: | |||
if (event_data_type == CARLA_EVENT_DATA_ATOM) | |||
{ | |||
evin.data[j].types = CARLA_EVENT_DATA_ATOM; | |||
// TODO | |||
evin.data[j].types = CARLA_EVENT_DATA_ATOM; | |||
evin.data[j].buffer.a = (LV2_Atom_Sequence*)malloc(sizeof(LV2_Atom_Sequence) + MAX_EVENT_BUFFER); | |||
evin.data[j].buffer.a->atom.size = sizeof(LV2_Atom_Sequence_Body); | |||
evin.data[j].buffer.a->atom.type = CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
evin.data[j].buffer.a->body.unit = CARLA_URI_MAP_ID_NULL; | |||
evin.data[j].buffer.a->body.pad = 0; | |||
} | |||
else if (event_data_type == CARLA_EVENT_DATA_EVENT) | |||
{ | |||
@@ -815,8 +833,12 @@ public: | |||
if (event_data_type == CARLA_EVENT_DATA_ATOM) | |||
{ | |||
evout.data[j].types = CARLA_EVENT_DATA_ATOM; | |||
// TODO | |||
evout.data[j].types = CARLA_EVENT_DATA_ATOM; | |||
evout.data[j].buffer.a = (LV2_Atom_Sequence*)malloc(sizeof(LV2_Atom_Sequence) + MAX_EVENT_BUFFER); | |||
evout.data[j].buffer.a->atom.size = sizeof(LV2_Atom_Sequence_Body); | |||
evout.data[j].buffer.a->atom.type = CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
evout.data[j].buffer.a->body.unit = CARLA_URI_MAP_ID_NULL; | |||
evout.data[j].buffer.a->body.pad = 0; | |||
} | |||
else if (event_data_type == CARLA_EVENT_DATA_EVENT) | |||
{ | |||
@@ -825,7 +847,7 @@ public: | |||
} | |||
else if (event_data_type == CARLA_EVENT_DATA_MIDI_LL) | |||
{ | |||
evout.data[j].types = CARLA_EVENT_DATA_MIDI_LL; | |||
evout.data[j].types = CARLA_EVENT_DATA_MIDI_LL; | |||
evout.data[j].buffer.m = new LV2_MIDI; | |||
evout.data[j].buffer.m->capacity = MAX_EVENT_BUFFER; | |||
evout.data[j].buffer.m->data = new unsigned char [MAX_EVENT_BUFFER]; | |||
@@ -851,7 +873,7 @@ public: | |||
{ | |||
const LV2_Property PortType = rdf_descriptor->Ports[i].Type; | |||
if (LV2_IS_PORT_AUDIO(PortType) || LV2_IS_PORT_CV(PortType) || LV2_IS_PORT_EVENT(PortType) || LV2_IS_PORT_MIDI_LL(PortType)) | |||
if (LV2_IS_PORT_AUDIO(PortType) || LV2_IS_PORT_ATOM_SEQUENCE(PortType) || LV2_IS_PORT_CV(PortType) || LV2_IS_PORT_EVENT(PortType) || LV2_IS_PORT_MIDI_LL(PortType)) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carla_options.global_jack_client) | |||
@@ -898,6 +920,41 @@ public: | |||
descriptor->connect_port(handle, i, nullptr); | |||
} | |||
else if (LV2_IS_PORT_ATOM_SEQUENCE(PortType)) | |||
{ | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
{ | |||
j = evin.count++; | |||
descriptor->connect_port(handle, i, evin.data[j].buffer.a); | |||
if (PortType & LV2_PORT_SUPPORTS_MIDI) | |||
{ | |||
evin.data[j].types |= CARLA_EVENT_TYPE_MIDI; | |||
evin.data[j].port = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | |||
} | |||
if (PortType & LV2_PORT_SUPPORTS_TIME) | |||
{ | |||
evin.data[j].types |= CARLA_EVENT_TYPE_TIME; | |||
} | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(PortType)) | |||
{ | |||
j = evout.count++; | |||
descriptor->connect_port(handle, i, evout.data[j].buffer.a); | |||
if (PortType & LV2_PORT_SUPPORTS_MIDI) | |||
{ | |||
evout.data[j].types |= CARLA_EVENT_TYPE_MIDI; | |||
evout.data[j].port = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | |||
} | |||
if (PortType & LV2_PORT_SUPPORTS_TIME) | |||
{ | |||
evout.data[j].types |= CARLA_EVENT_TYPE_TIME; | |||
} | |||
} | |||
else | |||
qWarning("WARNING - Got a broken Port (Atom Sequence, but not input or output)"); | |||
} | |||
else if (LV2_IS_PORT_EVENT(PortType)) | |||
{ | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
@@ -905,12 +962,12 @@ public: | |||
j = evin.count++; | |||
descriptor->connect_port(handle, i, evin.data[j].buffer.e); | |||
if (LV2_IS_PORT_EVENT_MIDI(PortType)) | |||
if (PortType & LV2_PORT_SUPPORTS_MIDI) | |||
{ | |||
evin.data[j].types |= CARLA_EVENT_TYPE_MIDI; | |||
evin.data[j].port = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | |||
} | |||
if (LV2_IS_PORT_EVENT_TIME(PortType)) | |||
if (PortType & LV2_PORT_SUPPORTS_TIME) | |||
{ | |||
evin.data[j].types |= CARLA_EVENT_TYPE_TIME; | |||
} | |||
@@ -920,12 +977,12 @@ public: | |||
j = evout.count++; | |||
descriptor->connect_port(handle, i, evout.data[j].buffer.e); | |||
if (LV2_IS_PORT_EVENT_MIDI(PortType)) | |||
if (PortType & LV2_PORT_SUPPORTS_MIDI) | |||
{ | |||
evout.data[j].types |= CARLA_EVENT_TYPE_MIDI; | |||
evout.data[j].port = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | |||
} | |||
if (LV2_IS_PORT_EVENT_TIME(PortType)) | |||
if (PortType & LV2_PORT_SUPPORTS_TIME) | |||
{ | |||
evout.data[j].types |= CARLA_EVENT_TYPE_TIME; | |||
} | |||
@@ -1200,8 +1257,10 @@ public: | |||
void* evouts_buffer[evout.count]; | |||
// different midi APIs | |||
LV2_MIDIState evin_states[evin.count]; | |||
uint32_t atomSequenceOffsets[evin.count]; | |||
LV2_Event_Iterator evin_iters[evin.count]; | |||
LV2_MIDIState evin_states[evin.count]; | |||
for (i=0; i < ain.count; i++) | |||
ains_buffer[i] = (jack_default_audio_sample_t*)jack_port_get_buffer(ain.ports[i], nframes); | |||
@@ -1213,6 +1272,11 @@ public: | |||
{ | |||
if (evin.data[i].types & CARLA_EVENT_DATA_ATOM) | |||
{ | |||
atomSequenceOffsets[i] = 0; | |||
evin.data[i].buffer.a->atom.size = 0; | |||
evin.data[i].buffer.a->atom.type = CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
evin.data[i].buffer.a->body.unit = CARLA_URI_MAP_ID_NULL; | |||
evin.data[i].buffer.a->body.pad = 0; | |||
} | |||
else if (evin.data[i].types & CARLA_EVENT_DATA_EVENT) | |||
{ | |||
@@ -1237,14 +1301,18 @@ public: | |||
for (i=0; i < evout.count; i++) | |||
{ | |||
if (evin.data[i].types & CARLA_EVENT_DATA_ATOM) | |||
if (evout.data[i].types & CARLA_EVENT_DATA_ATOM) | |||
{ | |||
evout.data[i].buffer.a->atom.size = 0; | |||
evout.data[i].buffer.a->atom.type = CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
evout.data[i].buffer.a->body.unit = CARLA_URI_MAP_ID_NULL; | |||
evout.data[i].buffer.a->body.pad = 0; | |||
} | |||
else if (evin.data[i].types & CARLA_EVENT_DATA_EVENT) | |||
else if (evout.data[i].types & CARLA_EVENT_DATA_EVENT) | |||
{ | |||
lv2_event_buffer_reset(evout.data[i].buffer.e, LV2_EVENT_AUDIO_STAMP, (uint8_t*)(evout.data[i].buffer.e + 1)); | |||
} | |||
else if (evin.data[i].types & CARLA_EVENT_DATA_MIDI_LL) | |||
else if (evout.data[i].types & CARLA_EVENT_DATA_MIDI_LL) | |||
{ | |||
// not needed | |||
} | |||
@@ -1432,9 +1500,20 @@ public: | |||
if (evin.data[k].types & CARLA_EVENT_TYPE_MIDI) | |||
{ | |||
if (evin.data[k].types & CARLA_EVENT_DATA_ATOM) | |||
continue; // TODO | |||
{ | |||
LV2_Atom_Event* aev = (LV2_Atom_Event*)((char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, evin.data[k].buffer.a) + atomSequenceOffsets[k]); | |||
aev->time.frames = 0; | |||
aev->body.type = CARLA_URI_MAP_ID_EVENT_MIDI; | |||
aev->body.size = 3; | |||
memcpy(LV2_ATOM_BODY(&aev->body), midi_event, 3); | |||
uint32_t size = lv2_atom_pad_size(sizeof(LV2_Atom_Event) + 3); | |||
atomSequenceOffsets[k] += size; | |||
evin.data[k].buffer.a->atom.size += size; | |||
} | |||
else if (evin.data[k].types & CARLA_EVENT_DATA_EVENT) | |||
lv2_event_write(&evin_iters[k], 0, 0, CARLA_URI_MAP_ID_EVENT_MIDI, 3, midi_event); | |||
else if (evin.data[k].types & CARLA_EVENT_DATA_MIDI_LL) | |||
lv2midi_put_event(&evin_states[k], 0, 3, midi_event); | |||
} | |||
@@ -1720,6 +1799,7 @@ public: | |||
{ | |||
if (evin.data[i].types & CARLA_EVENT_DATA_ATOM) | |||
{ | |||
free(evin.data[i].buffer.a); | |||
} | |||
else if (evin.data[i].types & CARLA_EVENT_DATA_EVENT) | |||
{ | |||
@@ -1741,6 +1821,7 @@ public: | |||
{ | |||
if (evout.data[i].types & CARLA_EVENT_DATA_ATOM) | |||
{ | |||
free(evout.data[i].buffer.a); | |||
} | |||
else if (evout.data[i].types & CARLA_EVENT_DATA_EVENT) | |||
{ | |||
@@ -1907,6 +1988,7 @@ public: | |||
LV2_Property PortType = rdf_descriptor->Ports[i].Type; | |||
if (bool(LV2_IS_PORT_AUDIO(PortType) || LV2_IS_PORT_CONTROL(PortType) || LV2_IS_PORT_EVENT(PortType) || LV2_IS_PORT_MIDI_LL(PortType)) == false) | |||
{ | |||
qCritical("Got unsupported port -> %i", PortType); | |||
if (! LV2_IS_PORT_OPTIONAL(rdf_descriptor->Ports[i].Properties)) | |||
{ | |||
set_last_error("Plugin requires a port that is not currently supported"); | |||
@@ -1926,8 +2008,6 @@ public: | |||
can_continue = false; | |||
break; | |||
} | |||
else | |||
qDebug("Plugin wants a feature that is not supported:\n%s", rdf_descriptor->Features[i].URI); | |||
} | |||
// Check extensions (...) | |||
@@ -2008,17 +2088,17 @@ public: | |||
switch (rdf_descriptor->UIs[i].Type) | |||
{ | |||
case LV2_UI_QT4: | |||
if (is_ui_bridgeable(i)) | |||
eQt4 = i; | |||
else | |||
iQt4 = i; | |||
//if (is_ui_bridgeable(i)) | |||
// eQt4 = i; | |||
//else | |||
iQt4 = i; | |||
break; | |||
case LV2_UI_X11: | |||
if (is_ui_bridgeable(i)) | |||
eX11 = i; | |||
else | |||
iX11 = i; | |||
//if (is_ui_bridgeable(i)) | |||
// eX11 = i; | |||
//else | |||
iX11 = i; | |||
break; | |||
case LV2_UI_GTK2: | |||
@@ -2293,6 +2373,14 @@ public: | |||
else if (strcmp(uri, "http://lv2plug.in/ns/ext/time#Position") == 0) | |||
return CARLA_URI_MAP_ID_EVENT_TIME; | |||
} | |||
else if (strcmp(uri, LV2_ATOM__Chunk) == 0) | |||
{ | |||
return CARLA_URI_MAP_ID_ATOM_CHUNK; | |||
} | |||
else if (strcmp(uri, LV2_ATOM__Sequence) == 0) | |||
{ | |||
return CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
} | |||
else if (strcmp(uri, LV2_ATOM__String) == 0) | |||
{ | |||
return CARLA_URI_MAP_ID_ATOM_STRING; | |||
@@ -2317,6 +2405,10 @@ public: | |||
return CARLA_URI_MAP_ID_EVENT_MIDI; | |||
else if (strcmp(uri, "http://lv2plug.in/ns/ext/time#Position") == 0) | |||
return CARLA_URI_MAP_ID_EVENT_TIME; | |||
else if (strcmp(uri, LV2_ATOM__Chunk) == 0) | |||
return CARLA_URI_MAP_ID_ATOM_CHUNK; | |||
else if (strcmp(uri, LV2_ATOM__Sequence) == 0) | |||
return CARLA_URI_MAP_ID_ATOM_SEQUENCE; | |||
else if (strcmp(uri, LV2_ATOM__String) == 0) | |||
return CARLA_URI_MAP_ID_ATOM_STRING; | |||
@@ -2338,6 +2430,10 @@ public: | |||
return "http://lv2plug.in/ns/ext/midi#MidiEvent"; | |||
else if (urid == CARLA_URI_MAP_ID_EVENT_TIME) | |||
return "http://lv2plug.in/ns/ext/time#Position"; | |||
else if (urid == CARLA_URI_MAP_ID_ATOM_CHUNK) | |||
return LV2_ATOM__Chunk; | |||
else if (urid == CARLA_URI_MAP_ID_ATOM_SEQUENCE) | |||
return LV2_ATOM__Sequence; | |||
else if (urid == CARLA_URI_MAP_ID_ATOM_STRING) | |||
return LV2_ATOM__String; | |||
@@ -136,29 +136,24 @@ struct LV2_RDF_PortScalePoint { | |||
#define LV2_PORT_OUTPUT 0x02 | |||
#define LV2_PORT_CONTROL 0x04 | |||
#define LV2_PORT_AUDIO 0x08 | |||
#define LV2_PORT_ATOM_MESSAGE 0x10 | |||
#define LV2_PORT_ATOM_VALUE 0x20 | |||
#define LV2_PORT_ATOM 0x10 | |||
#define LV2_PORT_ATOM_SEQUENCE (0x20 | LV2_PORT_ATOM) | |||
#define LV2_PORT_CV 0x40 | |||
#define LV2_PORT_EVENT 0x80 | |||
#define LV2_PORT_MIDI_LL 0x100 | |||
// TODO - Port Atom types | |||
// Port Event types | |||
#define LV2_PORT_EVENT_MIDI 0x1000 | |||
#define LV2_PORT_EVENT_TIME 0x2000 | |||
// Port Support Types | |||
#define LV2_PORT_SUPPORTS_MIDI 0x1000 | |||
#define LV2_PORT_SUPPORTS_TIME 0x2000 | |||
#define LV2_IS_PORT_INPUT(x) ((x) & LV2_PORT_INPUT) | |||
#define LV2_IS_PORT_OUTPUT(x) ((x) & LV2_PORT_OUTPUT) | |||
#define LV2_IS_PORT_CONTROL(x) ((x) & LV2_PORT_CONTROL) | |||
#define LV2_IS_PORT_AUDIO(x) ((x) & LV2_PORT_AUDIO) | |||
#define LV2_IS_PORT_ATOM_MESSAGE(x) ((x) & LV2_PORT_ATOM_MESSAGE) | |||
#define LV2_IS_PORT_ATOM_VALUE(x) ((x) & LV2_PORT_ATOM_VALUE) | |||
#define LV2_IS_PORT_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE) | |||
#define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV) | |||
#define LV2_IS_PORT_EVENT(x) ((x) & LV2_PORT_EVENT) | |||
#define LV2_IS_PORT_MIDI_LL(x) ((x) & LV2_PORT_MIDI_LL) | |||
#define LV2_IS_PORT_EVENT_MIDI(x) ((x) & LV2_PORT_EVENT_MIDI) | |||
#define LV2_IS_PORT_EVENT_TIME(x) ((x) & LV2_PORT_EVENT_TIME) | |||
// Port Properties | |||
#define LV2_PORT_OPTIONAL 0x00001 | |||
@@ -184,7 +184,9 @@ else: | |||
] | |||
# ------------------------------------------------------------------------------------------------ | |||
# Carla command-line tools | |||
# Search for Carla library and tools | |||
carla_library_path = "" | |||
carla_discovery_unix32 = "" | |||
carla_discovery_unix64 = "" | |||
@@ -200,6 +202,13 @@ carla_bridge_lv2_gtk2 = "" | |||
carla_bridge_lv2_qt4 = "" | |||
carla_bridge_lv2_x11 = "" | |||
if (WINDOWS): | |||
carla_libname = "carla_backend.dll" | |||
elif (MACOS): | |||
carla_libname = "carla_backend.dylib" | |||
else: | |||
carla_libname = "carla_backend.so" | |||
if (WINDOWS): | |||
PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),) | |||
@@ -213,6 +222,23 @@ else: | |||
CWD = sys.path[0] | |||
# carla-backend | |||
if (os.path.exists(os.path.join(CWD, "carla", carla_libname))): | |||
carla_library_path = os.path.join(CWD, "carla", carla_libname) | |||
else: | |||
if (WINDOWS): | |||
CARLA_PATH = (os.path.join(PROGRAMFILES, "Cadence"),) | |||
elif (MACOS): | |||
CARLA_PATH = ("/usr/lib", "/usr/local/lib/") # FIXME | |||
else: | |||
CARLA_PATH = ("/usr/lib", "/usr/local/lib/") | |||
for p in CARLA_PATH: | |||
if (os.path.exists(os.path.join(p, "carla", carla_libname))): | |||
carla_library_path = os.path.join(p, "carla", carla_libname) | |||
break | |||
print(carla_library_path) | |||
# discovery-unix32 | |||
if (os.path.exists(os.path.join(CWD, "carla-discovery", "carla-discovery-unix32"))): | |||
carla_discovery_unix32 = os.path.join(CWD, "carla-discovery", "carla-discovery-unix32") | |||
@@ -547,7 +573,7 @@ def checkPluginLV2(rdf_info): | |||
elif (PortType & lv2_rdf.LV2_PORT_OUTPUT): | |||
pinfo['audio.outs'] += 1 | |||
elif (PortType & lv2_rdf.LV2_PORT_EVENT_MIDI): | |||
elif (PortType & lv2_rdf.LV2_PORT_SUPPORTS_MIDI): | |||
pinfo['midi.total'] += 1 | |||
if (PortType & lv2_rdf.LV2_PORT_INPUT): | |||
pinfo['midi.ins'] += 1 | |||
@@ -791,14 +817,7 @@ class Host(object): | |||
def __init__(self): | |||
object.__init__(self) | |||
if (WINDOWS): | |||
libname = "carla_backend.dll" | |||
elif (MACOS): | |||
libname = "carla_backend.dylib" | |||
else: | |||
libname = "carla_backend.so" | |||
self.lib = cdll.LoadLibrary(os.path.join("carla", libname)) | |||
self.lib = cdll.LoadLibrary(carla_library_path) | |||
self.lib.carla_init.argtypes = [c_char_p] | |||
self.lib.carla_init.restype = c_bool | |||
@@ -113,8 +113,14 @@ class DigitalPeakMeter(QWidget): | |||
value = 5 | |||
self.m_smoothMultiplier = value | |||
def minimumSizeHint(self): | |||
return QSize(30, 30) | |||
def sizeHint(self): | |||
return QSize(self.m_width, self.m_height) | |||
def updateSizes(self): | |||
self.m_width = self.width() | |||
self.m_width = self.width() | |||
self.m_height = self.height() | |||
self.m_sizeMeter = 0 | |||
@@ -130,12 +136,6 @@ class DigitalPeakMeter(QWidget): | |||
self.update() | |||
def minimumSizeHint(self): | |||
return QSize(30, 30) | |||
def sizeHint(self): | |||
return QSize(self.m_width, self.m_height) | |||
def paintEvent(self, event): | |||
painter = QPainter(self) | |||
@@ -152,14 +152,14 @@ class DigitalPeakMeter(QWidget): | |||
continue | |||
if (self.m_orientation == self.HORIZONTAL): | |||
value = self.m_width*level | |||
value = level*self.m_width | |||
elif (self.m_orientation == self.VERTICAL): | |||
value = self.m_height-(self.m_height*level) | |||
value = float(self.m_height)-(level*self.m_height) | |||
else: | |||
value = 0 | |||
value = 0.0 | |||
if (value < 0): | |||
value = 0 | |||
if (value < 0.0): | |||
value = 0.0 | |||
# Don't bounce the meter so much | |||
if (self.m_smoothMultiplier > 0): | |||
@@ -224,7 +224,7 @@ class DigitalPeakMeter(QWidget): | |||
painter.setPen(QColor(110, 15, 15, 100)) | |||
painter.drawLine(1, lsmall-(lsmall/1.04), lfull, lsmall-(lsmall/1.04)) | |||
QWidget.paintEvent(self, event) | |||
#QWidget.paintEvent(self, event) | |||
def resizeEvent(self, event): | |||
self.updateSizes() | |||
@@ -13,16 +13,14 @@ LV2_HOST_INFO_URI = "http://lv2plug.in/ns/ext/host-info" | |||
LV2_INSTANCE_ACCESS_URI = "http://lv2plug.in/ns/ext/instance-access" | |||
LV2_LOG_URI = "http://lv2plug.in/ns/ext/log" | |||
LV2_MIDI_URI = "http://lv2plug.in/ns/ext/midi" | |||
LV2_PARAMETERS_URI = "http://lv2plug.in/ns/ext/parameters" # FIXME? | |||
LV2_PATCH_URI = "http://lv2plug.in/ns/ext/patch" | |||
LV2_PORT_GROUPS_URI = "http://lv2plug.in/ns/ext/port-groups" | |||
LV2_PORT_PROPS_URI = "http://lv2plug.in/ns/ext/port-props" | |||
LV2_PRESETS_URI = "http://lv2plug.in/ns/ext/presets" | |||
LV2_PUI_URI = "http://lv2plug.in/ns/ext/pui" | |||
LV2_REFERENCE_URI = "http://lv2plug.in/ns/ext/reference" | |||
LV2_RESIZE_PORT_URI = "http://lv2plug.in/ns/ext/resize-port" | |||
LV2_STATE_URI = "http://lv2plug.in/ns/ext/state" | |||
LV2_TIME_URI = "http://lv2plug.in/ns/ext/time" | |||
LV2_UI_RESIZE_URI = "http://lv2plug.in/ns/ext/ui-resize" | |||
LV2_URI_MAP_URI = "http://lv2plug.in/ns/ext/uri-map" | |||
LV2_URID_URI = "http://lv2plug.in/ns/ext/urid" | |||
LV2_WORKER_URI = "http://lv2plug.in/ns/ext/worker" | |||
@@ -38,6 +36,7 @@ LV2_RTSAFE_MEMORY_POOL_URI = "http://home.gna.org/lv2dynparam/rtmempool/v1" | |||
LV2_EXTERNAL_UI_URI = "http://nedko.arnaudov.name/lv2/external_ui/" | |||
LV2_RDF_Supported_Features_URI = ( | |||
LV2_ATOM_URI, | |||
LV2_DATA_ACCESS_URI, | |||
LV2_EVENT_URI, | |||
LV2_HOST_INFO_URI, | |||
@@ -46,7 +45,6 @@ LV2_RDF_Supported_Features_URI = ( | |||
LV2_PORT_PROPS_URI, | |||
LV2_PRESETS_URI, | |||
LV2_STATE_URI, | |||
LV2_UI_RESIZE_URI, | |||
LV2_URI_MAP_URI, | |||
LV2_URID_URI, | |||
LV2_UI_URI, | |||
@@ -147,17 +145,15 @@ LV2_PORT_INPUT = 0x01 | |||
LV2_PORT_OUTPUT = 0x02 | |||
LV2_PORT_CONTROL = 0x04 | |||
LV2_PORT_AUDIO = 0x08 | |||
LV2_PORT_ATOM_MESSAGE = 0x10 | |||
LV2_PORT_ATOM_VALUE = 0x20 | |||
LV2_PORT_ATOM = 0x10 | |||
LV2_PORT_ATOM_SEQUENCE = 0x20 | LV2_PORT_ATOM | |||
LV2_PORT_CV = 0x40 | |||
LV2_PORT_EVENT = 0x80 | |||
LV2_PORT_MIDI_LL = 0x100 | |||
# TODO - Port Atom types | |||
# Port Event types | |||
LV2_PORT_EVENT_MIDI = 0x1000 | |||
LV2_PORT_EVENT_TIME = 0x2000 | |||
# Port Support Types | |||
LV2_PORT_SUPPORTS_MIDI = 0x1000 | |||
LV2_PORT_SUPPORTS_TIME = 0x2000 | |||
# Port Properties | |||
LV2_PORT_OPTIONAL = 0x00001 | |||
@@ -470,20 +466,28 @@ NS_rdfs = "http://www.w3.org/2000/01/rdf-schema#" | |||
NS_lv2 = "http://lv2plug.in/ns/lv2core#" | |||
NS_lv2atom = "http://lv2plug.in/ns/ext/atom#" | |||
NS_lv2ctx = "http://lv2plug.in/ns/ext/contexts#" | |||
NS_lv2cv = "http://lv2plug.in/ns/ext/cv-port#" | |||
NS_lv2dyn = "http://lv2plug.in/ns/ext/dynmanifest#" | |||
NS_lv2da = "http://lv2plug.in/ns/ext/data-access#" | |||
NS_lv2dman = "http://lv2plug.in/ns/ext/dynmanifest#" | |||
NS_lv2ev = "http://lv2plug.in/ns/ext/event#" | |||
NS_lv2hi = "http://lv2plug.in/ns/ext/host-info#" | |||
NS_lv2ia = "http://lv2plug.in/ns/ext/instance-access#" | |||
NS_lv2log = "http://lv2plug.in/ns/ext/log#" | |||
NS_lv2param = "http://lv2plug.in/ns/ext/parameters#" | |||
NS_lv2patch = "http://lv2plug.in/ns/ext/patch#" | |||
NS_lv2pg = "http://lv2plug.in/ns/ext/port-groups#" | |||
NS_lv2pprops = "http://lv2plug.in/ns/ext/port-props#" | |||
NS_lv2pset = "http://lv2plug.in/ns/ext/presets#" | |||
NS_lv2rsz = "http://lv2plug.in/ns/ext/resize-port#" | |||
NS_lv2state = "http://lv2plug.in/ns/ext/state#" | |||
NS_lv2umap = "http://lv2plug.in/ns/ext/uri-map#" | |||
NS_lv2urid = "http://lv2plug.in/ns/ext/urid#" | |||
NS_lv2work = "http://lv2plug.in/ns/ext/worker#" | |||
NS_lv2ui = "http://lv2plug.in/ns/extensions/ui#" | |||
NS_lv2units = "http://lv2plug.in/ns/extensions/units#" | |||
#NS_llext = "http://ll-plugins.nongnu.org/lv2/ext/" | |||
NS_lv2mm = "http://ll-plugins.nongnu.org/lv2/ext/midimap#" | |||
NS_llplug = "http://ll-plugins.nongnu.org/lv2/namespace#" | |||
NS_lv2mm = "http://ll-plugins.nongnu.org/lv2/ext/midimap#" # FIXME? | |||
NS_llplug = "http://ll-plugins.nongnu.org/lv2/namespace#" # FIXME? | |||
# Prefixes (sorted alphabetically and by type) | |||
rdf_prefix = { | |||
@@ -496,8 +500,6 @@ rdf_prefix = { | |||
'doap:license': NS_doap+"license", | |||
'doap:maintainer': NS_doap+"maintainer", | |||
'doap:name': NS_doap+"name", | |||
#'foaf:homepage': "http://xmlns.com/foaf/0.1/homepage", | |||
#'foaf:mbox': "http://xmlns.com/foaf/0.1/mbox", | |||
'foaf:name': NS_foaf+"name", | |||
'rdf:type': NS_rdf+"type", | |||
'rdf:value': NS_rdf+"value", | |||
@@ -513,39 +515,44 @@ rdf_prefix = { | |||
'lv2:default': NS_lv2+"default", | |||
'lv2:documentation': NS_lv2+"documentation", | |||
'lv2:extensionData': NS_lv2+"extensionData", | |||
'lv2:freeWheeling': NS_lv2+"freeWheeling", | |||
'lv2:hasParameter': NS_lv2+"hasParameter", | |||
'lv2:index': NS_lv2+"index", | |||
'lv2:isParameter': NS_lv2+"isParameter", | |||
'lv2:latency': NS_lv2+"latency", | |||
'lv2:maximum': NS_lv2+"maximum", | |||
'lv2:minimum': NS_lv2+"minimum", | |||
'lv2:name': NS_lv2+"name", | |||
'lv2:port': NS_lv2+"port", | |||
'lv2:portProperty': NS_lv2+"portProperty", | |||
'lv2:property': NS_lv2+"property", | |||
'lv2:scalePoint': NS_lv2+"scalePoint", | |||
'lv2:symbol': NS_lv2+"symbol", | |||
'lv2:optionalFeature': NS_lv2+"optionalFeature", | |||
'lv2:requiredFeature': NS_lv2+"requiredFeature", | |||
# LV2 Atom | |||
'lv2atom:MessagePort': NS_lv2atom+"MessagePort", | |||
# LV2 Atom - TODO, incomplete | |||
'lv2atom:AtomPort': NS_lv2atom+"AtomPort", | |||
'lv2atom:bufferType': NS_lv2atom+"bufferType", | |||
'lv2atom:Sequence': NS_lv2atom+"Sequence", | |||
'lv2atom:String': NS_lv2atom+"String", | |||
'lv2atom:ValuePort': NS_lv2atom+"ValuePort", | |||
'lv2atom:supports': NS_lv2atom+"supports", | |||
# LV2 CV | |||
'lv2cv:CVPort': NS_lv2cv+"CVPort", | |||
# LV2 Event | |||
# LV2 Event - TODO, incomplete | |||
'lv2ev:EventPort': NS_lv2ev+"EventPort", | |||
'lv2ev:supportsEvent': NS_lv2ev+"supportsEvent", | |||
# LV2 Presets | |||
# LV2 Presets - FIXME appliesTo ?, see when new lv2 gets released | |||
'lv2pset:Preset': NS_lv2pset+"Preset", | |||
'lv2pset:value': NS_lv2pset+"value", | |||
# LV2 State | |||
# LV2 State - TODO, incomplete | |||
'lv2state:state': NS_lv2state+"state", | |||
# LV2 UI | |||
# LV2 UI - TODO, incomplete | |||
'lv2ui:ui': NS_lv2ui+"ui", | |||
'lv2ui:binary': NS_lv2ui+"binary", | |||
'lv2ui:events': NS_lv2ui+"events", | |||
@@ -556,12 +563,14 @@ rdf_prefix = { | |||
'lv2ui:optionalFeature': NS_lv2ui+"optionalFeature", | |||
'lv2ui:requiredFeature': NS_lv2ui+"requiredFeature", | |||
# LV2 Units | |||
# LV2 Units - TODO, incomplete | |||
'lv2units:unit': NS_lv2units+"unit", | |||
'lv2units:name': NS_lv2units+"name", | |||
'lv2units:render': NS_lv2units+"render", | |||
'lv2units:symbol': NS_lv2units+"symbol", | |||
# FIXME ? | |||
# LV2 Midi Map | |||
'lv2mm:defaultMidiController': NS_lv2mm+"defaultMidiController", | |||
'lv2mm:controllerType': NS_lv2mm+"controllerType", | |||
@@ -702,10 +711,8 @@ def get_c_port_type(value): | |||
return LV2_PORT_CONTROL | |||
elif (value_str == "AudioPort"): | |||
return LV2_PORT_AUDIO | |||
elif (value == rdf_prefix['lv2atom:MessagePort']): | |||
return LV2_PORT_ATOM_MESSAGE | |||
elif (value == rdf_prefix['lv2atom:ValuePort']): | |||
return LV2_PORT_ATOM_VALUE | |||
elif (value == rdf_prefix['lv2atom:AtomPort']): | |||
return LV2_PORT_ATOM | |||
elif (value == rdf_prefix['lv2cv:CVPort']): | |||
return LV2_PORT_CV | |||
elif (value == rdf_prefix['lv2ev:EventPort']): | |||
@@ -716,13 +723,13 @@ def get_c_port_type(value): | |||
print("LV2_RDF - Got an unknown port type '%s'" % value_str) | |||
return 0 | |||
def get_c_port_event_type(value): | |||
def get_c_port_supported_type(value): | |||
if (value == "http://lv2plug.in/ns/ext/midi#MidiEvent"): | |||
return LV2_PORT_EVENT_MIDI | |||
#elif (value == "http://lv2plug.in/ns/ext/time#Position"): | |||
#return LV2_PORT_EVENT_TIME | |||
return LV2_PORT_SUPPORTS_MIDI | |||
elif (value == "http://lv2plug.in/ns/ext/time#Position"): | |||
return LV2_PORT_SUPPORTS_TIME | |||
else: | |||
print("LV2_RDF - Got an unknown port event type '%s'" % value) | |||
print("LV2_RDF - Got an unknown port supported type '%s'" % value) | |||
return 0 | |||
def get_c_port_midi_map_type(value): | |||
@@ -835,7 +842,7 @@ def get_c_port_unit_type(value): | |||
elif (value_str == "semitone12TET"): | |||
return LV2_UNIT_SEMITONE | |||
else: | |||
print("LV2_RDF - Got an unknown Unit type '%s'" % value_str) | |||
print("LV2_RDF - Got an unknown unit type '%s'" % value_str) | |||
return 0 | |||
def get_c_ui_type(value): | |||
@@ -852,7 +859,7 @@ def get_c_ui_type(value): | |||
elif (value == LV2_EXTERNAL_UI_URI): | |||
return LV2_UI_EXTERNAL | |||
else: | |||
print("LV2_RDF - Got an unknown UI type '%s'" % value_str) | |||
print("LV2_RDF - Got an unknown ui type '%s'" % value_str) | |||
return 0 | |||
# ------------------------------------------------------------------------------- | |||
@@ -1224,7 +1231,7 @@ def fill_information(parse, bundle_path): | |||
or_plugin_value(uri, 'Type', c_class) | |||
# DynManifest, ignored | |||
elif (s_object.startswith(NS_lv2dyn)): | |||
elif (s_object.startswith(NS_lv2dman)): | |||
pass | |||
# Host Info, ignored | |||
@@ -1414,11 +1421,7 @@ def fill_information(parse, bundle_path): | |||
# UI ------------------end | |||
# DynManifest, ignored | |||
elif (s_predicate.startswith(NS_lv2dyn)): | |||
pass | |||
# Contexts, ignored | |||
elif (s_predicate.startswith(NS_lv2ctx)): | |||
elif (s_predicate.startswith(NS_lv2dman)): | |||
pass | |||
# Host Info, ignored | |||
@@ -1678,14 +1681,34 @@ def fill_information(parse, bundle_path): | |||
c_port_type = get_c_port_type(port_type) | |||
py_port['Type'] |= c_port_type | |||
# TODO - atom buffer types | |||
if (c_port_type == LV2_PORT_ATOM): | |||
buffer_type_try = get_node_property(s_object, nodes_list, rdf_prefix['lv2atom:bufferType'], None) | |||
if (buffer_type_try != None): | |||
buffer_type = str(buffer_type_try) | |||
if (buffer_type == rdf_prefix['lv2atom:Sequence']): | |||
py_port['Type'] |= LV2_PORT_ATOM_SEQUENCE | |||
else: | |||
print("LV2_RDF - Got an unknown atom buffer type '%s'" % buffer_type) | |||
supported_type_try = get_node_property(s_object, nodes_list, rdf_prefix['lv2atom:supports'], None) | |||
if (supported_type_try != None): | |||
supported_type = str(supported_type_try) | |||
py_port['Type'] |= get_c_port_supported_type(supported_type) | |||
else: | |||
print("LV2_RDF - Internal error, Atom Port without supported type") | |||
else: | |||
print("LV2_RDF - Internal error, Atom Port without buffer type") | |||
if (c_port_type == LV2_PORT_EVENT): | |||
elif (c_port_type == LV2_PORT_EVENT): | |||
event_type_try = get_node_property(s_object, nodes_list, rdf_prefix['lv2ev:supportsEvent'], None) | |||
if (event_type_try != None): | |||
event_type = str(event_type_try) | |||
py_port['Type'] |= get_c_port_event_type(event_type) | |||
py_port['Type'] |= get_c_port_supported_type(event_type) | |||
else: | |||
print("LV2_RDF - Internal error, Event Port without supported Event") | |||
@@ -42,7 +42,7 @@ class PixmapDial(QDial): | |||
self.m_label = "" | |||
self.m_label_pos = QPointF(0.0, 0.0) | |||
self.m_label_width = 0 | |||
self.m_label_width = 0 | |||
self.m_label_height = 0 | |||
self.m_label_gradient = QLinearGradient(0, 0, 0, 1) | |||
@@ -52,7 +52,7 @@ class PixmapDial(QDial): | |||
self.m_color2 = QColor(0, 0, 0, 0) | |||
self.m_colorT = [self.palette().text().color(), self.palette().mid().color()] | |||
else: | |||
## Dark background | |||
# Dark background | |||
self.m_color1 = QColor(0, 0, 0, 255) | |||
self.m_color2 = QColor(0, 0, 0, 0) | |||
self.m_colorT = [Qt.white, Qt.darkGray] | |||
@@ -111,7 +111,7 @@ class PixmapDial(QDial): | |||
return QSize(self.p_size, self.p_size) | |||
def updateSizes(self): | |||
self.p_width = self.m_pixmap.width() | |||
self.p_width = self.m_pixmap.width() | |||
self.p_height = self.m_pixmap.height() | |||
if (self.p_width < 1): | |||
@@ -127,8 +127,8 @@ class PixmapDial(QDial): | |||
self.p_size = self.p_width | |||
self.p_count = self.p_height/self.p_width | |||
self.setMinimumSize(self.p_size, self.p_size+self.m_label_height+5) | |||
self.setMaximumSize(self.p_size, self.p_size+self.m_label_height+5) | |||
self.setMinimumSize(self.p_size, self.p_size + self.m_label_height + 5) | |||
self.setMaximumSize(self.p_size, self.p_size + self.m_label_height + 5) | |||
def paintEvent(self, event): | |||
painter = QPainter(self) | |||
@@ -168,4 +168,4 @@ class PixmapDial(QDial): | |||
def resizeEvent(self, event): | |||
self.updateSizes() | |||
return QDial.resizeEvent(self, event) | |||
QDial.resizeEvent(self, event) |