Browse Source

audiofile: tweaks to "waveform" preview

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC2
falkTX 3 years ago
parent
commit
a39fc148d4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 6 additions and 3 deletions
  1. +5
    -2
      source/native-plugins/audio-base.hpp
  2. +1
    -1
      source/native-plugins/audio-file.cpp

+ 5
- 2
source/native-plugins/audio-base.hpp View File

@@ -394,7 +394,7 @@ public:
{
const float stepF = static_cast<float>(i)/previewDataSizeF * fileNumFramesF;
const uint step = carla_fixedValue(0U, fileNumFrames-1U, static_cast<uint>(stepF + 0.5f));
previewData[i] = fPool.buffer[0][step];
previewData[i] = std::max(std::fabs(fPool.buffer[0][step]), std::fabs(fPool.buffer[1][step]));
}
}
else
@@ -522,6 +522,8 @@ public:
const float previewDataSizeF = static_cast<float>(previewDataSize);
const uint samplesPerRun = fFileNfo.channels;
const uint maxSampleToRead = fileNumFrames - samplesPerRun;
CARLA_SAFE_ASSERT_INT_RETURN(samplesPerRun == 1 || samplesPerRun == 2, samplesPerRun,);
float tmp[2] = { 0.0f, 0.0f };

if (samplesPerRun == 2)
previewDataSize -= 1;
@@ -532,7 +534,8 @@ public:
const uint pos = carla_fixedValue(0U, maxSampleToRead, static_cast<uint>(posF));

ad_seek(fFilePtr, pos);
ad_read(fFilePtr, previewData + i, samplesPerRun);
ad_read(fFilePtr, tmp, samplesPerRun);
previewData[i] = std::max(std::fabs(tmp[0]), std::fabs(tmp[1]));
}
}



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

@@ -713,7 +713,7 @@ private:
AudioFileReader fReader;

NativeMidiPrograms fPrograms;
float fPreviewData[300];
float fPreviewData[108];

#ifndef __MOD_DEVICES__
struct InlineDisplay : NativeInlineDisplayImageSurfaceCompat {


Loading…
Cancel
Save