@@ -103,7 +103,7 @@ const uint32_t CARLA_URI_MAP_ID_TIME_FRAMES_PER_SECOND = 36; | |||||
const uint32_t CARLA_URI_MAP_ID_TIME_SPEED = 37; | const uint32_t CARLA_URI_MAP_ID_TIME_SPEED = 37; | ||||
const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 38; | const uint32_t CARLA_URI_MAP_ID_MIDI_EVENT = 38; | ||||
const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 39; | const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 39; | ||||
const uint32_t CARLA_URI_MAP_ID_COUNT = 40; | |||||
const uint32_t CARLA_URI_MAP_ID_COUNT = 39; // FIXME later | |||||
// LV2 Feature Ids | // LV2 Feature Ids | ||||
const uint32_t kFeatureIdBufSizeBounded = 0; | const uint32_t kFeatureIdBufSizeBounded = 0; | ||||
@@ -1222,6 +1222,7 @@ public: | |||||
Lv2AtomQueue tmpQueue; | Lv2AtomQueue tmpQueue; | ||||
tmpQueue.copyAndDumpDataFromQueue(fAtomQueueOut, dumpBuf); | tmpQueue.copyAndDumpDataFromQueue(fAtomQueueOut, dumpBuf); | ||||
CARLA_SAFE_ASSERT(! tmpQueue.isEmpty()); | |||||
uint32_t portIndex; | uint32_t portIndex; | ||||
const LV2_Atom* atom; | const LV2_Atom* atom; | ||||
@@ -1229,8 +1230,6 @@ public: | |||||
for (; tmpQueue.get(&atom, &portIndex);) | for (; tmpQueue.get(&atom, &portIndex);) | ||||
{ | { | ||||
carla_stdout("OUTPUT message IN GUI REMOVED FROM BUFFER"); | |||||
if (atom->type == CARLA_URI_MAP_ID_ATOM_WORKER) | if (atom->type == CARLA_URI_MAP_ID_ATOM_WORKER) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_CONTINUE(fExt.worker != nullptr && fExt.worker->work != nullptr); | CARLA_SAFE_ASSERT_CONTINUE(fExt.worker != nullptr && fExt.worker->work != nullptr); | ||||
@@ -1295,6 +1294,8 @@ public: | |||||
aIns = aOuts = cvIns = cvOuts = params = 0; | aIns = aOuts = cvIns = cvOuts = params = 0; | ||||
LinkedList<unsigned int> evIns, evOuts; | LinkedList<unsigned int> evIns, evOuts; | ||||
const uint32_t eventBufferSize(static_cast<uint32_t>(fLv2Options.sequenceSize)); | |||||
bool forcedStereoIn, forcedStereoOut; | bool forcedStereoIn, forcedStereoOut; | ||||
forcedStereoIn = forcedStereoOut = false; | forcedStereoIn = forcedStereoOut = false; | ||||
@@ -1393,9 +1394,6 @@ public: | |||||
FLOAT_CLEAR(fParamBuffers, params); | FLOAT_CLEAR(fParamBuffers, params); | ||||
} | } | ||||
const uint32_t eventBufferSize(MAX_DEFAULT_BUFFER_SIZE); | |||||
fLv2Options.sequenceSize = static_cast<int>(eventBufferSize); | |||||
if (const uint32_t count = static_cast<uint32_t>(evIns.count())) | if (const uint32_t count = static_cast<uint32_t>(evIns.count())) | ||||
{ | { | ||||
fEventsIn.createNew(count); | fEventsIn.createNew(count); | ||||
@@ -4183,6 +4181,21 @@ public: | |||||
fLv2Options.maxBufferSize = static_cast<int>(pData->engine->getBufferSize()); | fLv2Options.maxBufferSize = static_cast<int>(pData->engine->getBufferSize()); | ||||
fLv2Options.sampleRate = pData->engine->getSampleRate(); | fLv2Options.sampleRate = pData->engine->getSampleRate(); | ||||
uint32_t eventBufferSize = MAX_DEFAULT_BUFFER_SIZE; | |||||
for (uint32_t j=0; j < fRdfDescriptor->PortCount; ++j) | |||||
{ | |||||
const LV2_Property portTypes(fRdfDescriptor->Ports[j].Types); | |||||
if (LV2_IS_PORT_ATOM_SEQUENCE(portTypes) || LV2_IS_PORT_EVENT(portTypes) || LV2_IS_PORT_MIDI_LL(portTypes)) | |||||
{ | |||||
if (fRdfDescriptor->Ports[j].MinimumSize > eventBufferSize) | |||||
eventBufferSize = fRdfDescriptor->Ports[j].MinimumSize; | |||||
} | |||||
} | |||||
fLv2Options.sequenceSize = static_cast<int>(eventBufferSize); | |||||
// --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
// initialize features (part 1) | // initialize features (part 1) | ||||
@@ -4271,7 +4284,8 @@ public: | |||||
fFeatures[kFeatureIdPrograms]->URI = LV2_PROGRAMS__Host; | fFeatures[kFeatureIdPrograms]->URI = LV2_PROGRAMS__Host; | ||||
fFeatures[kFeatureIdPrograms]->data = programsFt; | fFeatures[kFeatureIdPrograms]->data = programsFt; | ||||
//kFeatureIdResizePort | |||||
fFeatures[kFeatureIdResizePort]->URI = LV2_RESIZE_PORT__resize; | |||||
fFeatures[kFeatureIdResizePort]->data = rsPortFt; | |||||
fFeatures[kFeatureIdRtMemPool]->URI = LV2_RTSAFE_MEMORY_POOL__Pool; | fFeatures[kFeatureIdRtMemPool]->URI = LV2_RTSAFE_MEMORY_POOL__Pool; | ||||
fFeatures[kFeatureIdRtMemPool]->data = rtMemPoolFt; | fFeatures[kFeatureIdRtMemPool]->data = rtMemPoolFt; | ||||
@@ -388,6 +388,8 @@ struct LV2_RDF_Port { | |||||
LV2_RDF_PortPoints Points; | LV2_RDF_PortPoints Points; | ||||
LV2_RDF_PortUnit Unit; | LV2_RDF_PortUnit Unit; | ||||
uint32_t MinimumSize; | |||||
uint32_t ScalePointCount; | uint32_t ScalePointCount; | ||||
LV2_RDF_PortScalePoint* ScalePoints; | LV2_RDF_PortScalePoint* ScalePoints; | ||||
@@ -397,6 +399,7 @@ struct LV2_RDF_Port { | |||||
Designation(0), | Designation(0), | ||||
Name(nullptr), | Name(nullptr), | ||||
Symbol(nullptr), | Symbol(nullptr), | ||||
MinimumSize(0), | |||||
ScalePointCount(0), | ScalePointCount(0), | ||||
ScalePoints(nullptr) {} | ScalePoints(nullptr) {} | ||||
@@ -61,7 +61,7 @@ | |||||
#include "lilv/lilvmm.hpp" | #include "lilv/lilvmm.hpp" | ||||
#include "sratom/sratom.h" | #include "sratom/sratom.h" | ||||
//#include <QtCore/QStringList> | |||||
#include <QtCore/QStringList> | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// Define namespaces and missing prefixes | // Define namespaces and missing prefixes | ||||
@@ -197,6 +197,9 @@ public: | |||||
Lilv::Node value_minimum; | Lilv::Node value_minimum; | ||||
Lilv::Node value_maximum; | Lilv::Node value_maximum; | ||||
Lilv::Node rz_asLargeAs; | |||||
Lilv::Node rz_minSize; | |||||
// Port Data Types | // Port Data Types | ||||
Lilv::Node midi_event; | Lilv::Node midi_event; | ||||
Lilv::Node patch_message; | Lilv::Node patch_message; | ||||
@@ -312,6 +315,9 @@ public: | |||||
value_minimum (new_uri(LV2_CORE__minimum)), | value_minimum (new_uri(LV2_CORE__minimum)), | ||||
value_maximum (new_uri(LV2_CORE__maximum)), | value_maximum (new_uri(LV2_CORE__maximum)), | ||||
rz_asLargeAs (new_uri(LV2_RESIZE_PORT__asLargeAs)), | |||||
rz_minSize (new_uri(LV2_RESIZE_PORT__minimumSize)), | |||||
midi_event (new_uri(LV2_MIDI__MidiEvent)), | midi_event (new_uri(LV2_MIDI__MidiEvent)), | ||||
patch_message (new_uri(LV2_PATCH__Message)), | patch_message (new_uri(LV2_PATCH__Message)), | ||||
time_position (new_uri(LV2_TIME__Position)), | time_position (new_uri(LV2_TIME__Position)), | ||||
@@ -522,7 +528,6 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool /*fillPreset | |||||
} | } | ||||
} | } | ||||
#if 0 | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Set Plugin UniqueID | // Set Plugin UniqueID | ||||
{ | { | ||||
@@ -549,7 +554,6 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool /*fillPreset | |||||
} | } | ||||
} | } | ||||
} | } | ||||
#endif | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Set Plugin Ports | // Set Plugin Ports | ||||
@@ -966,6 +970,22 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool /*fillPreset | |||||
} | } | ||||
} | } | ||||
// ----------------------------------------------------------- | |||||
// Set Port Minimum Size | |||||
{ | |||||
Lilv::Nodes minimumSizeNodes(lilvPort.get_value(lv2World.rz_minSize)); | |||||
if (minimumSizeNodes.size() > 0) | |||||
{ | |||||
const int minimumSize(minimumSizeNodes.get_first().as_int()); | |||||
if (minimumSize > 0) | |||||
rdfPort->MinimumSize = static_cast<uint32_t>(minimumSize); | |||||
else | |||||
carla_safe_assert_int("minimumSize > 0", __FILE__, __LINE__, minimumSize); | |||||
} | |||||
} | |||||
// ----------------------------------------------------------- | // ----------------------------------------------------------- | ||||
// Set Port Scale Points | // Set Port Scale Points | ||||
@@ -29,7 +29,8 @@ class Lv2AtomRingBufferControl : public RingBufferControlTemplate<HeapRingBuffer | |||||
{ | { | ||||
public: | public: | ||||
Lv2AtomRingBufferControl() | Lv2AtomRingBufferControl() | ||||
: RingBufferControlTemplate(nullptr) | |||||
: RingBufferControlTemplate(nullptr), | |||||
fIsDummy(false) | |||||
{ | { | ||||
fBuffer.size = 0; | fBuffer.size = 0; | ||||
fBuffer.buf = nullptr; | fBuffer.buf = nullptr; | ||||
@@ -37,8 +38,11 @@ public: | |||||
~Lv2AtomRingBufferControl() | ~Lv2AtomRingBufferControl() | ||||
{ | { | ||||
if (fBuffer.buf != nullptr) | |||||
if (fBuffer.buf != nullptr && ! fIsDummy) | |||||
{ | |||||
delete[] fBuffer.buf; | delete[] fBuffer.buf; | ||||
fBuffer.buf = nullptr; | |||||
} | |||||
} | } | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -47,7 +51,8 @@ public: | |||||
{ | { | ||||
if (fBuffer.buf != nullptr) | if (fBuffer.buf != nullptr) | ||||
{ | { | ||||
delete[] fBuffer.buf; | |||||
if (! fIsDummy) | |||||
delete[] fBuffer.buf; | |||||
fBuffer.buf = nullptr; | fBuffer.buf = nullptr; | ||||
} | } | ||||
@@ -71,8 +76,11 @@ public: | |||||
fBuffer.tail = rb.tail; | fBuffer.tail = rb.tail; | ||||
fBuffer.written = rb.written; | fBuffer.written = rb.written; | ||||
fBuffer.invalidateCommit = rb.invalidateCommit; | fBuffer.invalidateCommit = rb.invalidateCommit; | ||||
fIsDummy = true; | |||||
std::memcpy(dumpBuf, rb.buf, rb.size); | std::memcpy(dumpBuf, rb.buf, rb.size); | ||||
setRingBuffer(&fBuffer, false); | |||||
} | } | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -125,8 +133,9 @@ public: | |||||
private: | private: | ||||
HeapRingBuffer fBuffer; | HeapRingBuffer fBuffer; | ||||
bool fIsDummy; | |||||
static const size_t kMaxDataSize = 2048; | |||||
static const size_t kMaxDataSize = 8192; | |||||
struct RetAtom { | struct RetAtom { | ||||
LV2_Atom atom; | LV2_Atom atom; | ||||