Browse Source

Avoid a race condition when changing buffer/sample size

tags/v1.9.11
falkTX 6 years ago
parent
commit
995b345f84
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      source/backend/engine/CarlaEngineGraph.cpp

+ 6
- 0
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -1425,6 +1425,9 @@ void PatchbayGraph::setBufferSize(const uint32_t bufferSize)
{
const int bufferSizei(static_cast<int>(bufferSize));

const CarlaRecursiveMutexLocker cml1(graph.getReorderMutex());
const CarlaRecursiveMutexLocker cml2(graph.getCallbackLock());

graph.releaseResources();
graph.prepareToPlay(kEngine->getSampleRate(), bufferSizei);
audioBuffer.setSize(audioBuffer.getNumChannels(), bufferSizei);
@@ -1432,6 +1435,9 @@ void PatchbayGraph::setBufferSize(const uint32_t bufferSize)

void PatchbayGraph::setSampleRate(const double sampleRate)
{
const CarlaRecursiveMutexLocker cml1(graph.getReorderMutex());
const CarlaRecursiveMutexLocker cml2(graph.getCallbackLock());

graph.releaseResources();
graph.prepareToPlay(sampleRate, static_cast<int>(kEngine->getBufferSize()));
}


Loading…
Cancel
Save