Skip to content

Commit

Permalink
Add MAXIMUM_BUFFER_SIZE and use it in VstEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
messmerd committed Sep 4, 2024
1 parent 5993030 commit 8f77cfa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ class AudioPort;
class AudioEngineWorkerThread;


const fpp_t MINIMUM_BUFFER_SIZE = 32;
const fpp_t DEFAULT_BUFFER_SIZE = 256;
constexpr fpp_t MINIMUM_BUFFER_SIZE = 32;
constexpr fpp_t DEFAULT_BUFFER_SIZE = 256;
constexpr fpp_t MAXIMUM_BUFFER_SIZE = 4096;

const int BYTES_PER_SAMPLE = sizeof( sample_t );
const int BYTES_PER_INT_SAMPLE = sizeof( int_sample_t );
const int BYTES_PER_FRAME = sizeof( SampleFrame );
constexpr int BYTES_PER_SAMPLE = sizeof(sample_t);
constexpr int BYTES_PER_INT_SAMPLE = sizeof(int_sample_t);
constexpr int BYTES_PER_FRAME = sizeof(SampleFrame);

const float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;
constexpr float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;

class LMMS_EXPORT AudioEngine : public QObject
{
Expand Down
3 changes: 1 addition & 2 deletions plugins/VstEffect/VstEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ VstEffect::VstEffect( Model * _parent,
double VstEffect::processImpl(SampleFrame* buf, const fpp_t frames)
{
assert(m_plugin != nullptr);
assert(frames <= DEFAULT_BUFFER_SIZE);
static thread_local auto tempBuf = std::array<SampleFrame, DEFAULT_BUFFER_SIZE>();
static thread_local auto tempBuf = std::array<SampleFrame, MAXIMUM_BUFFER_SIZE>();

std::memcpy(tempBuf.data(), buf, sizeof(SampleFrame) * frames);
if (m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0))
Expand Down

0 comments on commit 8f77cfa

Please sign in to comment.