From d8535a24635ed0f3c6b4d0ede2c540c6e43d0395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 19 Oct 2021 22:31:55 +0200 Subject: [PATCH] Rename variables of type EnigineParameter to engineParameters This finishes the refactoring started in https://github.com/mixxxdj/mixxx/commit/33405b2227a3a04f4909981fcda6b09787b821b1 --- .../backends/builtin/autopaneffect.cpp | 10 +-- src/effects/backends/builtin/autopaneffect.h | 6 +- .../backends/builtin/balanceeffect.cpp | 34 +++++----- src/effects/backends/builtin/balanceeffect.h | 4 +- .../backends/builtin/bessel4lvmixeqeffect.cpp | 8 +-- .../backends/builtin/bessel4lvmixeqeffect.h | 6 +- .../backends/builtin/bessel8lvmixeqeffect.cpp | 8 +-- .../backends/builtin/bessel8lvmixeqeffect.h | 6 +- .../builtin/biquadfullkilleqeffect.cpp | 66 +++++++++---------- .../backends/builtin/biquadfullkilleqeffect.h | 4 +- .../backends/builtin/bitcrushereffect.cpp | 6 +- .../backends/builtin/bitcrushereffect.h | 6 +- src/effects/backends/builtin/echoeffect.cpp | 26 ++++---- src/effects/backends/builtin/echoeffect.h | 14 ++-- src/effects/backends/builtin/filtereffect.cpp | 30 ++++----- src/effects/backends/builtin/filtereffect.h | 4 +- .../backends/builtin/flangereffect.cpp | 20 +++--- src/effects/backends/builtin/flangereffect.h | 6 +- .../backends/builtin/graphiceqeffect.cpp | 32 ++++----- .../backends/builtin/graphiceqeffect.h | 4 +- .../builtin/linkwitzriley8eqeffect.cpp | 32 ++++----- .../backends/builtin/linkwitzriley8eqeffect.h | 4 +- .../builtin/loudnesscontoureffect.cpp | 28 ++++---- .../backends/builtin/loudnesscontoureffect.h | 4 +- src/effects/backends/builtin/lvmixeqbase.h | 18 ++--- .../backends/builtin/metronomeeffect.cpp | 22 +++---- .../backends/builtin/metronomeeffect.h | 6 +- .../builtin/moogladder4filtereffect.cpp | 42 ++++++------ .../builtin/moogladder4filtereffect.h | 4 +- .../backends/builtin/parametriceqeffect.cpp | 24 +++---- .../backends/builtin/parametriceqeffect.h | 4 +- src/effects/backends/builtin/phasereffect.cpp | 14 ++-- src/effects/backends/builtin/phasereffect.h | 6 +- src/effects/backends/builtin/reverbeffect.cpp | 12 ++-- src/effects/backends/builtin/reverbeffect.h | 10 +-- .../builtin/threebandbiquadeqeffect.cpp | 66 +++++++++---------- .../builtin/threebandbiquadeqeffect.h | 4 +- .../backends/builtin/tremoloeffect.cpp | 14 ++-- src/effects/backends/builtin/tremoloeffect.h | 6 +- .../backends/builtin/whitenoiseeffect.cpp | 6 +- .../backends/builtin/whitenoiseeffect.h | 6 +- src/effects/backends/effectprocessor.h | 30 ++++----- .../backends/lv2/lv2effectprocessor.cpp | 12 ++-- src/effects/backends/lv2/lv2effectprocessor.h | 12 ++-- src/effects/effectslot.cpp | 4 +- src/engine/effects/engineeffect.cpp | 14 ++-- src/engine/effects/engineeffect.h | 2 +- src/test/baseeffecttest.h | 6 +- src/test/nativeeffects_test.cpp | 14 ++-- 49 files changed, 363 insertions(+), 363 deletions(-) diff --git a/src/effects/backends/builtin/autopaneffect.cpp b/src/effects/backends/builtin/autopaneffect.cpp index 286772e053c..28b0734b439 100644 --- a/src/effects/backends/builtin/autopaneffect.cpp +++ b/src/effects/backends/builtin/autopaneffect.cpp @@ -82,7 +82,7 @@ void AutoPanEffect::processChannel( AutoPanGroupState* pGroupState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { if (enableState == EffectEnableState::Disabled) { @@ -96,14 +96,14 @@ void AutoPanEffect::processChannel( if (groupFeatures.has_beat_length_sec) { // period is a number of beats double beats = std::max(roundToFraction(period, 2), 0.25); - period = beats * groupFeatures.beat_length_sec * bufferParameters.sampleRate(); + period = beats * groupFeatures.beat_length_sec * engineParameters.sampleRate(); // TODO(xxx) sync phase //if (groupFeatures.has_beat_fraction) { } else { // period is a number of seconds - period = std::max(period, 0.25) * bufferParameters.sampleRate(); + period = std::max(period, 0.25) * engineParameters.sampleRate(); } // When the period is changed, the position of the sound shouldn't @@ -137,7 +137,7 @@ void AutoPanEffect::processChannel( double sinusoid = 0; // NOTE: Assuming engine is working in stereo. - for (SINT i = 0; i + 1 < bufferParameters.samplesPerBuffer(); i += 2) { + for (SINT i = 0; i + 1 < engineParameters.samplesPerBuffer(); i += 2) { const auto periodFraction = static_cast(pGroupState->time) / static_cast(period); @@ -173,7 +173,7 @@ void AutoPanEffect::processChannel( -0.005 * math_clamp( ((pGroupState->frac * 2.0) - 1.0f), -1.0, 1.0) * - bufferParameters.sampleRate()); + engineParameters.sampleRate()); double lawCoef = computeLawCoefficient(sinusoid); pOutput[i] *= static_cast(pGroupState->frac * lawCoef); diff --git a/src/effects/backends/builtin/autopaneffect.h b/src/effects/backends/builtin/autopaneffect.h index ab1b28481a3..6d96b91f069 100644 --- a/src/effects/backends/builtin/autopaneffect.h +++ b/src/effects/backends/builtin/autopaneffect.h @@ -62,8 +62,8 @@ static constexpr int panMaxDelay = 3300; // allows a 30 Hz filter at 97346; class AutoPanGroupState : public EffectState { public: - AutoPanGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters) { + AutoPanGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters) { time = 0; delay = new EngineFilterPanSingle(); m_dPreviousPeriod = -1.0; @@ -91,7 +91,7 @@ class AutoPanEffect : public EffectProcessorImpl { AutoPanGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/balanceeffect.cpp b/src/effects/backends/builtin/balanceeffect.cpp index 82227c0da9b..b281ccd6724 100644 --- a/src/effects/backends/builtin/balanceeffect.cpp +++ b/src/effects/backends/builtin/balanceeffect.cpp @@ -65,16 +65,16 @@ EffectManifestPointer BalanceEffect::getManifest() { return pManifest; } -BalanceGroupState::BalanceGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), +BalanceGroupState::BalanceGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), m_pHighBuf(MAX_BUFFER_LEN), - m_oldSampleRate(bufferParameters.sampleRate()), + m_oldSampleRate(engineParameters.sampleRate()), m_freq(kMinCornerHz), m_oldBalance(0), m_oldMidSide(0) { - m_low = std::make_unique(bufferParameters.sampleRate(), + m_low = std::make_unique(engineParameters.sampleRate(), kMinCornerHz); - m_high = std::make_unique(bufferParameters.sampleRate(), + m_high = std::make_unique(engineParameters.sampleRate(), kMinCornerHz); m_high->setStartFromDry(true); } @@ -101,7 +101,7 @@ void BalanceEffect::processChannel( BalanceGroupState* pGroupState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -114,36 +114,36 @@ void BalanceEffect::processChannel( } CSAMPLE_GAIN balanceDelta = (balance - pGroupState->m_oldBalance) / - CSAMPLE_GAIN(bufferParameters.framesPerBuffer()); + CSAMPLE_GAIN(engineParameters.framesPerBuffer()); CSAMPLE_GAIN midSideDelta = (midSide - pGroupState->m_oldMidSide) / - CSAMPLE_GAIN(bufferParameters.framesPerBuffer()); + CSAMPLE_GAIN(engineParameters.framesPerBuffer()); CSAMPLE_GAIN balanceStart = pGroupState->m_oldBalance + balanceDelta; CSAMPLE_GAIN midSideStart = pGroupState->m_oldMidSide + midSideDelta; double freq = pGroupState->m_freq; - if (pGroupState->m_oldSampleRate != bufferParameters.sampleRate() || + if (pGroupState->m_oldSampleRate != engineParameters.sampleRate() || (freq != m_pBypassFreqParameter->value())) { freq = m_pBypassFreqParameter->value(); - pGroupState->m_oldSampleRate = bufferParameters.sampleRate(); - pGroupState->setFilters(bufferParameters.sampleRate(), pGroupState->m_freq); + pGroupState->m_oldSampleRate = engineParameters.sampleRate(); + pGroupState->setFilters(engineParameters.sampleRate(), pGroupState->m_freq); } if (pGroupState->m_freq > kMinCornerHz) { if (freq > kMinCornerHz && enableState != EffectEnableState::Disabling) { pGroupState->m_high->process(pInput, pGroupState->m_pHighBuf.data(), - bufferParameters.samplesPerBuffer()); - pGroupState->m_low->process(pInput, pOutput, bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); + pGroupState->m_low->process(pInput, pOutput, engineParameters.samplesPerBuffer()); } else { pGroupState->m_high->processAndPauseFilter(pInput, pGroupState->m_pHighBuf.data(), - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); pGroupState->m_low->processAndPauseFilter( - pInput, pOutput, bufferParameters.samplesPerBuffer()); + pInput, pOutput, engineParameters.samplesPerBuffer()); } - for (SINT i = 0; i < bufferParameters.samplesPerBuffer() / 2; ++i) { + for (SINT i = 0; i < engineParameters.samplesPerBuffer() / 2; ++i) { CSAMPLE mid = (pGroupState->m_pHighBuf[i * 2] + pGroupState->m_pHighBuf[i * 2 + 1]) / 2.0f; @@ -169,7 +169,7 @@ void BalanceEffect::processChannel( pGroupState->m_high->pauseFilter(); pGroupState->m_low->pauseFilter(); - for (SINT i = 0; i < bufferParameters.samplesPerBuffer() / 2; ++i) { + for (SINT i = 0; i < engineParameters.samplesPerBuffer() / 2; ++i) { CSAMPLE mid = (pInput[i * 2] + pInput[i * 2 + 1]) / 2.0f; CSAMPLE side = (pInput[i * 2 + 1] - pInput[i * 2]) / 2.0f; CSAMPLE_GAIN currentMidSide = midSideStart + midSideDelta * i; diff --git a/src/effects/backends/builtin/balanceeffect.h b/src/effects/backends/builtin/balanceeffect.h index f85deaa7c70..ebf372e06ff 100644 --- a/src/effects/backends/builtin/balanceeffect.h +++ b/src/effects/backends/builtin/balanceeffect.h @@ -9,7 +9,7 @@ class BalanceGroupState : public EffectState { public: - BalanceGroupState(const mixxx::EngineParameters& bufferParameters); + BalanceGroupState(const mixxx::EngineParameters& engineParameters); ~BalanceGroupState(); void setFilters(int sampleRate, double freq); @@ -41,7 +41,7 @@ class BalanceEffect : public EffectProcessorImpl { BalanceGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/bessel4lvmixeqeffect.cpp b/src/effects/backends/builtin/bessel4lvmixeqeffect.cpp index 89f46e3dd58..31fe55a00b1 100644 --- a/src/effects/backends/builtin/bessel4lvmixeqeffect.cpp +++ b/src/effects/backends/builtin/bessel4lvmixeqeffect.cpp @@ -52,14 +52,14 @@ void Bessel4LVMixEQEffect::processChannel( Bessel4LVMixEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); if (enableState == EffectEnableState::Disabling) { // Ramp to dry, when disabling, this will ramp from dry when enabling as well - pState->processChannelAndPause(pInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->processChannelAndPause(pInput, pOutput, engineParameters.samplesPerBuffer()); } else { double fLow; double fMid; @@ -81,8 +81,8 @@ void Bessel4LVMixEQEffect::processChannel( } pState->processChannel(pInput, pOutput, - bufferParameters.samplesPerBuffer(), - bufferParameters.sampleRate(), + engineParameters.samplesPerBuffer(), + engineParameters.sampleRate(), fLow, fMid, fHigh, diff --git a/src/effects/backends/builtin/bessel4lvmixeqeffect.h b/src/effects/backends/builtin/bessel4lvmixeqeffect.h index 826c7e76f0d..c5295f9eb2f 100644 --- a/src/effects/backends/builtin/bessel4lvmixeqeffect.h +++ b/src/effects/backends/builtin/bessel4lvmixeqeffect.h @@ -14,8 +14,8 @@ class Bessel4LVMixEQEffectGroupState : public LVMixEQEffectGroupState { public: - Bessel4LVMixEQEffectGroupState(const mixxx::EngineParameters& bufferParameters) - : LVMixEQEffectGroupState(bufferParameters) { + Bessel4LVMixEQEffectGroupState(const mixxx::EngineParameters& engineParameters) + : LVMixEQEffectGroupState(engineParameters) { } }; @@ -34,7 +34,7 @@ class Bessel4LVMixEQEffect : public EffectProcessorImplprocessChannelAndPause(pInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->processChannelAndPause(pInput, pOutput, engineParameters.samplesPerBuffer()); } else { double fLow; double fMid; @@ -81,8 +81,8 @@ void Bessel8LVMixEQEffect::processChannel( } pState->processChannel(pInput, pOutput, - bufferParameters.samplesPerBuffer(), - bufferParameters.sampleRate(), + engineParameters.samplesPerBuffer(), + engineParameters.sampleRate(), fLow, fMid, fHigh, diff --git a/src/effects/backends/builtin/bessel8lvmixeqeffect.h b/src/effects/backends/builtin/bessel8lvmixeqeffect.h index 00e81473f36..097df8c96e6 100644 --- a/src/effects/backends/builtin/bessel8lvmixeqeffect.h +++ b/src/effects/backends/builtin/bessel8lvmixeqeffect.h @@ -16,8 +16,8 @@ class Bessel8LVMixEQEffectGroupState : public LVMixEQEffectGroupState { public: - Bessel8LVMixEQEffectGroupState(const mixxx::EngineParameters& bufferParameters) - : LVMixEQEffectGroupState(bufferParameters) { + Bessel8LVMixEQEffectGroupState(const mixxx::EngineParameters& engineParameters) + : LVMixEQEffectGroupState(engineParameters) { } }; @@ -36,7 +36,7 @@ class Bessel8LVMixEQEffect : public EffectProcessorImpl>(bufferParameters); + LVMixEQEffectGroupState>(engineParameters); setFilters( mixxx::audio::SampleRate( @@ -164,18 +164,18 @@ void BiquadFullKillEQEffect::processChannel( BiquadFullKillEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); - if (pState->m_oldSampleRate != bufferParameters.sampleRate() || + if (pState->m_oldSampleRate != engineParameters.sampleRate() || (pState->m_loFreqCorner != m_pLoFreqCorner->get()) || (pState->m_highFreqCorner != m_pHiFreqCorner->get())) { pState->m_loFreqCorner = m_pLoFreqCorner->get(); pState->m_highFreqCorner = m_pHiFreqCorner->get(); - pState->m_oldSampleRate = bufferParameters.sampleRate(); - pState->setFilters(bufferParameters.sampleRate(), + pState->m_oldSampleRate = engineParameters.sampleRate(); + pState->setFilters(engineParameters.sampleRate(), pState->m_loFreqCorner, pState->m_highFreqCorner); } @@ -262,15 +262,15 @@ void BiquadFullKillEQEffect::processChannel( double lowCenter = getCenterFrequency( kMinimumFrequency, pState->m_loFreqCorner); pState->m_lowBoost->setFrequencyCorners( - bufferParameters.sampleRate(), lowCenter, kQBoost, bqGainLow); + engineParameters.sampleRate(), lowCenter, kQBoost, bqGainLow); pState->m_oldLowBoost = bqGainLow; } if (bqGainLow > 0.0) { pState->m_lowBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_lowBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -282,15 +282,15 @@ void BiquadFullKillEQEffect::processChannel( double lowCenter = getCenterFrequency( kMinimumFrequency, pState->m_loFreqCorner); pState->m_lowKill->setFrequencyCorners( - bufferParameters.sampleRate(), lowCenter * 2, kQLowKillShelve, bqGainLow); + engineParameters.sampleRate(), lowCenter * 2, kQLowKillShelve, bqGainLow); pState->m_oldLowKill = bqGainLow; } if (bqGainLow < 0.0) { pState->m_lowKill->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_lowKill->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -302,15 +302,15 @@ void BiquadFullKillEQEffect::processChannel( double midCenter = getCenterFrequency( pState->m_loFreqCorner, pState->m_highFreqCorner); pState->m_midBoost->setFrequencyCorners( - bufferParameters.sampleRate(), midCenter, kQBoost, bqGainMid); + engineParameters.sampleRate(), midCenter, kQBoost, bqGainMid); pState->m_oldMidBoost = bqGainMid; } if (bqGainMid > 0.0) { pState->m_midBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_midBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -322,15 +322,15 @@ void BiquadFullKillEQEffect::processChannel( double midCenter = getCenterFrequency( pState->m_loFreqCorner, pState->m_highFreqCorner); pState->m_midKill->setFrequencyCorners( - bufferParameters.sampleRate(), midCenter, kQKill, bqGainMid); + engineParameters.sampleRate(), midCenter, kQKill, bqGainMid); pState->m_oldMidKill = bqGainMid; } if (bqGainMid < 0.0) { pState->m_midKill->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_midKill->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -342,15 +342,15 @@ void BiquadFullKillEQEffect::processChannel( double highCenter = getCenterFrequency( pState->m_highFreqCorner, kMaximumFrequency); pState->m_highBoost->setFrequencyCorners( - bufferParameters.sampleRate(), highCenter, kQBoost, bqGainHigh); + engineParameters.sampleRate(), highCenter, kQBoost, bqGainHigh); pState->m_oldHighBoost = bqGainHigh; } if (bqGainHigh > 0.0) { pState->m_highBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_highBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -362,15 +362,15 @@ void BiquadFullKillEQEffect::processChannel( double highCenter = getCenterFrequency( pState->m_highFreqCorner, kMaximumFrequency); pState->m_highKill->setFrequencyCorners( - bufferParameters.sampleRate(), highCenter / 2, kQHighKillShelve, bqGainHigh); + engineParameters.sampleRate(), highCenter / 2, kQHighKillShelve, bqGainHigh); pState->m_oldHighKill = bqGainHigh; } if (bqGainHigh < 0.0) { pState->m_highKill->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_highKill->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -378,7 +378,7 @@ void BiquadFullKillEQEffect::processChannel( } if (activeFilters == 0) { - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } if (enableState == EffectEnableState::Disabling) { @@ -392,7 +392,7 @@ void BiquadFullKillEQEffect::processChannel( if (enableState == EffectEnableState::Disabling) { pState->m_lvMixIso->processChannelAndPause( - pOutput, pOutput, bufferParameters.samplesPerBuffer()); + pOutput, pOutput, engineParameters.samplesPerBuffer()); } else { double fLow = knobValueToBesselRatio( m_pPotLow->value(), m_pKillLow->toBool()); @@ -402,8 +402,8 @@ void BiquadFullKillEQEffect::processChannel( m_pPotHigh->value(), m_pKillHigh->toBool()); pState->m_lvMixIso->processChannel(pOutput, pOutput, - bufferParameters.samplesPerBuffer(), - bufferParameters.sampleRate(), + engineParameters.samplesPerBuffer(), + engineParameters.sampleRate(), fLow, fMid, fHigh, diff --git a/src/effects/backends/builtin/biquadfullkilleqeffect.h b/src/effects/backends/builtin/biquadfullkilleqeffect.h index 55239882e06..065572d8510 100644 --- a/src/effects/backends/builtin/biquadfullkilleqeffect.h +++ b/src/effects/backends/builtin/biquadfullkilleqeffect.h @@ -17,7 +17,7 @@ class BiquadFullKillEQEffectGroupState : public EffectState { public: - BiquadFullKillEQEffectGroupState(const mixxx::EngineParameters& bufferParameters); + BiquadFullKillEQEffectGroupState(const mixxx::EngineParameters& engineParameters); void setFilters( mixxx::audio::SampleRate sampleRate, @@ -70,7 +70,7 @@ class BiquadFullKillEQEffect : public EffectProcessorImplaccumulator += downsample; if (pState->accumulator >= 1.0) { diff --git a/src/effects/backends/builtin/bitcrushereffect.h b/src/effects/backends/builtin/bitcrushereffect.h index d45967c1a80..3c6d991c5be 100644 --- a/src/effects/backends/builtin/bitcrushereffect.h +++ b/src/effects/backends/builtin/bitcrushereffect.h @@ -10,8 +10,8 @@ struct BitCrusherGroupState : public EffectState { // Default accumulator to 1 so we immediately pick an input value. - BitCrusherGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + BitCrusherGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), hold_l(0), hold_r(0), accumulator(1) { @@ -36,7 +36,7 @@ class BitCrusherEffect : public EffectProcessorImpl { BitCrusherGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatureState) override; diff --git a/src/effects/backends/builtin/echoeffect.cpp b/src/effects/backends/builtin/echoeffect.cpp index 4c614813736..e76ad7def3f 100644 --- a/src/effects/backends/builtin/echoeffect.cpp +++ b/src/effects/backends/builtin/echoeffect.cpp @@ -122,7 +122,7 @@ void EchoEffect::processChannel( EchoGroupState* pGroupState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { // The minimum of the parameter is zero so the exact center of the knob is 1 beat. @@ -143,17 +143,17 @@ void EchoEffect::processChannel( period = 1 / 8.0; } delay_frames = static_cast(period * groupFeatures.beat_length_sec * - bufferParameters.sampleRate()); + engineParameters.sampleRate()); } else { // period is a number of seconds period = std::max(period, 1 / 8.0); - delay_frames = static_cast(period * bufferParameters.sampleRate()); + delay_frames = static_cast(period * engineParameters.sampleRate()); } VERIFY_OR_DEBUG_ASSERT(delay_frames > 0) { delay_frames = 1; } - int delay_samples = delay_frames * bufferParameters.channelCount(); + int delay_samples = delay_frames * engineParameters.channelCount(); VERIFY_OR_DEBUG_ASSERT(delay_samples <= pGroupState->delay_buf.size()) { delay_samples = pGroupState->delay_buf.size(); } @@ -167,17 +167,17 @@ void EchoEffect::processChannel( RampingValue send(send_current, pGroupState->prev_send, - bufferParameters.framesPerBuffer()); + engineParameters.framesPerBuffer()); // Feedback the delay buffer and then add the new input. RampingValue feedback(feedback_current, pGroupState->prev_feedback, - bufferParameters.framesPerBuffer()); + engineParameters.framesPerBuffer()); //TODO: rewrite to remove assumption of stereo buffer for (SINT i = 0; - i < bufferParameters.samplesPerBuffer(); - i += bufferParameters.channelCount()) { + i < engineParameters.samplesPerBuffer(); + i += engineParameters.channelCount()) { CSAMPLE_GAIN send_ramped = send.getNext(); CSAMPLE_GAIN feedback_ramped = feedback.getNext(); @@ -185,17 +185,17 @@ void EchoEffect::processChannel( CSAMPLE bufferedSampleRight = pGroupState->delay_buf[read_position + 1]; if (read_position != prev_read_position) { const CSAMPLE_GAIN frac = static_cast(i) / - bufferParameters.samplesPerBuffer(); + engineParameters.samplesPerBuffer(); bufferedSampleLeft *= frac; bufferedSampleRight *= frac; bufferedSampleLeft += pGroupState->delay_buf[prev_read_position] * (1 - frac); bufferedSampleRight += pGroupState->delay_buf[prev_read_position + 1] * (1 - frac); incrementRing(&prev_read_position, - bufferParameters.channelCount(), + engineParameters.channelCount(), pGroupState->delay_buf.size()); } incrementRing(&read_position, - bufferParameters.channelCount(), + engineParameters.channelCount(), pGroupState->delay_buf.size()); // Actual delays distort and saturate, so clamp the buffer here. @@ -227,7 +227,7 @@ void EchoEffect::processChannel( } incrementRing(&pGroupState->write_position, - bufferParameters.channelCount(), + engineParameters.channelCount(), pGroupState->delay_buf.size()); ++(pGroupState->ping_pong); @@ -240,7 +240,7 @@ void EchoEffect::processChannel( // this effect must handle ramping to dry when disabling itself (instead // of being handled by EngineEffect::process). if (enableState == EffectEnableState::Disabling) { - SampleUtil::applyRampingGain(pOutput, 1.0, 0.0, bufferParameters.samplesPerBuffer()); + SampleUtil::applyRampingGain(pOutput, 1.0, 0.0, engineParameters.samplesPerBuffer()); pGroupState->delay_buf.clear(); pGroupState->prev_send = 0; } else { diff --git a/src/effects/backends/builtin/echoeffect.h b/src/effects/backends/builtin/echoeffect.h index ac5949b5995..b9697f1e920 100644 --- a/src/effects/backends/builtin/echoeffect.h +++ b/src/effects/backends/builtin/echoeffect.h @@ -17,16 +17,16 @@ class EchoGroupState : public EffectState { // 40 BPM. static constexpr int kMaxDelaySeconds = 3; - EchoGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters) { - audioParametersChanged(bufferParameters); + EchoGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters) { + audioParametersChanged(engineParameters); clear(); } - void audioParametersChanged(const mixxx::EngineParameters& bufferParameters) { + void audioParametersChanged(const mixxx::EngineParameters& engineParameters) { delay_buf = mixxx::SampleBuffer(kMaxDelaySeconds * - bufferParameters.sampleRate() * - bufferParameters.channelCount()); + engineParameters.sampleRate() * + engineParameters.channelCount()); }; void clear() { @@ -60,7 +60,7 @@ class EchoEffect : public EffectProcessorImpl { EchoGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/filtereffect.cpp b/src/effects/backends/builtin/filtereffect.cpp index c1f606140a8..99633d3d635 100644 --- a/src/effects/backends/builtin/filtereffect.cpp +++ b/src/effects/backends/builtin/filtereffect.cpp @@ -63,12 +63,12 @@ EffectManifestPointer FilterEffect::getManifest() { return pManifest; } -FilterGroupState::FilterGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), - m_loFreq(kMaxCorner / bufferParameters.sampleRate()), +FilterGroupState::FilterGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), + m_loFreq(kMaxCorner / engineParameters.sampleRate()), m_q(0.707106781), - m_hiFreq(kMinCorner / bufferParameters.sampleRate()) { - m_buffer = mixxx::SampleBuffer(bufferParameters.samplesPerBuffer()); + m_hiFreq(kMinCorner / engineParameters.sampleRate()) { + m_buffer = mixxx::SampleBuffer(engineParameters.samplesPerBuffer()); m_pLowFilter = new EngineFilterBiquad1Low(1, m_loFreq, m_q, true); m_pHighFilter = new EngineFilterBiquad1High(1, m_hiFreq, m_q, true); } @@ -93,7 +93,7 @@ void FilterEffect::processChannel( FilterGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -102,16 +102,16 @@ void FilterEffect::processChannel( double lpf; double q = m_pQ->value(); - const double minCornerNormalized = kMinCorner / bufferParameters.sampleRate(); - const double maxCornerNormalized = kMaxCorner / bufferParameters.sampleRate(); + const double minCornerNormalized = kMinCorner / engineParameters.sampleRate(); + const double maxCornerNormalized = kMaxCorner / engineParameters.sampleRate(); if (enableState == EffectEnableState::Disabling) { // Ramp to dry, when disabling, this will ramp from dry when enabling as well hpf = minCornerNormalized; lpf = maxCornerNormalized; } else { - hpf = m_pHPF->value() / bufferParameters.sampleRate(); - lpf = m_pLPF->value() / bufferParameters.sampleRate(); + hpf = m_pHPF->value() / engineParameters.sampleRate(); + lpf = m_pLPF->value() / engineParameters.sampleRate(); } if ((pState->m_loFreq != lpf) || @@ -146,12 +146,12 @@ void FilterEffect::processChannel( if (hpf > minCornerNormalized) { // hpf enabled, fade-in is handled in the filter when starting from pause - pState->m_pHighFilter->process(pInput, pHpfOutput, bufferParameters.samplesPerBuffer()); + pState->m_pHighFilter->process(pInput, pHpfOutput, engineParameters.samplesPerBuffer()); } else if (pState->m_hiFreq > minCornerNormalized) { // hpf disabling pState->m_pHighFilter->processAndPauseFilter(pInput, pHpfOutput, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else { // paused LP uses input directly pLpfInput = pInput; @@ -159,17 +159,17 @@ void FilterEffect::processChannel( if (lpf < maxCornerNormalized) { // lpf enabled, fade-in is handled in the filter when starting from pause - pState->m_pLowFilter->process(pLpfInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->m_pLowFilter->process(pLpfInput, pOutput, engineParameters.samplesPerBuffer()); } else if (pState->m_loFreq < maxCornerNormalized) { // hpf disabling pState->m_pLowFilter->processAndPauseFilter(pLpfInput, pOutput, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else if (pLpfInput == pInput) { // Both disabled if (pOutput != pInput) { // We need to copy pInput pOutput - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } } diff --git a/src/effects/backends/builtin/filtereffect.h b/src/effects/backends/builtin/filtereffect.h index bcf4f8940e3..60ffc19caaf 100644 --- a/src/effects/backends/builtin/filtereffect.h +++ b/src/effects/backends/builtin/filtereffect.h @@ -11,7 +11,7 @@ #include "util/types.h" struct FilterGroupState : public EffectState { - FilterGroupState(const mixxx::EngineParameters& bufferParameters); + FilterGroupState(const mixxx::EngineParameters& engineParameters); ~FilterGroupState(); void setFilters(int sampleRate, double lowFreq, double highFreq); @@ -40,7 +40,7 @@ class FilterEffect : public EffectProcessorImpl { FilterGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/flangereffect.cpp b/src/effects/backends/builtin/flangereffect.cpp index 70d77374f05..347bc65abf4 100644 --- a/src/effects/backends/builtin/flangereffect.cpp +++ b/src/effects/backends/builtin/flangereffect.cpp @@ -116,7 +116,7 @@ void FlangerEffect::processChannel( FlangerGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { double lfoPeriodParameter = m_pSpeedParameter->value(); @@ -128,11 +128,11 @@ void FlangerEffect::processChannel( lfoPeriodParameter /= 3.0; } lfoPeriodFrames = lfoPeriodParameter * groupFeatures.beat_length_sec * - bufferParameters.sampleRate(); + engineParameters.sampleRate(); } else { // lfoPeriodParameter is a number of seconds lfoPeriodFrames = std::max(lfoPeriodParameter, kMinLfoBeats) * - bufferParameters.sampleRate(); + engineParameters.sampleRate(); } // When the period is changed, the position of the sound shouldn't @@ -149,12 +149,12 @@ void FlangerEffect::processChannel( const auto mix = static_cast(m_pMixParameter->value()); RampingValue mixRamped( - pState->prev_mix, mix, bufferParameters.framesPerBuffer()); + pState->prev_mix, mix, engineParameters.framesPerBuffer()); pState->prev_mix = mix; const auto regen = static_cast(m_pRegenParameter->value()); RampingValue regenRamped( - pState->prev_regen, regen, bufferParameters.framesPerBuffer()); + pState->prev_regen, regen, engineParameters.framesPerBuffer()); pState->prev_regen = regen; // With and Manual is limited by amount of amplitude that remains from width @@ -166,19 +166,19 @@ void FlangerEffect::processChannel( manual = math_clamp(manual, minManual, maxManual); RampingValue widthRamped( - pState->prev_width, width, bufferParameters.framesPerBuffer()); + pState->prev_width, width, engineParameters.framesPerBuffer()); pState->prev_width = static_cast(width); RampingValue manualRamped( - pState->prev_manual, manual, bufferParameters.framesPerBuffer()); + pState->prev_manual, manual, engineParameters.framesPerBuffer()); pState->prev_manual = static_cast(manual); CSAMPLE* delayLeft = pState->delayLeft; CSAMPLE* delayRight = pState->delayRight; for (SINT i = 0; - i < bufferParameters.samplesPerBuffer(); - i += bufferParameters.channelCount()) { + i < engineParameters.samplesPerBuffer(); + i += engineParameters.channelCount()) { CSAMPLE_GAIN mix_ramped = mixRamped.getNext(); CSAMPLE_GAIN regen_ramped = regenRamped.getNext(); double width_ramped = widthRamped.getNext(); @@ -191,7 +191,7 @@ void FlangerEffect::processChannel( auto periodFraction = pState->lfoFrames / static_cast(lfoPeriodFrames); double delayMs = manual_ramped + width_ramped / 2 * sin(M_PI * 2.0f * periodFraction); - double delayFrames = delayMs * bufferParameters.sampleRate() / 1000; + double delayFrames = delayMs * engineParameters.sampleRate() / 1000; SINT framePrev = (pState->delayPos - static_cast(floor(delayFrames)) + diff --git a/src/effects/backends/builtin/flangereffect.h b/src/effects/backends/builtin/flangereffect.h index d0b988a5e00..59420861701 100644 --- a/src/effects/backends/builtin/flangereffect.h +++ b/src/effects/backends/builtin/flangereffect.h @@ -23,8 +23,8 @@ constexpr double kMaxLfoBeats = 32.0; } // anonymous namespace struct FlangerGroupState : public EffectState { - FlangerGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + FlangerGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), delayPos(0), lfoFrames(0), previousPeriodFrames(-1), @@ -61,7 +61,7 @@ class FlangerEffect : public EffectProcessorImpl { FlangerGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/graphiceqeffect.cpp b/src/effects/backends/builtin/graphiceqeffect.cpp index 94784c369eb..64c9576c753 100644 --- a/src/effects/backends/builtin/graphiceqeffect.cpp +++ b/src/effects/backends/builtin/graphiceqeffect.cpp @@ -70,16 +70,16 @@ EffectManifestPointer GraphicEQEffect::getManifest() { } GraphicEQEffectGroupState::GraphicEQEffectGroupState( - const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters) { + const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters) { m_oldLow = 0; for (int i = 0; i < 6; i++) { m_oldMid.append(1.0); } m_oldHigh = 0; - m_pBufs.append(SampleUtil::alloc(bufferParameters.samplesPerBuffer())); - m_pBufs.append(SampleUtil::alloc(bufferParameters.samplesPerBuffer())); + m_pBufs.append(SampleUtil::alloc(engineParameters.samplesPerBuffer())); + m_pBufs.append(SampleUtil::alloc(engineParameters.samplesPerBuffer())); // Initialize the default center frequencies m_centerFrequencies[0] = 81; @@ -138,16 +138,16 @@ void GraphicEQEffect::processChannel( GraphicEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); // If the sample rate has changed, initialize the filters using the new // sample rate - if (m_oldSampleRate != bufferParameters.sampleRate()) { - m_oldSampleRate = bufferParameters.sampleRate(); - pState->setFilters(bufferParameters.sampleRate()); + if (m_oldSampleRate != engineParameters.sampleRate()) { + m_oldSampleRate = engineParameters.sampleRate(); + pState->setFilters(engineParameters.sampleRate()); } float fLow; @@ -171,20 +171,20 @@ void GraphicEQEffect::processChannel( } if (fLow != pState->m_oldLow) { - pState->m_low->setFrequencyCorners(bufferParameters.sampleRate(), + pState->m_low->setFrequencyCorners(engineParameters.sampleRate(), pState->m_centerFrequencies[0], Q, fLow); } if (fHigh != pState->m_oldHigh) { - pState->m_high->setFrequencyCorners(bufferParameters.sampleRate(), + pState->m_high->setFrequencyCorners(engineParameters.sampleRate(), pState->m_centerFrequencies[7], Q, fHigh); } for (int i = 0; i < 6; i++) { if (fMid[i] != pState->m_oldMid[i]) { - pState->m_bands[i]->setFrequencyCorners(bufferParameters.sampleRate(), + pState->m_bands[i]->setFrequencyCorners(engineParameters.sampleRate(), pState->m_centerFrequencies[i + 1], Q, fMid[i]); @@ -195,18 +195,18 @@ void GraphicEQEffect::processChannel( if (fLow != 0) { pState->m_low->process(pInput, pState->m_pBufs[1 - bufIndex], - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); bufIndex = 1 - bufIndex; } else { pState->m_low->pauseFilter(); - SampleUtil::copy(pState->m_pBufs[bufIndex], pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pState->m_pBufs[bufIndex], pInput, engineParameters.samplesPerBuffer()); } for (int i = 0; i < 6; i++) { if (fMid[i] != 0) { pState->m_bands[i]->process(pState->m_pBufs[bufIndex], pState->m_pBufs[1 - bufIndex], - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); bufIndex = 1 - bufIndex; } else { pState->m_bands[i]->pauseFilter(); @@ -216,9 +216,9 @@ void GraphicEQEffect::processChannel( if (fHigh != 0) { pState->m_high->process(pState->m_pBufs[bufIndex], pOutput, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else { - SampleUtil::copy(pOutput, pState->m_pBufs[bufIndex], bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pState->m_pBufs[bufIndex], engineParameters.samplesPerBuffer()); pState->m_high->pauseFilter(); } diff --git a/src/effects/backends/builtin/graphiceqeffect.h b/src/effects/backends/builtin/graphiceqeffect.h index 5116ebba86f..42178c65ba2 100644 --- a/src/effects/backends/builtin/graphiceqeffect.h +++ b/src/effects/backends/builtin/graphiceqeffect.h @@ -14,7 +14,7 @@ class GraphicEQEffectGroupState : public EffectState { public: - GraphicEQEffectGroupState(const mixxx::EngineParameters& bufferParameters); + GraphicEQEffectGroupState(const mixxx::EngineParameters& engineParameters); virtual ~GraphicEQEffectGroupState(); void setFilters(int sampleRate); @@ -44,7 +44,7 @@ class GraphicEQEffect : public EffectProcessorImpl { GraphicEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatureState) override; diff --git a/src/effects/backends/builtin/linkwitzriley8eqeffect.cpp b/src/effects/backends/builtin/linkwitzriley8eqeffect.cpp index 9222d085d3b..03c020a441c 100644 --- a/src/effects/backends/builtin/linkwitzriley8eqeffect.cpp +++ b/src/effects/backends/builtin/linkwitzriley8eqeffect.cpp @@ -32,8 +32,8 @@ EffectManifestPointer LinkwitzRiley8EQEffect::getManifest() { } LinkwitzRiley8EQEffectGroupState::LinkwitzRiley8EQEffectGroupState( - const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), old_low(1.0), old_mid(1.0), old_high(1.0), @@ -91,7 +91,7 @@ void LinkwitzRiley8EQEffect::processChannel( LinkwitzRiley8EQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -107,48 +107,48 @@ void LinkwitzRiley8EQEffect::processChannel( fHigh = static_cast(m_pPotHigh->value()); } - if (pState->m_oldSampleRate != bufferParameters.sampleRate() || + if (pState->m_oldSampleRate != engineParameters.sampleRate() || (pState->m_loFreq != static_cast(m_pLoFreqCorner->get())) || (pState->m_hiFreq != static_cast(m_pHiFreqCorner->get()))) { pState->m_loFreq = static_cast(m_pLoFreqCorner->get()); pState->m_hiFreq = static_cast(m_pHiFreqCorner->get()); - pState->m_oldSampleRate = bufferParameters.sampleRate(); - pState->setFilters(bufferParameters.sampleRate(), pState->m_loFreq, pState->m_hiFreq); + pState->m_oldSampleRate = engineParameters.sampleRate(); + pState->setFilters(engineParameters.sampleRate(), pState->m_loFreq, pState->m_hiFreq); } pState->m_high2->process(pInput, pState->m_pHighBuf, - bufferParameters.samplesPerBuffer()); // HighPass first run + engineParameters.samplesPerBuffer()); // HighPass first run pState->m_low2->process(pInput, pState->m_pLowBuf, - bufferParameters + engineParameters .samplesPerBuffer()); // LowPass first run for low and bandpass if (fMid != pState->old_mid || fHigh != pState->old_high) { SampleUtil::applyRampingGain(pState->m_pHighBuf, static_cast(pState->old_high), fHigh, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); SampleUtil::addWithRampingGain(pState->m_pHighBuf, pState->m_pLowBuf, static_cast(pState->old_mid), fMid, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else { - SampleUtil::applyGain(pState->m_pHighBuf, fHigh, bufferParameters.samplesPerBuffer()); + SampleUtil::applyGain(pState->m_pHighBuf, fHigh, engineParameters.samplesPerBuffer()); SampleUtil::addWithGain(pState->m_pHighBuf, pState->m_pLowBuf, fMid, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } pState->m_high1->process(pState->m_pHighBuf, pState->m_pMidBuf, - bufferParameters + engineParameters .samplesPerBuffer()); // HighPass + BandPass second run pState->m_low1->process(pState->m_pLowBuf, pState->m_pLowBuf, - bufferParameters.samplesPerBuffer()); // LowPass second run + engineParameters.samplesPerBuffer()); // LowPass second run if (fLow != pState->old_low) { SampleUtil::copy2WithRampingGain(pOutput, @@ -158,14 +158,14 @@ void LinkwitzRiley8EQEffect::processChannel( pState->m_pMidBuf, 1, 1, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else { SampleUtil::copy2WithGain(pOutput, pState->m_pLowBuf, fLow, pState->m_pMidBuf, 1, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } if (enableState == EffectEnableState::Disabling) { diff --git a/src/effects/backends/builtin/linkwitzriley8eqeffect.h b/src/effects/backends/builtin/linkwitzriley8eqeffect.h index 53cb383dcec..15ed871dc02 100644 --- a/src/effects/backends/builtin/linkwitzriley8eqeffect.h +++ b/src/effects/backends/builtin/linkwitzriley8eqeffect.h @@ -14,7 +14,7 @@ class LinkwitzRiley8EQEffectGroupState : public EffectState { public: - LinkwitzRiley8EQEffectGroupState(const mixxx::EngineParameters& bufferParameters); + LinkwitzRiley8EQEffectGroupState(const mixxx::EngineParameters& engineParameters); virtual ~LinkwitzRiley8EQEffectGroupState(); void setFilters(int sampleRate, int lowFreq, int highFreq); @@ -52,7 +52,7 @@ class LinkwitzRiley8EQEffect : public EffectProcessorImpl( - bufferParameters.sampleRate(), kLoPeakFreq, kHiShelveQ); + engineParameters.sampleRate(), kLoPeakFreq, kHiShelveQ); m_high = std::make_unique( - bufferParameters.sampleRate(), kHiShelveFreq, kHiShelveQ); + engineParameters.sampleRate(), kHiShelveFreq, kHiShelveQ); } LoudnessContourEffectGroupState::~LoudnessContourEffectGroupState() { @@ -100,7 +100,7 @@ void LoudnessContourEffect::processChannel( LoudnessContourEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -118,11 +118,11 @@ void LoudnessContourEffect::processChannel( if (useGain != pState->m_oldUseGain || gainKnob != pState->m_oldGainKnob || loudness != pState->m_oldLoudness || - bufferParameters.sampleRate() != pState->m_oldSampleRate) { + engineParameters.sampleRate() != pState->m_oldSampleRate) { pState->m_oldUseGain = useGain; pState->m_oldGainKnob = gainKnob; pState->m_oldLoudness = loudness; - pState->m_oldSampleRate = bufferParameters.sampleRate(); + pState->m_oldSampleRate = engineParameters.sampleRate(); if (useGain) { gainKnob = math_clamp(gainKnob, 0.03, 1.0); // Limit at 0 .. -30 dB @@ -134,22 +134,22 @@ void LoudnessContourEffect::processChannel( // compensate filter boost to avoid clipping gain = static_cast(db2ratio(-filterGainDb)); } - pState->setFilters(bufferParameters.sampleRate(), filterGainDb); + pState->setFilters(engineParameters.sampleRate(), filterGainDb); } } if (filterGainDb == 0) { pState->m_low->pauseFilter(); pState->m_high->pauseFilter(); - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } else { - pState->m_low->process(pInput, pOutput, bufferParameters.samplesPerBuffer()); - pState->m_high->process(pOutput, pState->m_pBuf, bufferParameters.samplesPerBuffer()); + pState->m_low->process(pInput, pOutput, engineParameters.samplesPerBuffer()); + pState->m_high->process(pOutput, pState->m_pBuf, engineParameters.samplesPerBuffer()); SampleUtil::copyWithRampingGain(pOutput, pState->m_pBuf, pState->m_oldGain, gain, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } pState->m_oldFilterGainDb = filterGainDb; diff --git a/src/effects/backends/builtin/loudnesscontoureffect.h b/src/effects/backends/builtin/loudnesscontoureffect.h index e8f9dd72cc2..01eef8f304a 100644 --- a/src/effects/backends/builtin/loudnesscontoureffect.h +++ b/src/effects/backends/builtin/loudnesscontoureffect.h @@ -13,7 +13,7 @@ class LoudnessContourEffectGroupState final : public EffectState { public: - LoudnessContourEffectGroupState(const mixxx::EngineParameters& bufferParameters); + LoudnessContourEffectGroupState(const mixxx::EngineParameters& engineParameters); ~LoudnessContourEffectGroupState(); void setFilters(int sampleRate, double gain); @@ -45,7 +45,7 @@ class LoudnessContourEffect LoudnessContourEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatureState) override; diff --git a/src/effects/backends/builtin/lvmixeqbase.h b/src/effects/backends/builtin/lvmixeqbase.h index f409755e2da..e24e20e5832 100644 --- a/src/effects/backends/builtin/lvmixeqbase.h +++ b/src/effects/backends/builtin/lvmixeqbase.h @@ -20,26 +20,26 @@ class LVMixEQEffectGroupStateConstants { template class LVMixEQEffectGroupState : public EffectState { public: - explicit LVMixEQEffectGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + explicit LVMixEQEffectGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), m_oldLow(1.0), m_oldMid(1.0), m_oldHigh(1.0), m_rampHoldOff(LVMixEQEffectGroupStateConstants::kRampDone), - m_oldSampleRate(bufferParameters.sampleRate()), + m_oldSampleRate(engineParameters.sampleRate()), m_loFreq(LVMixEQEffectGroupStateConstants::kStartupLoFreq), m_hiFreq(LVMixEQEffectGroupStateConstants::kStartupHiFreq) { - m_pLowBuf = SampleUtil::alloc(bufferParameters.samplesPerBuffer()); - m_pBandBuf = SampleUtil::alloc(bufferParameters.samplesPerBuffer()); - m_pHighBuf = SampleUtil::alloc(bufferParameters.samplesPerBuffer()); + m_pLowBuf = SampleUtil::alloc(engineParameters.samplesPerBuffer()); + m_pBandBuf = SampleUtil::alloc(engineParameters.samplesPerBuffer()); + m_pHighBuf = SampleUtil::alloc(engineParameters.samplesPerBuffer()); - m_low1 = new LPF(bufferParameters.sampleRate(), + m_low1 = new LPF(engineParameters.sampleRate(), LVMixEQEffectGroupStateConstants::kStartupLoFreq); - m_low2 = new LPF(bufferParameters.sampleRate(), + m_low2 = new LPF(engineParameters.sampleRate(), LVMixEQEffectGroupStateConstants::kStartupHiFreq); m_delay2 = new EngineFilterDelay(); m_delay3 = new EngineFilterDelay(); - setFilters(bufferParameters.sampleRate(), + setFilters(engineParameters.sampleRate(), LVMixEQEffectGroupStateConstants::kStartupLoFreq, LVMixEQEffectGroupStateConstants::kStartupHiFreq); } diff --git a/src/effects/backends/builtin/metronomeeffect.cpp b/src/effects/backends/builtin/metronomeeffect.cpp index b16652437ca..e94e9e26cde 100644 --- a/src/effects/backends/builtin/metronomeeffect.cpp +++ b/src/effects/backends/builtin/metronomeeffect.cpp @@ -58,7 +58,7 @@ void MetronomeEffect::processChannel( MetronomeGroupState* pGroupState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(pInput); @@ -72,10 +72,10 @@ void MetronomeEffect::processChannel( SINT clickSize = kClickSize44100; const CSAMPLE* click = kClick44100; - if (bufferParameters.sampleRate() >= 96000) { + if (engineParameters.sampleRate() >= 96000) { clickSize = kClickSize96000; click = kClick96000; - } else if (bufferParameters.sampleRate() >= 48000) { + } else if (engineParameters.sampleRate() >= 48000) { clickSize = kClickSize48000; click = kClick48000; } @@ -83,7 +83,7 @@ void MetronomeEffect::processChannel( SINT maxFrames; if (m_pSyncParameter->toBool() && groupFeatures.has_beat_length_sec) { maxFrames = static_cast( - bufferParameters.sampleRate() * groupFeatures.beat_length_sec); + engineParameters.sampleRate() * groupFeatures.beat_length_sec); if (groupFeatures.has_beat_fraction) { const auto currentFrame = static_cast( maxFrames * groupFeatures.beat_fraction); @@ -97,33 +97,33 @@ void MetronomeEffect::processChannel( } } else { maxFrames = static_cast( - bufferParameters.sampleRate() * 60 / m_pBpmParameter->value()); + engineParameters.sampleRate() * 60 / m_pBpmParameter->value()); } - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); if (gs->m_framesSinceClickStart < clickSize) { // still in click region, write remaining click frames. const SINT copyFrames = - math_min(bufferParameters.framesPerBuffer(), + math_min(engineParameters.framesPerBuffer(), clickSize - gs->m_framesSinceClickStart); SampleUtil::addMonoToStereo(pOutput, &click[gs->m_framesSinceClickStart], copyFrames); } - gs->m_framesSinceClickStart += bufferParameters.framesPerBuffer(); + gs->m_framesSinceClickStart += engineParameters.framesPerBuffer(); if (gs->m_framesSinceClickStart > maxFrames) { // overflow, all overflowed frames are the start of a new click sound gs->m_framesSinceClickStart -= maxFrames; - while (gs->m_framesSinceClickStart > bufferParameters.framesPerBuffer()) { + while (gs->m_framesSinceClickStart > engineParameters.framesPerBuffer()) { // loop into a valid region, this happens if the maxFrames was lowered - gs->m_framesSinceClickStart -= bufferParameters.framesPerBuffer(); + gs->m_framesSinceClickStart -= engineParameters.framesPerBuffer(); } // gs->m_framesSinceClickStart matches now already at the first frame // of next pOutput. const unsigned int outputOffset = - bufferParameters.framesPerBuffer() - gs->m_framesSinceClickStart; + engineParameters.framesPerBuffer() - gs->m_framesSinceClickStart; const unsigned int copyFrames = math_min(gs->m_framesSinceClickStart, clickSize); SampleUtil::addMonoToStereo(&pOutput[outputOffset * 2], click, copyFrames); diff --git a/src/effects/backends/builtin/metronomeeffect.h b/src/effects/backends/builtin/metronomeeffect.h index 7fe0f29d285..1a95fe03dbb 100644 --- a/src/effects/backends/builtin/metronomeeffect.h +++ b/src/effects/backends/builtin/metronomeeffect.h @@ -13,8 +13,8 @@ class MetronomeGroupState final : public EffectState { public: - MetronomeGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + MetronomeGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), m_framesSinceClickStart(0) { } ~MetronomeGroupState() { @@ -38,7 +38,7 @@ class MetronomeEffect : public EffectProcessorImpl { MetronomeGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/moogladder4filtereffect.cpp b/src/effects/backends/builtin/moogladder4filtereffect.cpp index 018efe7fe10..d907538c4a7 100644 --- a/src/effects/backends/builtin/moogladder4filtereffect.cpp +++ b/src/effects/backends/builtin/moogladder4filtereffect.cpp @@ -57,20 +57,20 @@ EffectManifestPointer MoogLadder4FilterEffect::getManifest() { } MoogLadder4FilterGroupState::MoogLadder4FilterGroupState( - const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), m_loFreq(kMaxCorner), m_resonance(0), m_hiFreq(kMinCorner), - m_samplerate(bufferParameters.sampleRate()) { - m_pBuf = SampleUtil::alloc(bufferParameters.samplesPerBuffer()); + m_samplerate(engineParameters.sampleRate()) { + m_pBuf = SampleUtil::alloc(engineParameters.samplesPerBuffer()); m_pLowFilter = new EngineFilterMoogLadder4Low( - bufferParameters.sampleRate(), - m_loFreq * bufferParameters.sampleRate(), + engineParameters.sampleRate(), + m_loFreq * engineParameters.sampleRate(), m_resonance); m_pHighFilter = new EngineFilterMoogLadder4High( - bufferParameters.sampleRate(), - m_hiFreq * bufferParameters.sampleRate(), + engineParameters.sampleRate(), + m_hiFreq * engineParameters.sampleRate(), m_resonance); } @@ -95,7 +95,7 @@ void MoogLadder4FilterEffect::processChannel( MoogLadder4FilterGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -114,17 +114,17 @@ void MoogLadder4FilterEffect::processChannel( if (pState->m_loFreq != lpf || pState->m_resonance != resonance || - pState->m_samplerate != bufferParameters.sampleRate()) { - pState->m_pLowFilter->setParameter(bufferParameters.sampleRate(), - static_cast(lpf * bufferParameters.sampleRate()), + pState->m_samplerate != engineParameters.sampleRate()) { + pState->m_pLowFilter->setParameter(engineParameters.sampleRate(), + static_cast(lpf * engineParameters.sampleRate()), static_cast(resonance)); } if (pState->m_hiFreq != hpf || pState->m_resonance != resonance || - pState->m_samplerate != bufferParameters.sampleRate()) { - pState->m_pHighFilter->setParameter(bufferParameters.sampleRate(), - static_cast(hpf * bufferParameters.sampleRate()), + pState->m_samplerate != engineParameters.sampleRate()) { + pState->m_pHighFilter->setParameter(engineParameters.sampleRate(), + static_cast(hpf * engineParameters.sampleRate()), static_cast(resonance)); } @@ -138,12 +138,12 @@ void MoogLadder4FilterEffect::processChannel( if (hpf > kMinCorner) { // hpf enabled, fade-in is handled in the filter when starting from pause - pState->m_pHighFilter->process(pInput, pHpfOutput, bufferParameters.samplesPerBuffer()); + pState->m_pHighFilter->process(pInput, pHpfOutput, engineParameters.samplesPerBuffer()); } else if (pState->m_hiFreq > kMinCorner) { // hpf disabling pState->m_pHighFilter->processAndPauseFilter(pInput, pHpfOutput, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else { // paused LP uses input directly pLpfInput = pInput; @@ -151,22 +151,22 @@ void MoogLadder4FilterEffect::processChannel( if (lpf < kMaxCorner) { // lpf enabled, fade-in is handled in the filter when starting from pause - pState->m_pLowFilter->process(pLpfInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->m_pLowFilter->process(pLpfInput, pOutput, engineParameters.samplesPerBuffer()); } else if (pState->m_loFreq < kMaxCorner) { // hpf disabling pState->m_pLowFilter->processAndPauseFilter(pLpfInput, pOutput, - bufferParameters.samplesPerBuffer()); + engineParameters.samplesPerBuffer()); } else if (pLpfInput == pInput) { // Both disabled if (pOutput != pInput) { // We need to copy pInput pOutput - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } } pState->m_loFreq = lpf; pState->m_resonance = resonance; pState->m_hiFreq = hpf; - pState->m_samplerate = bufferParameters.sampleRate(); + pState->m_samplerate = engineParameters.sampleRate(); } diff --git a/src/effects/backends/builtin/moogladder4filtereffect.h b/src/effects/backends/builtin/moogladder4filtereffect.h index f819690b5fe..8814a536173 100644 --- a/src/effects/backends/builtin/moogladder4filtereffect.h +++ b/src/effects/backends/builtin/moogladder4filtereffect.h @@ -10,7 +10,7 @@ class MoogLadder4FilterGroupState : public EffectState { public: - MoogLadder4FilterGroupState(const mixxx::EngineParameters& bufferParameters); + MoogLadder4FilterGroupState(const mixxx::EngineParameters& engineParameters); ~MoogLadder4FilterGroupState(); void setFilters(int sampleRate, double lowFreq, double highFreq); @@ -39,7 +39,7 @@ class MoogLadder4FilterEffect : public EffectProcessorImpl( - bufferParameters.sampleRate(), m_oldCenter[i], m_oldQ[i])); + engineParameters.sampleRate(), m_oldCenter[i], m_oldQ[i])); } } @@ -143,16 +143,16 @@ void ParametricEQEffect::processChannel( ParametricEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); // If the sample rate has changed, initialize the filters using the new // sample rate - if (pState->m_oldSampleRate != bufferParameters.sampleRate()) { - pState->m_oldSampleRate = bufferParameters.sampleRate(); - pState->setFilters(bufferParameters.sampleRate()); + if (pState->m_oldSampleRate != engineParameters.sampleRate()) { + pState->m_oldSampleRate = engineParameters.sampleRate(); + pState->setFilters(engineParameters.sampleRate()); } CSAMPLE_GAIN fGain[2]; @@ -172,24 +172,24 @@ void ParametricEQEffect::processChannel( fQ[i] != pState->m_oldQ[i] || fCenter[i] != pState->m_oldCenter[i]) { pState->m_bands[i]->setFrequencyCorners( - bufferParameters.sampleRate(), fCenter[i], fQ[i], fGain[i]); + engineParameters.sampleRate(), fCenter[i], fQ[i], fGain[i]); } } if (fGain[0] != 0) { - pState->m_bands[0]->process(pInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->m_bands[0]->process(pInput, pOutput, engineParameters.samplesPerBuffer()); if (fGain[1] != 0) { - pState->m_bands[1]->process(pOutput, pOutput, bufferParameters.samplesPerBuffer()); + pState->m_bands[1]->process(pOutput, pOutput, engineParameters.samplesPerBuffer()); } else { pState->m_bands[1]->pauseFilter(); } } else { pState->m_bands[0]->pauseFilter(); if (fGain[1] != 0) { - pState->m_bands[1]->process(pInput, pOutput, bufferParameters.samplesPerBuffer()); + pState->m_bands[1]->process(pInput, pOutput, engineParameters.samplesPerBuffer()); } else { pState->m_bands[1]->pauseFilter(); - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } } diff --git a/src/effects/backends/builtin/parametriceqeffect.h b/src/effects/backends/builtin/parametriceqeffect.h index caf3ea42b99..eae3ecff4e3 100644 --- a/src/effects/backends/builtin/parametriceqeffect.h +++ b/src/effects/backends/builtin/parametriceqeffect.h @@ -23,7 +23,7 @@ class ParametricEQEffectGroupState final : public EffectState { public: - ParametricEQEffectGroupState(const mixxx::EngineParameters& bufferParameters); + ParametricEQEffectGroupState(const mixxx::EngineParameters& engineParameters); void setFilters(int sampleRate); @@ -54,7 +54,7 @@ class ParametricEQEffect : public EffectProcessorImploldDepth; - const CSAMPLE_GAIN depthDelta = (depth - oldDepth) / bufferParameters.framesPerBuffer(); + const CSAMPLE_GAIN depthDelta = (depth - oldDepth) / engineParameters.framesPerBuffer(); const CSAMPLE_GAIN depthStart = oldDepth + depthDelta; const auto stereoCheck = static_cast(m_pStereoParameter->value()); int counter = 0; for (SINT i = 0; - i < bufferParameters.samplesPerBuffer(); - i += bufferParameters.channelCount()) { + i < engineParameters.samplesPerBuffer(); + i += engineParameters.channelCount()) { left = pInput[i] + std::tanh(left * feedback); right = pInput[i + 1] + std::tanh(right * feedback); @@ -206,7 +206,7 @@ void PhaserEffect::processChannel( left = processSample(left, oldInLeft, oldOutLeft, filterCoefLeft, stages); right = processSample(right, oldInRight, oldOutRight, filterCoefRight, stages); - const CSAMPLE_GAIN depth = depthStart + depthDelta * (i / bufferParameters.channelCount()); + const CSAMPLE_GAIN depth = depthStart + depthDelta * (i / engineParameters.channelCount()); // Computing output combining the original and processed sample pOutput[i] = pInput[i] * (1.0f - 0.5f * depth) + left * depth * 0.5f; diff --git a/src/effects/backends/builtin/phasereffect.h b/src/effects/backends/builtin/phasereffect.h index fb36f64d051..1e6312f840d 100644 --- a/src/effects/backends/builtin/phasereffect.h +++ b/src/effects/backends/builtin/phasereffect.h @@ -12,8 +12,8 @@ class PhaserGroupState final : public EffectState { public: - PhaserGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters) { + PhaserGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters) { clear(); } @@ -51,7 +51,7 @@ class PhaserEffect : public EffectProcessorImpl { PhaserGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/reverbeffect.cpp b/src/effects/backends/builtin/reverbeffect.cpp index 27f9292263e..eb6cf0081cd 100644 --- a/src/effects/backends/builtin/reverbeffect.cpp +++ b/src/effects/backends/builtin/reverbeffect.cpp @@ -85,7 +85,7 @@ void ReverbEffect::processChannel( ReverbGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -99,14 +99,14 @@ void ReverbEffect::processChannel( // from the last time the effect was enabled. // Also, update the sample rate if it has changed. if (enableState == EffectEnableState::Enabling || - pState->sampleRate != bufferParameters.sampleRate()) { - pState->reverb.init(bufferParameters.sampleRate()); - pState->sampleRate = bufferParameters.sampleRate(); + pState->sampleRate != engineParameters.sampleRate()) { + pState->reverb.init(engineParameters.sampleRate()); + pState->sampleRate = engineParameters.sampleRate(); } pState->reverb.processBuffer(pInput, pOutput, - bufferParameters.samplesPerBuffer(), + engineParameters.samplesPerBuffer(), bandwidth, decay, damping, @@ -117,7 +117,7 @@ void ReverbEffect::processChannel( // this effect must handle ramping to dry when disabling itself (instead // of being handled by EngineEffect::process). if (enableState == EffectEnableState::Disabling) { - SampleUtil::applyRampingGain(pOutput, 1.0, 0.0, bufferParameters.samplesPerBuffer()); + SampleUtil::applyRampingGain(pOutput, 1.0, 0.0, engineParameters.samplesPerBuffer()); pState->sendPrevious = 0; } else { pState->sendPrevious = sendCurrent; diff --git a/src/effects/backends/builtin/reverbeffect.h b/src/effects/backends/builtin/reverbeffect.h index 11b629e4b31..cc9f57ae12c 100644 --- a/src/effects/backends/builtin/reverbeffect.h +++ b/src/effects/backends/builtin/reverbeffect.h @@ -17,13 +17,13 @@ class ReverbGroupState : public EffectState { public: - ReverbGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + ReverbGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), sendPrevious(0) { } - void engineParametersChanged(const mixxx::EngineParameters& bufferParameters) { - sampleRate = bufferParameters.sampleRate(); + void engineParametersChanged(const mixxx::EngineParameters& engineParameters) { + sampleRate = engineParameters.sampleRate(); sendPrevious = 0; } @@ -47,7 +47,7 @@ class ReverbEffect : public EffectProcessorImpl { ReverbGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/threebandbiquadeqeffect.cpp b/src/effects/backends/builtin/threebandbiquadeqeffect.cpp index fac62611e42..26bec1c134f 100644 --- a/src/effects/backends/builtin/threebandbiquadeqeffect.cpp +++ b/src/effects/backends/builtin/threebandbiquadeqeffect.cpp @@ -68,9 +68,9 @@ EffectManifestPointer ThreeBandBiquadEQEffect::getManifest() { } ThreeBandBiquadEQEffectGroupState::ThreeBandBiquadEQEffectGroupState( - const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), - m_tempBuf(bufferParameters.samplesPerBuffer()), + const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), + m_tempBuf(engineParameters.samplesPerBuffer()), m_oldLowBoost(0), m_oldMidBoost(0), m_oldHighBoost(0), @@ -79,21 +79,21 @@ ThreeBandBiquadEQEffectGroupState::ThreeBandBiquadEQEffectGroupState( m_oldHighCut(0), m_loFreqCorner(0), m_highFreqCorner(0), - m_oldSampleRate(bufferParameters.sampleRate()) { + m_oldSampleRate(engineParameters.sampleRate()) { // Initialize the filters with default parameters m_lowBoost = std::make_unique( - bufferParameters.sampleRate(), kStartupLoFreq, kQBoost); + engineParameters.sampleRate(), kStartupLoFreq, kQBoost); m_midBoost = std::make_unique( - bufferParameters.sampleRate(), kStartupMidFreq, kQBoost); + engineParameters.sampleRate(), kStartupMidFreq, kQBoost); m_highBoost = std::make_unique( - bufferParameters.sampleRate(), kStartupHiFreq, kQBoost); + engineParameters.sampleRate(), kStartupHiFreq, kQBoost); m_lowCut = std::make_unique( - bufferParameters.sampleRate(), kStartupLoFreq, kQKill); + engineParameters.sampleRate(), kStartupLoFreq, kQKill); m_midCut = std::make_unique( - bufferParameters.sampleRate(), kStartupMidFreq, kQKill); + engineParameters.sampleRate(), kStartupMidFreq, kQKill); m_highCut = std::make_unique( - bufferParameters.sampleRate(), kStartupHiFreq / 2, kQKillShelve); + engineParameters.sampleRate(), kStartupHiFreq / 2, kQKillShelve); } ThreeBandBiquadEQEffectGroupState::~ThreeBandBiquadEQEffectGroupState() { @@ -141,18 +141,18 @@ void ThreeBandBiquadEQEffect::processChannel( ThreeBandBiquadEQEffectGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); - if (pState->m_oldSampleRate != bufferParameters.sampleRate() || + if (pState->m_oldSampleRate != engineParameters.sampleRate() || (pState->m_loFreqCorner != m_pLoFreqCorner->get()) || (pState->m_highFreqCorner != m_pHiFreqCorner->get())) { pState->m_loFreqCorner = m_pLoFreqCorner->get(); pState->m_highFreqCorner = m_pHiFreqCorner->get(); - pState->m_oldSampleRate = bufferParameters.sampleRate(); - pState->setFilters(bufferParameters.sampleRate(), + pState->m_oldSampleRate = engineParameters.sampleRate(); + pState->setFilters(engineParameters.sampleRate(), pState->m_loFreqCorner, pState->m_highFreqCorner); } @@ -239,15 +239,15 @@ void ThreeBandBiquadEQEffect::processChannel( double lowCenter = getCenterFrequency( kMinimumFrequency, pState->m_loFreqCorner); pState->m_lowBoost->setFrequencyCorners( - bufferParameters.sampleRate(), lowCenter, kQBoost, bqGainLow); + engineParameters.sampleRate(), lowCenter, kQBoost, bqGainLow); pState->m_oldLowBoost = bqGainLow; } if (bqGainLow > 0.0) { pState->m_lowBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_lowBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -259,15 +259,15 @@ void ThreeBandBiquadEQEffect::processChannel( double lowCenter = getCenterFrequency( kMinimumFrequency, pState->m_loFreqCorner); pState->m_lowCut->setFrequencyCorners( - bufferParameters.sampleRate(), lowCenter, kQKill, bqGainLow); + engineParameters.sampleRate(), lowCenter, kQKill, bqGainLow); pState->m_oldLowCut = bqGainLow; } if (bqGainLow < 0.0) { pState->m_lowCut->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_lowCut->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -279,15 +279,15 @@ void ThreeBandBiquadEQEffect::processChannel( double midCenter = getCenterFrequency( pState->m_loFreqCorner, pState->m_highFreqCorner); pState->m_midBoost->setFrequencyCorners( - bufferParameters.sampleRate(), midCenter, kQBoost, bqGainMid); + engineParameters.sampleRate(), midCenter, kQBoost, bqGainMid); pState->m_oldMidBoost = bqGainMid; } if (bqGainMid > 0.0) { pState->m_midBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_midBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -299,15 +299,15 @@ void ThreeBandBiquadEQEffect::processChannel( double midCenter = getCenterFrequency( pState->m_loFreqCorner, pState->m_highFreqCorner); pState->m_midCut->setFrequencyCorners( - bufferParameters.sampleRate(), midCenter, kQKill, bqGainMid); + engineParameters.sampleRate(), midCenter, kQKill, bqGainMid); pState->m_oldMidCut = bqGainMid; } if (bqGainMid < 0.0) { pState->m_midCut->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_midCut->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -319,15 +319,15 @@ void ThreeBandBiquadEQEffect::processChannel( double highCenter = getCenterFrequency( pState->m_highFreqCorner, kMaximumFrequency); pState->m_highBoost->setFrequencyCorners( - bufferParameters.sampleRate(), highCenter, kQBoost, bqGainHigh); + engineParameters.sampleRate(), highCenter, kQBoost, bqGainHigh); pState->m_oldHighBoost = bqGainHigh; } if (bqGainHigh > 0.0) { pState->m_highBoost->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_highBoost->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -339,15 +339,15 @@ void ThreeBandBiquadEQEffect::processChannel( double highCenter = getCenterFrequency( pState->m_highFreqCorner, kMaximumFrequency); pState->m_highCut->setFrequencyCorners( - bufferParameters.sampleRate(), highCenter / 2, kQKillShelve, bqGainHigh); + engineParameters.sampleRate(), highCenter / 2, kQKillShelve, bqGainHigh); pState->m_oldHighCut = bqGainHigh; } if (bqGainHigh < 0.0) { pState->m_highCut->process( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } else { pState->m_highCut->processAndPauseFilter( - inBuffer[bufIndex], outBuffer[bufIndex], bufferParameters.samplesPerBuffer()); + inBuffer[bufIndex], outBuffer[bufIndex], engineParameters.samplesPerBuffer()); } ++bufIndex; } else { @@ -355,7 +355,7 @@ void ThreeBandBiquadEQEffect::processChannel( } if (activeFilters == 0) { - SampleUtil::copy(pOutput, pInput, bufferParameters.samplesPerBuffer()); + SampleUtil::copy(pOutput, pInput, engineParameters.samplesPerBuffer()); } if (enableState == EffectEnableState::Disabling) { diff --git a/src/effects/backends/builtin/threebandbiquadeqeffect.h b/src/effects/backends/builtin/threebandbiquadeqeffect.h index 55e3e5e3814..5d69d40593d 100644 --- a/src/effects/backends/builtin/threebandbiquadeqeffect.h +++ b/src/effects/backends/builtin/threebandbiquadeqeffect.h @@ -14,7 +14,7 @@ class ThreeBandBiquadEQEffectGroupState final : public EffectState { public: - ThreeBandBiquadEQEffectGroupState(const mixxx::EngineParameters& bufferParameters); + ThreeBandBiquadEQEffectGroupState(const mixxx::EngineParameters& engineParameters); ~ThreeBandBiquadEQEffectGroupState(); void setFilters( @@ -55,7 +55,7 @@ class ThreeBandBiquadEQEffect : public EffectProcessorImplvalue(); @@ -140,7 +140,7 @@ void TremoloEffect::processChannel( if (enableState == EffectEnableState::Enabling || quantizeEnabling || tripletDisabling) { if (gf.has_beat_length_sec && gf.has_beat_fraction) { currentFrame = static_cast(gf.beat_fraction * - gf.beat_length_sec * bufferParameters.sampleRate()); + gf.beat_length_sec * engineParameters.sampleRate()); } else { currentFrame = 0; } @@ -159,10 +159,10 @@ void TremoloEffect::processChannel( } } const auto framePerBeat = static_cast( - gf.beat_length_sec * bufferParameters.sampleRate()); + gf.beat_length_sec * engineParameters.sampleRate()); framePerPeriod = static_cast(framePerBeat / rate); } else { - framePerPeriod = static_cast(bufferParameters.sampleRate() / rate); + framePerPeriod = static_cast(engineParameters.sampleRate() / rate); } const auto phaseOffsetFrame = static_cast( @@ -170,8 +170,8 @@ void TremoloEffect::processChannel( currentFrame = currentFrame % framePerPeriod; for (SINT i = 0; - i < bufferParameters.samplesPerBuffer(); - i += bufferParameters.channelCount()) { + i < engineParameters.samplesPerBuffer(); + i += engineParameters.channelCount()) { unsigned int positionFrame = (currentFrame - phaseOffsetFrame); positionFrame = positionFrame % framePerPeriod; @@ -203,7 +203,7 @@ void TremoloEffect::processChannel( gain = gainTarget; } - for (int channel = 0; channel < bufferParameters.channelCount(); channel++) { + for (int channel = 0; channel < engineParameters.channelCount(); channel++) { pOutput[i + channel] = static_cast(gain) * pInput[i + channel]; } diff --git a/src/effects/backends/builtin/tremoloeffect.h b/src/effects/backends/builtin/tremoloeffect.h index fa185a4022a..4daa0adb1d8 100644 --- a/src/effects/backends/builtin/tremoloeffect.h +++ b/src/effects/backends/builtin/tremoloeffect.h @@ -9,8 +9,8 @@ class TremoloState : public EffectState { public: - TremoloState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters){}; + TremoloState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters){}; double gain; unsigned int currentFrame; bool quantizeEnabled = false; @@ -31,7 +31,7 @@ class TremoloEffect : public EffectProcessorImpl { TremoloState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/builtin/whitenoiseeffect.cpp b/src/effects/backends/builtin/whitenoiseeffect.cpp index 818f77c1bdf..bd9f33b1619 100644 --- a/src/effects/backends/builtin/whitenoiseeffect.cpp +++ b/src/effects/backends/builtin/whitenoiseeffect.cpp @@ -43,7 +43,7 @@ void WhiteNoiseEffect::processChannel( WhiteNoiseGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -52,11 +52,11 @@ void WhiteNoiseEffect::processChannel( CSAMPLE drywet = static_cast(m_pDryWetParameter->value()); RampingValue drywet_ramping_value( - drywet, gs.previous_drywet, bufferParameters.framesPerBuffer()); + drywet, gs.previous_drywet, engineParameters.framesPerBuffer()); std::uniform_real_distribution<> r_distributor(0.0, 1.0); - for (unsigned int i = 0; i < bufferParameters.samplesPerBuffer(); i++) { + for (unsigned int i = 0; i < engineParameters.samplesPerBuffer(); i++) { CSAMPLE_GAIN drywet_ramped = drywet_ramping_value.getNext(); float noise = static_cast( diff --git a/src/effects/backends/builtin/whitenoiseeffect.h b/src/effects/backends/builtin/whitenoiseeffect.h index 53cb2443128..fdbef8757e4 100644 --- a/src/effects/backends/builtin/whitenoiseeffect.h +++ b/src/effects/backends/builtin/whitenoiseeffect.h @@ -14,8 +14,8 @@ class WhiteNoiseGroupState final : public EffectState { public: - WhiteNoiseGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + WhiteNoiseGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), previous_drywet(0.0), gen(rs()) { } @@ -38,7 +38,7 @@ class WhiteNoiseEffect : public EffectProcessorImpl { WhiteNoiseGroupState* pState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; diff --git a/src/effects/backends/effectprocessor.h b/src/effects/backends/effectprocessor.h index f86323daa23..fbee277f2a1 100644 --- a/src/effects/backends/effectprocessor.h +++ b/src/effects/backends/effectprocessor.h @@ -51,9 +51,9 @@ /// relatively small compared to the additional code complexity.) class EffectState { public: - EffectState(const mixxx::EngineParameters& bufferParameters) { + EffectState(const mixxx::EngineParameters& engineParameters) { // Subclasses should call engineParametersChanged here. - Q_UNUSED(bufferParameters); + Q_UNUSED(engineParameters); }; virtual ~EffectState(){}; }; @@ -70,10 +70,10 @@ class EffectProcessor { virtual void initialize( const QSet& activeInputChannels, const QSet& registeredOutputChannels, - const mixxx::EngineParameters& bufferParameters) = 0; + const mixxx::EngineParameters& engineParameters) = 0; virtual void loadEngineEffectParameters( const QMap& parameters) = 0; - virtual EffectState* createState(const mixxx::EngineParameters& bufferParameters) = 0; + virtual EffectState* createState(const mixxx::EngineParameters& engineParameters) = 0; virtual void deleteStatesForInputChannel(const ChannelHandle* inputChannel) = 0; // Called from the audio thread @@ -95,7 +95,7 @@ class EffectProcessor { const ChannelHandle& outputHandle, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) = 0; }; @@ -145,7 +145,7 @@ class EffectProcessorImpl : public EffectProcessor { virtual void processChannel(EffectSpecificState* channelState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) = 0; @@ -153,7 +153,7 @@ class EffectProcessorImpl : public EffectProcessor { const ChannelHandle& outputHandle, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) final { EffectSpecificState* pState = m_channelStateMatrix[inputHandle][outputHandle]; @@ -166,15 +166,15 @@ class EffectProcessorImpl : public EffectProcessor { << "EffectState should have been preallocated in the" "main thread."; } - pState = createSpecificState(bufferParameters); + pState = createSpecificState(engineParameters); m_channelStateMatrix[inputHandle][outputHandle] = pState; } - processChannel(pState, pInput, pOutput, bufferParameters, enableState, groupFeatures); + processChannel(pState, pInput, pOutput, engineParameters, enableState, groupFeatures); } void initialize(const QSet& activeInputChannels, const QSet& registeredOutputChannels, - const mixxx::EngineParameters& bufferParameters) final { + const mixxx::EngineParameters& engineParameters) final { m_registeredOutputChannels = registeredOutputChannels; for (const ChannelHandleAndGroup& inputChannel : activeInputChannels) { @@ -187,7 +187,7 @@ class EffectProcessorImpl : public EffectProcessor { for (const ChannelHandleAndGroup& outputChannel : std::as_const(m_registeredOutputChannels)) { outputChannelMap.insert(outputChannel.handle(), - createSpecificState(bufferParameters)); + createSpecificState(engineParameters)); if (kEffectDebugOutput) { qDebug() << this << "EffectProcessorImpl::initialize " "registering output" @@ -198,8 +198,8 @@ class EffectProcessorImpl : public EffectProcessor { } }; - EffectState* createState(const mixxx::EngineParameters& bufferParameters) final { - return createSpecificState(bufferParameters); + EffectState* createState(const mixxx::EngineParameters& engineParameters) final { + return createSpecificState(engineParameters); }; bool loadStatesForInputChannel(const ChannelHandle* inputChannel, @@ -287,8 +287,8 @@ class EffectProcessorImpl : public EffectProcessor { /// Subclasses for external effects plugins may reimplement this, but /// subclasses for built-in effects should not. virtual EffectSpecificState* createSpecificState( - const mixxx::EngineParameters& bufferParameters) { - EffectSpecificState* pState = new EffectSpecificState(bufferParameters); + const mixxx::EngineParameters& engineParameters) { + EffectSpecificState* pState = new EffectSpecificState(engineParameters); if (kEffectDebugOutput) { qDebug() << this << "EffectProcessorImpl creating EffectState" << pState; } diff --git a/src/effects/backends/lv2/lv2effectprocessor.cpp b/src/effects/backends/lv2/lv2effectprocessor.cpp index 07768c689bf..82a3ff10c1d 100644 --- a/src/effects/backends/lv2/lv2effectprocessor.cpp +++ b/src/effects/backends/lv2/lv2effectprocessor.cpp @@ -42,7 +42,7 @@ void LV2EffectProcessor::processChannel( LV2EffectGroupState* channelState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(groupFeatures); @@ -51,14 +51,14 @@ void LV2EffectProcessor::processChannel( m_LV2parameters[i] = static_cast(m_engineEffectParameters[i]->value()); } - SINT framesPerBuffer = bufferParameters.framesPerBuffer(); + SINT framesPerBuffer = engineParameters.framesPerBuffer(); // note: LOOP VECTORIZED. for (SINT i = 0; i < framesPerBuffer; ++i) { m_inputL[i] = pInput[i * 2]; m_inputR[i] = pInput[i * 2 + 1]; } - LilvInstance* instance = channelState->lilvInstance(m_pPlugin, bufferParameters); + LilvInstance* instance = channelState->lilvInstance(m_pPlugin, engineParameters); if (enableState == EffectEnableState::Enabling) { lilv_instance_activate(instance); @@ -78,9 +78,9 @@ void LV2EffectProcessor::processChannel( } LV2EffectGroupState* LV2EffectProcessor::createSpecificState( - const mixxx::EngineParameters& bufferParameters) { - LV2EffectGroupState* pState = new LV2EffectGroupState(bufferParameters); - LilvInstance* pInstance = pState->lilvInstance(m_pPlugin, bufferParameters); + const mixxx::EngineParameters& engineParameters) { + LV2EffectGroupState* pState = new LV2EffectGroupState(engineParameters); + LilvInstance* pInstance = pState->lilvInstance(m_pPlugin, engineParameters); VERIFY_OR_DEBUG_ASSERT(pInstance) { return pState; } diff --git a/src/effects/backends/lv2/lv2effectprocessor.h b/src/effects/backends/lv2/lv2effectprocessor.h index 6c8f5cc16d5..e606de787c7 100644 --- a/src/effects/backends/lv2/lv2effectprocessor.h +++ b/src/effects/backends/lv2/lv2effectprocessor.h @@ -11,8 +11,8 @@ // Refer to EffectProcessor for documentation class LV2EffectGroupState final : public EffectState { public: - LV2EffectGroupState(const mixxx::EngineParameters& bufferParameters) - : EffectState(bufferParameters), + LV2EffectGroupState(const mixxx::EngineParameters& engineParameters) + : EffectState(engineParameters), m_pInstance(nullptr) { } ~LV2EffectGroupState() { @@ -23,10 +23,10 @@ class LV2EffectGroupState final : public EffectState { } LilvInstance* lilvInstance(const LilvPlugin* pPlugin, - const mixxx::EngineParameters& bufferParameters) { + const mixxx::EngineParameters& engineParameters) { if (!m_pInstance) { m_pInstance = lilv_plugin_instantiate( - pPlugin, bufferParameters.sampleRate(), nullptr); + pPlugin, engineParameters.sampleRate(), nullptr); } return m_pInstance; } @@ -47,13 +47,13 @@ class LV2EffectProcessor final : public EffectProcessorImpl LV2EffectGroupState* channelState, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures) override; private: LV2EffectGroupState* createSpecificState( - const mixxx::EngineParameters& bufferParameters) override; + const mixxx::EngineParameters& engineParameters) override; LV2EffectManifestPointer m_pManifest; QList m_engineEffectParameters; diff --git a/src/effects/effectslot.cpp b/src/effects/effectslot.cpp index 6fdef7f3372..8d6083d9d55 100644 --- a/src/effects/effectslot.cpp +++ b/src/effects/effectslot.cpp @@ -194,7 +194,7 @@ void EffectSlot::updateEngineState() { void EffectSlot::fillEffectStatesMap(EffectStatesMap* pStatesMap) const { //TODO: get actual configuration of engine - const mixxx::EngineParameters bufferParameters( + const mixxx::EngineParameters engineParameters( mixxx::audio::SampleRate(96000), MAX_BUFFER_LEN / mixxx::kEngineChannelCount); @@ -202,7 +202,7 @@ void EffectSlot::fillEffectStatesMap(EffectStatesMap* pStatesMap) const { for (const auto& outputChannel : m_pEffectsManager->registeredOutputChannels()) { pStatesMap->insert(outputChannel.handle(), - m_pEngineEffect->createState(bufferParameters)); + m_pEngineEffect->createState(engineParameters)); } } else { for (EffectState* pState : *pStatesMap) { diff --git a/src/engine/effects/engineeffect.cpp b/src/engine/effects/engineeffect.cpp index 82b75e4acc8..b5b543c74e8 100644 --- a/src/engine/effects/engineeffect.cpp +++ b/src/engine/effects/engineeffect.cpp @@ -31,10 +31,10 @@ EngineEffect::EngineEffect(EffectManifestPointer pManifest, m_pProcessor->loadEngineEffectParameters(m_parametersById); //TODO: get actual configuration of engine - const mixxx::EngineParameters bufferParameters( + const mixxx::EngineParameters engineParameters( mixxx::audio::SampleRate(96000), MAX_BUFFER_LEN / mixxx::kEngineChannelCount); - m_pProcessor->initialize(activeInputChannels, registeredOutputChannels, bufferParameters); + m_pProcessor->initialize(activeInputChannels, registeredOutputChannels, engineParameters); m_effectRampsFromDry = pManifest->effectRampsFromDry(); } @@ -46,11 +46,11 @@ EngineEffect::~EngineEffect() { m_parameters.clear(); } -EffectState* EngineEffect::createState(const mixxx::EngineParameters& bufferParameters) { +EffectState* EngineEffect::createState(const mixxx::EngineParameters& engineParameters) { VERIFY_OR_DEBUG_ASSERT(m_pProcessor) { - return new EffectState(bufferParameters); + return new EffectState(engineParameters); } - return m_pProcessor->createState(bufferParameters); + return m_pProcessor->createState(engineParameters); } void EngineEffect::loadStatesForInputChannel(const ChannelHandle* inputChannel, @@ -178,7 +178,7 @@ bool EngineEffect::process(const ChannelHandle& inputHandle, if (effectiveEffectEnableState != EffectEnableState::Disabled) { //TODO: refactor rest of audio engine to use mixxx::AudioParameters - const mixxx::EngineParameters bufferParameters( + const mixxx::EngineParameters engineParameters( mixxx::audio::SampleRate(sampleRate), numSamples / mixxx::kEngineChannelCount); @@ -186,7 +186,7 @@ bool EngineEffect::process(const ChannelHandle& inputHandle, outputHandle, pInput, pOutput, - bufferParameters, + engineParameters, effectiveEffectEnableState, groupFeatures); diff --git a/src/engine/effects/engineeffect.h b/src/engine/effects/engineeffect.h index 698c723a164..854d1e6e325 100644 --- a/src/engine/effects/engineeffect.h +++ b/src/engine/effects/engineeffect.h @@ -32,7 +32,7 @@ class EngineEffect final : public EffectsRequestHandler { ~EngineEffect(); /// Called in main thread to allocate an EffectState - EffectState* createState(const mixxx::EngineParameters& bufferParameters); + EffectState* createState(const mixxx::EngineParameters& engineParameters); /// Called in audio thread to load EffectStates received from the main thread void loadStatesForInputChannel(const ChannelHandle* inputChannel, diff --git a/src/test/baseeffecttest.h b/src/test/baseeffecttest.h index af3d5090da9..25b33b0edc7 100644 --- a/src/test/baseeffecttest.h +++ b/src/test/baseeffecttest.h @@ -35,8 +35,8 @@ class MockEffectProcessor : public EffectProcessor { MOCK_METHOD3(initialize, void(const QSet& activeInputChannels, const QSet& registeredOutputChannels, - const mixxx::EngineParameters& bufferParameters)); - MOCK_METHOD1(createState, EffectState*(const mixxx::EngineParameters& bufferParameters)); + const mixxx::EngineParameters& engineParameters)); + MOCK_METHOD1(createState, EffectState*(const mixxx::EngineParameters& engineParameters)); MOCK_METHOD2(loadStatesForInputChannel, bool(const ChannelHandle* inputChannel, const EffectStatesMap* pStatesMap)); @@ -46,7 +46,7 @@ class MockEffectProcessor : public EffectProcessor { const ChannelHandle& outputHandle, const CSAMPLE* pInput, CSAMPLE* pOutput, - const mixxx::EngineParameters& bufferParameters, + const mixxx::EngineParameters& engineParameters, const EffectEnableState enableState, const GroupFeatureState& groupFeatures)); }; diff --git a/src/test/nativeeffects_test.cpp b/src/test/nativeeffects_test.cpp index 0e35f589268..442a326ae94 100644 --- a/src/test/nativeeffects_test.cpp +++ b/src/test/nativeeffects_test.cpp @@ -31,7 +31,7 @@ class EffectsBenchmarkTest : public BaseEffectTest { }; template -void benchmarkBuiltInEffectDefaultParameters(const mixxx::EngineParameters& bufferParameters, +void benchmarkBuiltInEffectDefaultParameters(const mixxx::EngineParameters& engineParameters, benchmark::State* pState, EffectsManager* pEffectsManager) { EffectManifestPointer pManifest = EffectType::getManifest(); @@ -51,13 +51,13 @@ void benchmarkBuiltInEffectDefaultParameters(const mixxx::EngineParameters& buff GroupFeatureState featureState; EffectEnableState enableState = EffectEnableState::Enabled; - mixxx::SampleBuffer input(bufferParameters.samplesPerBuffer()); - mixxx::SampleBuffer output(bufferParameters.samplesPerBuffer()); + mixxx::SampleBuffer input(engineParameters.samplesPerBuffer()); + mixxx::SampleBuffer output(engineParameters.samplesPerBuffer()); while (pState->KeepRunning()) { effect.process(channel1, channel1, input.data(), output.data(), - bufferParameters.samplesPerBuffer(), - bufferParameters.sampleRate(), + engineParameters.samplesPerBuffer(), + engineParameters.sampleRate(), enableState, featureState); } } @@ -72,11 +72,11 @@ void benchmarkBuiltInEffectDefaultParameters(const mixxx::EngineParameters& buff ControlPotmeter hiEqFrequency( \ ConfigKey("[Mixer Profile]", "HiEQFrequency"), 0., 22040); \ hiEqFrequency.setDefaultValue(2500.0); \ - mixxx::EngineParameters bufferParameters( \ + mixxx::EngineParameters engineParameters( \ mixxx::audio::SampleRate(44100), \ state.range_x()); \ benchmarkBuiltInEffectDefaultParameters( \ - bufferParameters, &state, m_pEffectsManager); \ + engineParameters, &state, m_pEffectsManager); \ } \ FOR_COMMON_BUFFER_SIZES(BENCHMARK(BM_BuiltInEffects_DefaultParameters_##EffectName));