Skip to content

Commit

Permalink
Merge pull request #4459 from daschuer/effects_refactoring_enginePara…
Browse files Browse the repository at this point in the history
…meters

Rename variables of type EnigineParameter to engineParameters
  • Loading branch information
Holzhaus authored Oct 19, 2021
2 parents 0925269 + d8535a2 commit e817b69
Show file tree
Hide file tree
Showing 49 changed files with 363 additions and 363 deletions.
10 changes: 5 additions & 5 deletions src/effects/backends/builtin/autopaneffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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<CSAMPLE>(pGroupState->time) /
static_cast<CSAMPLE>(period);

Expand Down Expand Up @@ -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<CSAMPLE>(pGroupState->frac * lawCoef);
Expand Down
6 changes: 3 additions & 3 deletions src/effects/backends/builtin/autopaneffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<panMaxDelay>();
m_dPreviousPeriod = -1.0;
Expand Down Expand Up @@ -91,7 +91,7 @@ class AutoPanEffect : public EffectProcessorImpl<AutoPanGroupState> {
AutoPanGroupState* pState,
const CSAMPLE* pInput,
CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const mixxx::EngineParameters& engineParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatures) override;

Expand Down
34 changes: 17 additions & 17 deletions src/effects/backends/builtin/balanceeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<EngineFilterLinkwitzRiley4Low>(bufferParameters.sampleRate(),
m_low = std::make_unique<EngineFilterLinkwitzRiley4Low>(engineParameters.sampleRate(),
kMinCornerHz);
m_high = std::make_unique<EngineFilterLinkwitzRiley4High>(bufferParameters.sampleRate(),
m_high = std::make_unique<EngineFilterLinkwitzRiley4High>(engineParameters.sampleRate(),
kMinCornerHz);
m_high->setStartFromDry(true);
}
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/effects/backends/builtin/balanceeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -41,7 +41,7 @@ class BalanceEffect : public EffectProcessorImpl<BalanceGroupState> {
BalanceGroupState* pState,
const CSAMPLE* pInput,
CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const mixxx::EngineParameters& engineParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatures) override;

Expand Down
8 changes: 4 additions & 4 deletions src/effects/backends/builtin/bessel4lvmixeqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -81,8 +81,8 @@ void Bessel4LVMixEQEffect::processChannel(
}
pState->processChannel(pInput,
pOutput,
bufferParameters.samplesPerBuffer(),
bufferParameters.sampleRate(),
engineParameters.samplesPerBuffer(),
engineParameters.sampleRate(),
fLow,
fMid,
fHigh,
Expand Down
6 changes: 3 additions & 3 deletions src/effects/backends/builtin/bessel4lvmixeqeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

class Bessel4LVMixEQEffectGroupState : public LVMixEQEffectGroupState<EngineFilterBessel4Low> {
public:
Bessel4LVMixEQEffectGroupState(const mixxx::EngineParameters& bufferParameters)
: LVMixEQEffectGroupState<EngineFilterBessel4Low>(bufferParameters) {
Bessel4LVMixEQEffectGroupState(const mixxx::EngineParameters& engineParameters)
: LVMixEQEffectGroupState<EngineFilterBessel4Low>(engineParameters) {
}
};

Expand All @@ -34,7 +34,7 @@ class Bessel4LVMixEQEffect : public EffectProcessorImpl<Bessel4LVMixEQEffectGrou
Bessel4LVMixEQEffectGroupState* pState,
const CSAMPLE* pInput,
CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const mixxx::EngineParameters& engineParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatureState) override;

Expand Down
8 changes: 4 additions & 4 deletions src/effects/backends/builtin/bessel8lvmixeqeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ void Bessel8LVMixEQEffect::processChannel(
Bessel8LVMixEQEffectGroupState* 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;
Expand All @@ -81,8 +81,8 @@ void Bessel8LVMixEQEffect::processChannel(
}
pState->processChannel(pInput,
pOutput,
bufferParameters.samplesPerBuffer(),
bufferParameters.sampleRate(),
engineParameters.samplesPerBuffer(),
engineParameters.sampleRate(),
fLow,
fMid,
fHigh,
Expand Down
6 changes: 3 additions & 3 deletions src/effects/backends/builtin/bessel8lvmixeqeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

class Bessel8LVMixEQEffectGroupState : public LVMixEQEffectGroupState<EngineFilterBessel8Low> {
public:
Bessel8LVMixEQEffectGroupState(const mixxx::EngineParameters& bufferParameters)
: LVMixEQEffectGroupState<EngineFilterBessel8Low>(bufferParameters) {
Bessel8LVMixEQEffectGroupState(const mixxx::EngineParameters& engineParameters)
: LVMixEQEffectGroupState<EngineFilterBessel8Low>(engineParameters) {
}
};

Expand All @@ -36,7 +36,7 @@ class Bessel8LVMixEQEffect : public EffectProcessorImpl<Bessel8LVMixEQEffectGrou
Bessel8LVMixEQEffectGroupState* pState,
const CSAMPLE* pInput,
CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const mixxx::EngineParameters& engineParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatureState) override;

Expand Down
Loading

0 comments on commit e817b69

Please sign in to comment.