Browse Source

Fixup audiofile plugin for offline rendering

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
7b22e89958
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 34 additions and 6 deletions
  1. +1
    -1
      source/backend/plugin/CarlaPluginNative.cpp
  2. +8
    -3
      source/native-plugins/audio-base.hpp
  3. +25
    -2
      source/native-plugins/audio-file.cpp

+ 1
- 1
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -252,7 +252,7 @@ public:
fHost(),
fDescriptor(nullptr),
fIsProcessing(false),
fIsOffline(false),
fIsOffline(engine->isOffline()),
fIsUiAvailable(false),
fIsUiVisible(false),
fNeedsIdle(false),


+ 8
- 3
source/native-plugins/audio-base.hpp View File

@@ -380,7 +380,12 @@ public:
carla_copyFloats(pool.buffer[1], fPool.buffer[1], fPool.numFrames);
}

bool tryPutData(float* const out1, float* const out2, uint64_t framePos, const uint32_t frames, bool& needsRead)
bool tryPutData(float* const out1,
float* const out2,
uint64_t framePos,
const uint32_t frames,
const bool isOffline,
bool& needsRead)
{
CARLA_SAFE_ASSERT_RETURN(fPool.numFrames != 0, false);

@@ -436,7 +441,7 @@ public:
if (frameDiff > numFramesNearEnd)
{
needsRead = true;
setNeedsRead(framePos + frames);
setNeedsRead(framePos + (isOffline ? 0 : frames));
}

return true;
@@ -477,7 +482,7 @@ public:
fResampler.inp_data = buffer;
fResampler.out_data = rbuffer;
fResampler.process();
CARLA_ASSERT_INT(fResampler.inp_count <= 1, fResampler.inp_count);
CARLA_SAFE_ASSERT_INT(fResampler.inp_count <= 1, fResampler.inp_count);
}
else
{


+ 25
- 2
source/native-plugins/audio-file.cpp View File

@@ -334,13 +334,33 @@ protected:
}
else
{
if (! fReader.tryPutData(out1, out2, timePos->frame, frames, needsIdleRequest))
const bool offline = isOffline();

if (! fReader.tryPutData(out1, out2, timePos->frame, frames, offline, needsIdleRequest))
{
carla_zeroFloats(out1, frames);
carla_zeroFloats(out2, frames);
}

if (needsIdleRequest)
{
fNeedsFileRead = true;

if (isOffline())
{
needsIdleRequest = false;
fReader.readPoll();

if (! fReader.tryPutData(out1, out2, timePos->frame, frames, offline, needsIdleRequest))
{
carla_zeroFloats(out1, frames);
carla_zeroFloats(out2, frames);
}

if (needsIdleRequest)
fNeedsFileRead = true;
}
}
}

#ifndef __MOD_DEVICES__
@@ -391,7 +411,10 @@ protected:
NativePluginWithMidiPrograms<FileAudio>::idle();

if (fNeedsFileRead)
{
fReader.readPoll();
fNeedsFileRead = false;
}

#ifndef __MOD_DEVICES__
if (fInlineDisplay.pending == InlineDisplayNeedRequest)
@@ -520,7 +543,7 @@ private:
bool fLoopMode;
bool fDoProcess;
bool fWasPlayingBefore;
bool fNeedsFileRead;
volatile bool fNeedsFileRead;

uint32_t fMaxFrame;



Loading…
Cancel
Save