Browse Source

Use heap allocated buffer for lv2 output atoms

tags/1.9.7
falkTX 8 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(),
fAtomBufferOut(),
fAtomForge(),
fTmpAtomBuffer(nullptr),
fEventsIn(),
fEventsOut(),
fLv2Options(),
@@ -689,6 +690,12 @@ public:
fLastStateChunk = nullptr;
}

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

clearBuffers();
}

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

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

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

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

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

CarlaPluginLV2EventData fEventsIn;
CarlaPluginLV2EventData fEventsOut;


Loading…
Cancel
Save