Browse Source

Use heap allocated buffer for lv2 output atoms

tags/1.9.7
falkTX 9 years ago
parent
commit
99dbb1eea6
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      source/backend/plugin/CarlaPluginLV2.cpp

+ 12
- 3
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -503,6 +503,7 @@ public:
fAtomBufferIn(), fAtomBufferIn(),
fAtomBufferOut(), fAtomBufferOut(),
fAtomForge(), fAtomForge(),
fTmpAtomBuffer(nullptr),
fEventsIn(), fEventsIn(),
fEventsOut(), fEventsOut(),
fLv2Options(), fLv2Options(),
@@ -689,6 +690,12 @@ public:
fLastStateChunk = nullptr; fLastStateChunk = nullptr;
} }


if (fTmpAtomBuffer != nullptr)
{
delete[] fTmpAtomBuffer;
fTmpAtomBuffer = nullptr;
}

clearBuffers(); clearBuffers();
} }


@@ -1505,9 +1512,7 @@ public:
{ {
if (fAtomBufferOut.isDataAvailableForReading()) if (fAtomBufferOut.isDataAvailableForReading())
{ {
uint8_t dumpBuf[fAtomBufferOut.getSize()];

Lv2AtomRingBuffer tmpRingBuffer(fAtomBufferOut, dumpBuf);
Lv2AtomRingBuffer tmpRingBuffer(fAtomBufferOut, fTmpAtomBuffer);
CARLA_SAFE_ASSERT(tmpRingBuffer.isDataAvailableForReading()); CARLA_SAFE_ASSERT(tmpRingBuffer.isDataAvailableForReading());


uint32_t portIndex; uint32_t portIndex;
@@ -2342,7 +2347,10 @@ public:
fAtomBufferIn.createBuffer(eventBufferSize); fAtomBufferIn.createBuffer(eventBufferSize);


if (fExt.worker != nullptr || (fUI.type != UI::TYPE_NULL && fEventsOut.count > 0 && (fEventsOut.data[0].type & CARLA_EVENT_DATA_ATOM) != 0)) if (fExt.worker != nullptr || (fUI.type != UI::TYPE_NULL && fEventsOut.count > 0 && (fEventsOut.data[0].type & CARLA_EVENT_DATA_ATOM) != 0))
{
fAtomBufferOut.createBuffer(eventBufferSize); fAtomBufferOut.createBuffer(eventBufferSize);
fTmpAtomBuffer = new uint8_t[fAtomBufferOut.getSize()];
}


if (fEventsIn.ctrl != nullptr && fEventsIn.ctrl->port == nullptr) if (fEventsIn.ctrl != nullptr && fEventsIn.ctrl->port == nullptr)
fEventsIn.ctrl->port = pData->event.portIn; fEventsIn.ctrl->port = pData->event.portIn;
@@ -5563,6 +5571,7 @@ private:
Lv2AtomRingBuffer fAtomBufferIn; Lv2AtomRingBuffer fAtomBufferIn;
Lv2AtomRingBuffer fAtomBufferOut; Lv2AtomRingBuffer fAtomBufferOut;
LV2_Atom_Forge fAtomForge; LV2_Atom_Forge fAtomForge;
uint8_t* fTmpAtomBuffer;


CarlaPluginLV2EventData fEventsIn; CarlaPluginLV2EventData fEventsIn;
CarlaPluginLV2EventData fEventsOut; CarlaPluginLV2EventData fEventsOut;


Loading…
Cancel
Save