From b349ae0b947e9cf3ee9269c73cf9b7256da1b49f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:49:07 +0200 Subject: analyzer/plugins/analyzerqueenmarybeats: Add missing int cast --- src/analyzer/plugins/analyzerqueenmarybeats.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyzer/plugins/analyzerqueenmarybeats.cpp b/src/analyzer/plugins/analyzerqueenmarybeats.cpp index 4e35b88e10..73fc0d8aab 100644 --- a/src/analyzer/plugins/analyzerqueenmarybeats.cpp +++ b/src/analyzer/plugins/analyzerqueenmarybeats.cpp @@ -50,7 +50,7 @@ AnalyzerQueenMaryBeats::~AnalyzerQueenMaryBeats() { bool AnalyzerQueenMaryBeats::initialize(int samplerate) { m_detectionResults.clear(); m_iSampleRate = samplerate; - m_stepSize = m_iSampleRate * kStepSecs; + m_stepSize = static_cast(m_iSampleRate * kStepSecs); m_windowSize = MathUtilities::nextPowerOfTwo(m_iSampleRate / kMaximumBinSizeHz); m_pDetectionFunction = std::make_unique( makeDetectionFunctionConfig(m_stepSize, m_windowSize)); -- cgit v1.2.3 From b857829b97465a2612633a3066af5a469afb0e9d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:49:31 +0200 Subject: control/controllinpotmeter: Make lossy typecast explicit --- src/control/controllinpotmeter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/control/controllinpotmeter.cpp b/src/control/controllinpotmeter.cpp index 5ca5962f46..e3f16d44b4 100644 --- a/src/control/controllinpotmeter.cpp +++ b/src/control/controllinpotmeter.cpp @@ -10,9 +10,9 @@ ControlLinPotmeter::ControlLinPotmeter(ConfigKey key, new ControlLinPotmeterBehavior(dMinValue, dMaxValue, allowOutOfBounds)); } if (dStep) { - setStepCount((dMaxValue - dMinValue) / dStep); + setStepCount(static_cast((dMaxValue - dMinValue) / dStep)); } if (dSmallStep) { - setSmallStepCount((dMaxValue - dMinValue) / dSmallStep); + setSmallStepCount(static_cast((dMaxValue - dMinValue) / dSmallStep)); } } -- cgit v1.2.3 From b2442fc994a3ea69d9cd2e739f135f8be86e9db7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:51:50 +0200 Subject: effects/builtin/balanceeffect: Add explicit casts to CSAMPLE_GAIN --- src/effects/builtin/balanceeffect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/effects/builtin/balanceeffect.cpp b/src/effects/builtin/balanceeffect.cpp index 41c23fe6bc..e120c101e7 100644 --- a/src/effects/builtin/balanceeffect.cpp +++ b/src/effects/builtin/balanceeffect.cpp @@ -116,8 +116,8 @@ void BalanceEffect::processChannel(const ChannelHandle& handle, CSAMPLE_GAIN balance = 0; CSAMPLE_GAIN midSide = 0; if (enableState != EffectEnableState::Disabling) { - balance = m_pBalanceParameter->value(); - midSide = m_pMidSideParameter->value(); + balance = static_cast(m_pBalanceParameter->value()); + midSide = static_cast(m_pMidSideParameter->value()); } CSAMPLE_GAIN balanceDelta = (balance - pGroupState->m_oldBalance) -- cgit v1.2.3 From 59854ebaa28006ac3aac9b0388959b191d2ac244 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:52:28 +0200 Subject: effects/builtin/bitcrushereffect: Add explicit casts to CSAMPLE --- src/effects/builtin/bitcrushereffect.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/effects/builtin/bitcrushereffect.cpp b/src/effects/builtin/bitcrushereffect.cpp index 04dc81884f..62bcefc042 100644 --- a/src/effects/builtin/bitcrushereffect.cpp +++ b/src/effects/builtin/bitcrushereffect.cpp @@ -76,11 +76,11 @@ void BitCrusherEffect::processChannel(const ChannelHandle& handle, Q_UNUSED(groupFeatures); Q_UNUSED(enableState); // no need to ramp, it is just a bitcrusher ;-) - const CSAMPLE downsample = m_pDownsampleParameter ? - m_pDownsampleParameter->value() : 0.0; + const auto downsample = static_cast( + m_pDownsampleParameter ? m_pDownsampleParameter->value() : 0.0); - CSAMPLE bit_depth = m_pBitDepthParameter ? - m_pBitDepthParameter->value() : 16; + auto bit_depth = static_cast( + m_pBitDepthParameter ? m_pBitDepthParameter->value() : 16); // divided by two because we use float math which includes the sing bit anyway const CSAMPLE scale = pow(2.0f, bit_depth) / 2; @@ -94,7 +94,7 @@ void BitCrusherEffect::processChannel(const ChannelHandle& handle, pState->accumulator += downsample; if (pState->accumulator >= 1.0) { - pState->accumulator -= 1.0; + pState->accumulator -= 1.0f; if (bit_depth < 16) { pState->hold_l = floorf(SampleUtil::clampSample(pInput[i] * gainCorrection) * scale + 0.5f) / scale / gainCorrection; -- cgit v1.2.3 From 754bd84102723c379a43aeac57b953af14e66727 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:53:38 +0200 Subject: effects/builtin/echoeffect: Make lossy type casts explicit --- src/effects/builtin/echoeffect.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/effects/builtin/echoeffect.cpp b/src/effects/builtin/echoeffect.cpp index daf820b57e..9487711a1d 100644 --- a/src/effects/builtin/echoeffect.cpp +++ b/src/effects/builtin/echoeffect.cpp @@ -145,9 +145,9 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr EchoGroupState& gs = *pGroupState; // The minimum of the parameter is zero so the exact center of the knob is 1 beat. double period = m_pDelayParameter->value(); - double send_current = m_pSendParameter->value(); - double feedback_current = m_pFeedbackParameter->value(); - CSAMPLE_GAIN pingpong_frac = static_cast(m_pPingPongParameter->value()); + const auto send_current = static_cast(m_pSendParameter->value()); + const auto feedback_current = static_cast(m_pFeedbackParameter->value()); + const auto pingpong_frac = static_cast(m_pPingPongParameter->value()); int delay_frames; if (groupFeatures.has_beat_length_sec) { @@ -160,11 +160,12 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr } else if (period < 1/8.0) { period = 1/8.0; } - delay_frames = period * groupFeatures.beat_length_sec * bufferParameters.sampleRate(); + delay_frames = static_cast(period * groupFeatures.beat_length_sec * + bufferParameters.sampleRate()); } else { // period is a number of seconds period = std::max(period, 1/8.0); - delay_frames = period * bufferParameters.sampleRate(); + delay_frames = static_cast(period * bufferParameters.sampleRate()); } VERIFY_OR_DEBUG_ASSERT(delay_frames > 0) { delay_frames = 1; @@ -197,8 +198,8 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr CSAMPLE bufferedSampleLeft = gs.delay_buf[read_position]; CSAMPLE bufferedSampleRight = gs.delay_buf[read_position + 1]; if (read_position != prev_read_position) { - double frac = static_cast(i) - / bufferParameters.samplesPerBuffer(); + const auto frac = static_cast(static_cast(i) / + bufferParameters.samplesPerBuffer()); bufferedSampleLeft *= frac; bufferedSampleRight *= frac; bufferedSampleLeft += gs.delay_buf[prev_read_position] * (1 - frac); -- cgit v1.2.3 From 18058460a6e8135f6ba60eb162ab09195ca39029 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:54:46 +0200 Subject: effects/builtin/flangereffect: Make lossy type casts explicit --- src/effects/builtin/flangereffect.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/effects/builtin/flangereffect.cpp b/src/effects/builtin/flangereffect.cpp index a4e39d709d..1211098b46 100644 --- a/src/effects/builtin/flangereffect.cpp +++ b/src/effects/builtin/flangereffect.cpp @@ -7,7 +7,7 @@ namespace{ // Gain correction was verified with replay gain and default parameters -const double kGainCorrection = 1.4125375446227544; // 3 dB +constexpr CSAMPLE kGainCorrection = 1.4125375446227544f; // 3 dB inline CSAMPLE tanh_approx(CSAMPLE input) { // return tanhf(input); // 142ns for process; @@ -156,7 +156,8 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, // When the period is changed, the position of the sound shouldn't // so time need to be recalculated if (pState->previousPeriodFrames != -1.0) { - pState->lfoFrames *= lfoPeriodFrames / pState->previousPeriodFrames; + pState->lfoFrames *= static_cast( + lfoPeriodFrames / pState->previousPeriodFrames); } pState->previousPeriodFrames = lfoPeriodFrames; @@ -165,12 +166,12 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, // independently in the loop below, so do not multiply lfoPeriodSamples by // the number of channels. - CSAMPLE_GAIN mix = m_pMixParameter->value(); + const auto mix = static_cast(m_pMixParameter->value()); RampingValue mixRamped( pState->prev_mix, mix, bufferParameters.framesPerBuffer()); pState->prev_mix = mix; - CSAMPLE_GAIN regen = m_pRegenParameter->value(); + const auto regen = static_cast(m_pRegenParameter->value()); RampingValue regenRamped( pState->prev_regen, regen, bufferParameters.framesPerBuffer()); pState->prev_regen = regen; @@ -185,11 +186,11 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, RampingValue widthRamped( pState->prev_width, width, bufferParameters.framesPerBuffer()); - pState->prev_width = width; + pState->prev_width = static_cast(width); RampingValue manualRamped( pState->prev_manual, manual, bufferParameters.framesPerBuffer()); - pState->prev_manual = manual; + pState->prev_manual = static_cast(manual); CSAMPLE* delayLeft = pState->delayLeft; CSAMPLE* delayRight = pState->delayRight; @@ -208,7 +209,8 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, pState->lfoFrames = 0; } - float periodFraction = static_cast(pState->lfoFrames) / lfoPeriodFrames; + auto periodFraction = static_cast( + static_cast(pState->lfoFrames) / lfoPeriodFrames); double delayMs = manual_ramped + width_ramped / 2 * sin(M_PI * 2.0f * periodFraction); double delayFrames = delayMs * bufferParameters.sampleRate() / 1000; @@ -222,7 +224,7 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, CSAMPLE prevRight = delayRight[framePrev]; CSAMPLE nextRight = delayRight[frameNext]; - CSAMPLE frac = delayFrames - floorf(delayFrames); + auto frac = static_cast(delayFrames - floorf(static_cast(delayFrames))); CSAMPLE delayedSampleLeft = prevLeft + frac * (nextLeft - prevLeft); CSAMPLE delayedSampleRight = prevRight + frac * (nextRight - prevRight); @@ -231,7 +233,7 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, pState->delayPos = (pState->delayPos + 1) % kBufferLenth; - double gain = (1 - mix_ramped + kGainCorrection * mix_ramped); + CSAMPLE_GAIN gain = (1 - mix_ramped + kGainCorrection * mix_ramped); pOutput[i] = (pInput[i] + mix_ramped * delayedSampleLeft) / gain; pOutput[i + 1] = (pInput[i + 1] + mix_ramped * delayedSampleRight) / gain; } -- cgit v1.2.3 From 613268f4e1ffc9230f3308f832929e73de812409 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:55:10 +0200 Subject: effects/builtin/graphiceqeffect: Make lossy type casts explicit --- src/effects/builtin/graphiceqeffect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/effects/builtin/graphiceqeffect.cpp b/src/effects/builtin/graphiceqeffect.cpp index 0e75760334..9429f5bbd1 100644 --- a/src/effects/builtin/graphiceqeffect.cpp +++ b/src/effects/builtin/graphiceqeffect.cpp @@ -173,10 +173,10 @@ void GraphicEQEffect::processChannel(const ChannelHandle& handle, fMid[i] = 1.0; } } else { - fLow = m_pPotLow->value(); - fHigh = m_pPotHigh->value(); + fLow = static_cast(m_pPotLow->value()); + fHigh = static_cast(m_pPotHigh->value()); for (int i = 0; i < 6; i++) { - fMid[i] = m_pPotMid[i]->value(); + fMid[i] = static_cast(m_pPotMid[i]->value()); } } -- cgit v1.2.3 From aebd574804f8cc327a84f7baabb01a048070fdd8 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:55:46 +0200 Subject: effects/builtin/linkwitzriley8eqeffect: Make lossy type casts explicit --- src/effects/builtin/linkwitzriley8eqeffect.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/effects/builtin/linkwitzriley8eqeffect.cpp b/src/effects/builtin/linkwitzriley8eqeffect.cpp index 297f314725..b7e726cc9b 100644 --- a/src/effects/builtin/linkwitzriley8eqeffect.cpp +++ b/src/effects/builtin/linkwitzriley8eqeffect.cpp @@ -93,13 +93,13 @@ void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle, float fLow = 0.f, fMid = 0.f, fHigh = 0.f; if (!m_pKillLow->toBool()) { - fLow = m_pPotLow->value(); + fLow = static_cast(m_pPotLow->value()); } if (!m_pKillMid->toBool()) { - fMid = m_pPotMid->value(); + fMid = static_cast(m_pPotMid->value()); } if (!m_pKillHigh->toBool()) { - fHigh = m_pPotHigh->value(); + fHigh = static_cast(m_pPotHigh->value()); } if (pState->m_oldSampleRate != bufferParameters.sampleRate() || @@ -116,11 +116,14 @@ void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle, if (fMid != pState->old_mid || fHigh != pState->old_high) { SampleUtil::applyRampingGain(pState->m_pHighBuf, - pState->old_high, fHigh, - bufferParameters.samplesPerBuffer()); + static_cast(pState->old_high), + fHigh, + bufferParameters.samplesPerBuffer()); SampleUtil::addWithRampingGain(pState->m_pHighBuf, - pState->m_pLowBuf, pState->old_mid, fMid, - bufferParameters.samplesPerBuffer()); + pState->m_pLowBuf, + static_cast(pState->old_mid), + fMid, + bufferParameters.samplesPerBuffer()); } else { SampleUtil::applyGain(pState->m_pHighBuf, fHigh, bufferParameters.samplesPerBuffer()); SampleUtil::addWithGain(pState->m_pHighBuf, @@ -133,8 +136,12 @@ void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle, if (fLow != pState->old_low) { SampleUtil::copy2WithRampingGain(pOutput, - pState->m_pLowBuf, pState->old_low, fLow, - pState->m_pMidBuf, 1, 1, + pState->m_pLowBuf, + static_cast(pState->old_low), + fLow, + pState->m_pMidBuf, + 1, + 1, bufferParameters.samplesPerBuffer()); } else { SampleUtil::copy2WithGain(pOutput, -- cgit v1.2.3 From aa57ad1bcfc42b7890a31c434762103ffc0b4198 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:56:28 +0200 Subject: effects/builtin/loudnesscontoureffect: Use CSAMPLE_GAIN for gain --- src/effects/builtin/loudnesscontoureffect.cpp | 7 +++---- src/effects/builtin/loudnesscontoureffect.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/effects/builtin/loudnesscontoureffect.cpp b/src/effects/builtin/loudnesscontoureffect.cpp index fd1781f73b..5f9bea97e8 100644 --- a/src/effects/builtin/loudnesscontoureffect.cpp +++ b/src/effects/builtin/loudnesscontoureffect.cpp @@ -68,11 +68,10 @@ LoudnessContourEffectGroupState::LoudnessContourEffectGroupState( : EffectState(bufferParameters), m_oldGainKnob(1.0), m_oldLoudness(0.0), - m_oldGain(1.0), + m_oldGain(1.0f), m_oldFilterGainDb(0), m_oldUseGain(false), m_oldSampleRate(bufferParameters.sampleRate()) { - m_pBuf = SampleUtil::alloc(bufferParameters.samplesPerBuffer()); // Initialize the filters with default parameters @@ -115,7 +114,7 @@ void LoudnessContourEffect::processChannel( Q_UNUSED(groupFeatures); double filterGainDb = pState->m_oldFilterGainDb; - double gain = pState->m_oldGain; + auto gain = static_cast(pState->m_oldGain); if (enableState != EffectEnableState::Disabling) { @@ -144,7 +143,7 @@ void LoudnessContourEffect::processChannel( else { filterGainDb = -loudness; // compensate filter boost to avoid clipping - gain = db2ratio(-filterGainDb); + gain = static_cast(db2ratio(-filterGainDb)); } pState->setFilters(bufferParameters.sampleRate(), filterGainDb); } diff --git a/src/effects/builtin/loudnesscontoureffect.h b/src/effects/builtin/loudnesscontoureffect.h index 158b5af79a..8877dcb58d 100644 --- a/src/effects/builtin/loudnesscontoureffect.h +++ b/src/effects/builtin/loudnesscontoureffect.h @@ -25,7 +25,7 @@ class LoudnessContourEffectGroupState final : public EffectState { CSAMPLE* m_pBuf; double m_oldGainKnob; double m_oldLoudness; - double m_oldGain; + CSAMPLE_GAIN m_oldGain; double m_oldFilterGainDb; bool m_oldUseGain; unsigned int m_oldSampleRate; -- cgit v1.2.3 From 2342680b11fcbab178e638646a6476d524fb5571 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:57:30 +0200 Subject: effects/builtin/lvmixeqbase: Use CSAMPLE values --- src/effects/builtin/lvmixeqbase.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/effects/builtin/lvmixeqbase.h b/src/effects/builtin/lvmixeqbase.h index 1674500011..a57b5a58ed 100644 --- a/src/effects/builtin/lvmixeqbase.h +++ b/src/effects/builtin/lvmixeqbase.h @@ -58,11 +58,15 @@ class LVMixEQEffectGroupState : public EffectState { m_groupDelay = delayLow1 * 2; } - void processChannel(const CSAMPLE* pInput, CSAMPLE* pOutput, - const int numSamples, - const unsigned int sampleRate, - double fLow, double fMid, double fHigh, - double loFreq, double hiFreq) { + void processChannel(const CSAMPLE* pInput, + CSAMPLE* pOutput, + const int numSamples, + const unsigned int sampleRate, + double dLow, + double dMid, + double dHigh, + double loFreq, + double hiFreq) { if (m_oldSampleRate != sampleRate || (m_loFreq != loFreq) || (m_hiFreq != hiFreq)) { @@ -76,8 +80,9 @@ class LVMixEQEffectGroupState : public EffectState { // we can subtract or add the filtered signal to the dry signal if we compensate this delay // The dry signal represents the high gain // Then the higher low pass is added and at least the lower low pass result. - fLow = fLow - fMid; - fMid = fMid - fHigh; + auto fLow = static_cast(dLow - dMid); + auto fMid = static_cast(dMid - dHigh); + auto fHigh = static_cast(dHigh); // Note: We do not call pauseFilter() here because this will introduce a // buffer size-dependent start delay. During such start delay some unwanted @@ -241,9 +246,9 @@ class LVMixEQEffectGroupState : public EffectState { EngineFilterDelay* m_delay2; EngineFilterDelay* m_delay3; - double m_oldLow; - double m_oldMid; - double m_oldHigh; + CSAMPLE_GAIN m_oldLow; + CSAMPLE_GAIN m_oldMid; + CSAMPLE_GAIN m_oldHigh; int m_rampHoldOff; int m_groupDelay; -- cgit v1.2.3 From 72ef79ac79683e132ddea11ab1f70cad9bdc26e3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:58:03 +0200 Subject: effects/builtin/moogladder4filtereffect: Make lossy typecasts explicit --- src/effects/builtin/moogladder4filtereffect.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/effects/builtin/moogladder4filtereffect.cpp b/src/effects/builtin/moogladder4filtereffect.cpp index d0d622d9de..a6d5f419f5 100644 --- a/src/effects/builtin/moogladder4filtereffect.cpp +++ b/src/effects/builtin/moogladder4filtereffect.cpp @@ -120,17 +120,17 @@ void MoogLadder4FilterEffect::processChannel( if (pState->m_loFreq != lpf || pState->m_resonance != resonance || pState->m_samplerate != bufferParameters.sampleRate()) { - pState->m_pLowFilter->setParameter( - bufferParameters.sampleRate(), lpf * bufferParameters.sampleRate(), - resonance); + pState->m_pLowFilter->setParameter(bufferParameters.sampleRate(), + static_cast(lpf * bufferParameters.sampleRate()), + static_cast(resonance)); } if (pState->m_hiFreq != hpf || pState->m_resonance != resonance || pState->m_samplerate != bufferParameters.sampleRate()) { - pState->m_pHighFilter->setParameter( - bufferParameters.sampleRate(), hpf * bufferParameters.sampleRate(), - resonance); + pState->m_pHighFilter->setParameter(bufferParameters.sampleRate(), + static_cast(hpf * bufferParameters.sampleRate()), + static_cast(resonance)); } const CSAMPLE* pLpfInput = pState->m_pBuf; -- cgit v1.2.3 From 44229bcecaf252c3150003da088cd5c8dd463b8d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:58:28 +0200 Subject: effects/builtin/parametriceqeffect: Make casts to CSAMPLE_GAIN explicit --- src/effects/builtin/parametriceqeffect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/effects/builtin/parametriceqeffect.cpp b/src/effects/builtin/parametriceqeffect.cpp index c58c6de042..2a6f8c4250 100644 --- a/src/effects/builtin/parametriceqeffect.cpp +++ b/src/effects/builtin/parametriceqeffect.cpp @@ -180,10 +180,10 @@ void ParametricEQEffect::processChannel(const ChannelHandle& handle, // Ramp to dry, when disabling, this will ramp from dry when enabling as well fGain[i] = 1.0; } else { - fGain[i] = m_pPotGain[i]->value(); + fGain[i] = static_cast(m_pPotGain[i]->value()); } - fQ[i] = m_pPotQ[i]->value(); - fCenter[i] = m_pPotCenter[i]->value(); + fQ[i] = static_cast(m_pPotQ[i]->value()); + fCenter[i] = static_cast(m_pPotCenter[i]->value()); if (fGain[i] != pState->m_oldGain[i] || fQ[i] != pState->m_oldQ[i] || fCenter[i] != pState->m_oldCenter[i]) { -- cgit v1.2.3 From 20591544c11737820693a6e1bd90b938b87b3ab6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:58:58 +0200 Subject: engine/controls/ratecontrol: Add missing cast to int --- src/engine/controls/ratecontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/controls/ratecontrol.cpp b/src/engine/controls/ratecontrol.cpp index e2b25a20f7..f79cc0060d 100644 --- a/src/engine/controls/ratecontrol.cpp +++ b/src/engine/controls/ratecontrol.cpp @@ -475,7 +475,7 @@ double RateControl::calculateSpeed(double baserate, double speed, bool paused, } // If we are reversing (and not scratching,) flip the rate. This is ok even when syncing. // Reverse with vinyl is only ok if absolute mode isn't on. - int vcmode = m_pVCMode ? m_pVCMode->get() : MIXXX_VCMODE_ABSOLUTE; + int vcmode = m_pVCMode ? static_cast(m_pVCMode->get()) : MIXXX_VCMODE_ABSOLUTE; // TODO(owen): Instead of just ignoring reverse mode, should we // disable absolute mode instead? if (m_pReverseButton->get() -- cgit v1.2.3 From 50db2f5a7fef9fc71a1555bbec4737261e39c679 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:59:20 +0200 Subject: engine/enginesidechaincompressor: Add missing float literal suffixes --- src/engine/enginesidechaincompressor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/enginesidechaincompressor.cpp b/src/engine/enginesidechaincompressor.cpp index bfc6b49739..7ff4cb1b04 100644 --- a/src/engine/enginesidechaincompressor.cpp +++ b/src/engine/enginesidechaincompressor.cpp @@ -29,10 +29,10 @@ void EngineSideChainCompressor::calculateRates() { m_decayPerFrame = m_strength / m_decayTime; } if (m_attackPerFrame <= 0) { - m_attackPerFrame = 0.005; + m_attackPerFrame = 0.005f; } if (m_decayPerFrame <= 0) { - m_decayPerFrame = 0.005; + m_decayPerFrame = 0.005f; } //qDebug() << "Compressor attack per frame: " << m_attackPerFrame // << "decay per frame: " << m_decayPerFrame; -- cgit v1.2.3 From eaa05e71cb55be0f6183fb446b83dbe14d285046 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 15:59:42 +0200 Subject: engine/filters/enginefilterdelay: Remove useless type conversion --- src/engine/filters/enginefilterdelay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/filters/enginefilterdelay.h b/src/engine/filters/enginefilterdelay.h index d267b83089..e57d1ada34 100644 --- a/src/engine/filters/enginefilterdelay.h +++ b/src/engine/filters/enginefilterdelay.h @@ -108,7 +108,7 @@ class EngineFilterDelay : public EngineObjectConstIn { // it is an alternative for using pauseFillter() calls void processAndPauseFilter(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { - double oldDelay = m_delaySamples; + int oldDelay = m_delaySamples; m_delaySamples = 0; process(pIn, pOutput, iBufferSize); m_delaySamples = oldDelay; -- cgit v1.2.3 From 1ae38e95f02820818228c11b1858edb9da17bebe Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:00:20 +0200 Subject: engine/filters/enginefiltermoogladder4: Add literal suffixes and casts --- src/engine/filters/enginefiltermoogladder4.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/engine/filters/enginefiltermoogladder4.h b/src/engine/filters/enginefiltermoogladder4.h index e7f87d3880..8d4f1c44cb 100644 --- a/src/engine/filters/enginefiltermoogladder4.h +++ b/src/engine/filters/enginefiltermoogladder4.h @@ -84,14 +84,15 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { } // frequency & amplitude correction - float kfcr = 1.8730 * (kfc*kfc*kfc) + 0.4955 * (kfc*kfc) - 0.6490 * kfc + 0.9988; + const float kfcr = 1.8730f * (kfc * kfc * kfc) + 0.4955f * (kfc * kfc) - + 0.6490f * kfc + 0.9988f; - float x = -2.0 * kPi * kfcr * kf; // input for taylor approximations + float x = -2.0f * kPi * kfcr * kf; // input for taylor approximations float exp_out = expf(x); m_k2vgNew = v2 * (1 - exp_out); // filter tuning // Resonance correction for self oscillation ~4 - m_kacrNew = resonance * (-3.9364 * (kfc*kfc) + 1.8409 * kfc + 0.9968); + m_kacrNew = resonance * (-3.9364f * (kfc * kfc) + 1.8409f * kfc + 0.9968f); if (MODE == MoogMode::HighPassOversampling || MODE == MoogMode::HighPass) { m_postGainNew = 1; @@ -135,12 +136,10 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { for (int i = 0; i < iBufferSize; i += 2) { cross_mix += cross_inc; - m_postGain = m_postGainNew * cross_mix - + startPostGain * (1.0 - cross_mix); - m_kacr = m_kacrNew * cross_mix - + startKacr * (1.0 - cross_mix); - m_k2vg = m_k2vgNew * cross_mix - + startK2vg * (1.0 - cross_mix); + m_postGain = static_cast(m_postGainNew * cross_mix + + startPostGain * (1.0 - cross_mix)); + m_kacr = static_cast(m_kacrNew * cross_mix + startKacr * (1.0 - cross_mix)); + m_k2vg = static_cast(m_k2vgNew * cross_mix + startK2vg * (1.0 - cross_mix)); pOutput[i] = processSample(pIn[i], &m_buf[0]); pOutput[i+1] = processSample(pIn[i+1], &m_buf[1]); } -- cgit v1.2.3 From c974080ef70cdd8f7d3b07846df03c96b782efa2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:00:45 +0200 Subject: engine/filters/enginefilterpansingle: Make lossy typecasts explicit --- src/engine/filters/enginefilterpansingle.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/filters/enginefilterpansingle.h b/src/engine/filters/enginefilterpansingle.h index 3a91f1cf78..383377cdf0 100644 --- a/src/engine/filters/enginefilterpansingle.h +++ b/src/engine/filters/enginefilterpansingle.h @@ -53,8 +53,10 @@ class EngineFilterPanSingle { m_delayFrame = (m_delayFrame + 1) % SIZE; // prepare coefficients for linear interpolation using a linear stretching - CSAMPLE_GAIN timeBetweenFullSamplesLeft = fmod(delayLeftSourceFrame, 1); - CSAMPLE_GAIN timeBetweenFullSamplesRight = fmod(delayRightSourceFrame, 1); + CSAMPLE_GAIN timeBetweenFullSamplesLeft = + static_cast(fmod(delayLeftSourceFrame, 1)); + CSAMPLE_GAIN timeBetweenFullSamplesRight = + static_cast(fmod(delayRightSourceFrame, 1)); // applying the delay on left channel with linear interpolation between each sample pOutput[0] = -- cgit v1.2.3 From b61e63444f7a01e9b902157b642d53e7e893f83d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:01:11 +0200 Subject: engine/positionscratchcontroller: Make lossy typecast explicit --- src/engine/positionscratchcontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/positionscratchcontroller.cpp b/src/engine/positionscratchcontroller.cpp index 44e8cd4d43..cb7a93e61d 100644 --- a/src/engine/positionscratchcontroller.cpp +++ b/src/engine/positionscratchcontroller.cpp @@ -111,7 +111,7 @@ void PositionScratchController::process(double currentSample, double releaseRate // have 0 ... 3 samples. The remaining jitter is ironed by the following IIR // lowpass filter const double m_dMouseSampeIntervall = 0.016; - const int callsPerDt = ceil(m_dMouseSampeIntervall/dt); + const auto callsPerDt = static_cast(ceil(m_dMouseSampeIntervall / dt)); double scratchPosition = 0; m_dMouseSampeTime += dt; if (m_dMouseSampeTime >= m_dMouseSampeIntervall || !m_bScratching) { -- cgit v1.2.3 From c646196b343aa29f0171d2600c90287cc5ddeee1 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:01:33 +0200 Subject: library/autodj/dlgautodj: Add missing typecast for spinbox value --- src/library/autodj/dlgautodj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index b80465998b..cea92beec2 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -190,7 +190,7 @@ DlgAutoDJ::DlgAutoDJ( // Setup DlgAutoDJ UI based on the current AutoDJProcessor state. Keep in // mind that AutoDJ may already be active when DlgAutoDJ is created (due to // skin changes, etc.). - spinBoxTransition->setValue(m_pAutoDJProcessor->getTransitionTime()); + spinBoxTransition->setValue(static_cast(m_pAutoDJProcessor->getTransitionTime())); connect(m_pAutoDJProcessor, &AutoDJProcessor::transitionTimeChanged, this, -- cgit v1.2.3 From 0a4ae142dcce7b4e5347eac9ca93f427a9068016 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:02:11 +0200 Subject: library/basecoverartdelegate: Add missing typecast --- src/library/basecoverartdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/basecoverartdelegate.cpp b/src/library/basecoverartdelegate.cpp index d957f35940..7694fcfd36 100644 --- a/src/library/basecoverartdelegate.cpp +++ b/src/library/basecoverartdelegate.cpp @@ -119,7 +119,7 @@ void BaseCoverArtDelegate::paintItem( QPixmap pixmap = m_pCache->tryLoadCover( this, coverInfo, - option.rect.width() * scaleFactor, + static_cast(option.rect.width() * scaleFactor), m_inhibitLazyLoading ? CoverArtCache::Loading::CachedOnly : CoverArtCache::Loading::Default); if (pixmap.isNull()) { // Cache miss -- cgit v1.2.3 From c4e0092eebb89f8732cd4d7f4964211e41859429 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:02:37 +0200 Subject: library/dlgcoverartfullsize: Add missing typecast --- src/library/dlgcoverartfullsize.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/library/dlgcoverartfullsize.cpp b/src/library/dlgcoverartfullsize.cpp index 623fc4a436..79e7d49df0 100644 --- a/src/library/dlgcoverartfullsize.cpp +++ b/src/library/dlgcoverartfullsize.cpp @@ -247,8 +247,8 @@ void DlgCoverArtFullSize::wheelEvent(QWheelEvent* event) { // Scale the image size int oldWidth = width(); int oldHeight = height(); - int newWidth = oldWidth + (0.2 * event->angleDelta().y()); - int newHeight = oldHeight + (0.2 * event->angleDelta().y()); + auto newWidth = static_cast(oldWidth + (0.2 * event->angleDelta().y())); + auto newHeight = static_cast(oldHeight + (0.2 * event->angleDelta().y())); QSize newSize = size(); newSize.scale(newWidth, newHeight, Qt::KeepAspectRatio); @@ -261,8 +261,12 @@ void DlgCoverArtFullSize::wheelEvent(QWheelEvent* event) { QPoint oldPointUnderCursor = event->pos(); #endif - int newPointX = (double) oldPointUnderCursor.x() / oldWidth * newSize.width(); - int newPointY = (double) oldPointUnderCursor.y() / oldHeight * newSize.height(); + int newPointX = + static_cast(static_cast(oldPointUnderCursor.x()) / + oldWidth * newSize.width()); + int newPointY = + static_cast(static_cast(oldPointUnderCursor.y()) / + oldHeight * newSize.height()); QPoint newOrigin = QPoint( oldOrigin.x() + (oldPointUnderCursor.x() - newPointX), oldOrigin.y() + (oldPointUnderCursor.y() - newPointY)); -- cgit v1.2.3 From 1f187e850e5fe92060794f2113253d23e58c35c9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:03:00 +0200 Subject: preferences/dialog/dlgprefcrossfader: Add missing typecast for slider --- src/preferences/dialog/dlgprefcrossfader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/dialog/dlgprefcrossfader.cpp b/src/preferences/dialog/dlgprefcrossfader.cpp index 7ed7b8e950..3e5b321b6f 100644 --- a/src/preferences/dialog/dlgprefcrossfader.cpp +++ b/src/preferences/dialog/dlgprefcrossfader.cpp @@ -89,7 +89,7 @@ void DlgPrefCrossfader::slotResetToDefaults() { EngineXfader::kTransformMax - EngineXfader::kTransformMin + 1, SliderXFader->minimum(), SliderXFader->maximum()); - SliderXFader->setValue(sliderVal); + SliderXFader->setValue(static_cast(sliderVal)); m_xFaderMode = MIXXX_XFADER_ADDITIVE; radioButtonAdditive->setChecked(true); -- cgit v1.2.3 From 7368036e194b477e3795ddf23d0df3e0c3f1f92a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:03:48 +0200 Subject: preferences/dialog/dlgprefsound: Add missing typecast --- src/preferences/dialog/dlgprefsound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index b22ff0980b..24b4e24b9f 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -564,7 +564,7 @@ void DlgPrefSound::updateAudioBufferSizes(int sampleRateIndex) { } audioBufferComboBox->clear(); for (unsigned int i = 0; i < SoundManagerConfig::kMaxAudioBufferSizeIndex; ++i) { - float latency = framesPerBuffer / sampleRate * 1000; + const auto latency = static_cast(framesPerBuffer / sampleRate * 1000); // i + 1 in the next line is a latency index as described in SSConfig audioBufferComboBox->addItem(tr("%1 ms").arg(latency,0,'g',3), i + 1); framesPerBuffer <<= 1; // *= 2 -- cgit v1.2.3 From 9e409c8c19d417f308e75d6b0fd0accb76026da2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:04:09 +0200 Subject: track/replaygain: Add missing typecast to CSAMPLE --- src/track/replaygain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/track/replaygain.cpp b/src/track/replaygain.cpp index 9fe1a84cc1..c3282d12c4 100644 --- a/src/track/replaygain.cpp +++ b/src/track/replaygain.cpp @@ -120,7 +120,7 @@ CSAMPLE ReplayGain::peakFromString(QString strPeak, bool* pValid) { return kPeakUndefined; } isValid = false; - const CSAMPLE peak = normalizedPeak.toDouble(&isValid); + const auto peak = static_cast(normalizedPeak.toDouble(&isValid)); if (isValid) { if (isValidPeak(peak)) { if (pValid) { -- cgit v1.2.3 From d9ba8c4fb808f274d82bb5be1aa90fce07060551 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:04:47 +0200 Subject: track/serato/beatgrid: Fix usage of wrong type --- src/track/serato/beatgrid.cpp | 2 +- src/track/serato/beatgrid.h | 2 +- src/track/serato/beatsimporter.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/track/serato/beatgrid.cpp b/src/track/serato/beatgrid.cpp index a1518fa8b3..7c21fd19a6 100644 --- a/src/track/serato/beatgrid.cpp +++ b/src/track/serato/beatgrid.cpp @@ -71,7 +71,7 @@ SeratoBeatGridNonTerminalMarker::parseID3(const QByteArray& data) { } float positionSecs; - uint32_t beatsTillNextMarker; + quint32 beatsTillNextMarker; QDataStream stream(data); stream.setByteOrder(QDataStream::BigEndian); diff --git a/src/track/serato/beatgrid.h b/src/track/serato/beatgrid.h index 15f78002c5..ac3baf07d9 100644 --- a/src/track/serato/beatgrid.h +++ b/src/track/serato/beatgrid.h @@ -33,7 +33,7 @@ class SeratoBeatGridNonTerminalMarker final { return m_positionSecs; } - float beatsTillNextMarker() const { + quint32 beatsTillNextMarker() const { return m_beatsTillNextMarker; } diff --git a/src/track/serato/beatsimporter.cpp b/src/track/serato/beatsimporter.cpp index cab3fb5e58..d78038793e 100644 --- a/src/track/serato/beatsimporter.cpp +++ b/src/track/serato/beatsimporter.cpp @@ -58,7 +58,7 @@ QVector SeratoBeatsImporter::importBeatsAndApplyTimingOffset( pMarker->beatsTillNextMarker(); beats.resize(beats.size() + pMarker->beatsTillNextMarker()); - for (int j = 0; j < pMarker->beatsTillNextMarker(); ++j) { + for (quint32 j = 0; j < pMarker->beatsTillNextMarker(); ++j) { beats.append(streamInfo.getSignalInfo().millis2frames( beatPositionMillis + (j * beatLengthMillis))); } -- cgit v1.2.3 From a490f7f061f0af7f642de0e230381a454db7f785 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:05:22 +0200 Subject: waveform/renderers/waveformrenderersignalbase: Add missing typecasts --- .../renderers/waveformrenderersignalbase.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/waveform/renderers/waveformrenderersignalbase.cpp b/src/waveform/renderers/waveformrenderersignalbase.cpp index f14d7edcec..008915aff0 100644 --- a/src/waveform/renderers/waveformrenderersignalbase.cpp +++ b/src/waveform/renderers/waveformrenderersignalbase.cpp @@ -154,28 +154,31 @@ void WaveformRendererSignalBase::getGains(float* pAllGain, float* pLowGain, float* pMidGain, float* pHighGain) { WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); if (pAllGain != NULL) { - float allGain = m_waveformRenderer->getGain(); + double allGain = m_waveformRenderer->getGain(); allGain *= factory->getVisualGain(::WaveformWidgetFactory::All); - *pAllGain = allGain; + *pAllGain = static_cast(allGain); } if (pLowGain || pMidGain || pHighGain) { // Per-band gain from the EQ knobs. - float lowGain(1.0), midGain(1.0), highGain(1.0); + CSAMPLE_GAIN lowGain = 1.0, midGain = 1.0, highGain = 1.0; // Only adjust low/mid/high gains if EQs are enabled. if (m_pEQEnabled->get() > 0.0) { if (m_pLowFilterControlObject && m_pMidFilterControlObject && m_pHighFilterControlObject) { - lowGain = m_pLowFilterControlObject->get(); - midGain = m_pMidFilterControlObject->get(); - highGain = m_pHighFilterControlObject->get(); + lowGain = static_cast(m_pLowFilterControlObject->get()); + midGain = static_cast(m_pMidFilterControlObject->get()); + highGain = static_cast(m_pHighFilterControlObject->get()); } - lowGain *= factory->getVisualGain(WaveformWidgetFactory::Low); - midGain *= factory->getVisualGain(WaveformWidgetFactory::Mid); - highGain *= factory->getVisualGain(WaveformWidgetFactory::High); + lowGain *= static_cast( + factory->getVisualGain(WaveformWidgetFactory::Low)); + midGain *= static_cast( + factory->getVisualGain(WaveformWidgetFactory::Mid)); + highGain *= static_cast( + factory->getVisualGain(WaveformWidgetFactory::High)); if (m_pLowKillControlObject && m_pLowKillControlObject->get() > 0.0) { lowGain = 0; -- cgit v1.2.3 From 122a3bcc3fb8a48e175226ad7681b1c27c37b70d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 16:05:43 +0200 Subject: widget: Add typecasts to remaining QFont pixel size scaling code --- src/widget/wlabel.cpp | 3 ++- src/widget/wwidget.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widget/wlabel.cpp b/src/widget/wlabel.cpp index 48404061b2..5a07154bc5 100644 --- a/src/widget/wlabel.cpp +++ b/src/widget/wlabel.cpp @@ -132,7 +132,8 @@ bool WLabel::event(QEvent* pEvent) { // resetting the font to the original css values. // Only scale pixel size fonts, point size fonts are scaled by the OS if (fonti.pixelSize() > 0) { - const_cast(fonti).setPixelSize(fonti.pixelSize() * m_scaleFactor); + const_cast(fonti).setPixelSize( + static_cast(fonti.pixelSize() * m_scaleFactor)); } // measure text with the new font setText(m_longText); diff --git a/src/widget/wwidget.cpp b/src/widget/wwidget.cpp index 364b46280a..4f05531072 100644 --- a/src/widget/wwidget.cpp +++ b/src/widget/wwidget.cpp @@ -51,7 +51,8 @@ bool WWidget::event(QEvent* e) { // resetting the font to the original css values. // Only scale pixel size fonts, point size fonts are scaled by the OS if (fonti.pixelSize() > 0) { - const_cast(fonti).setPixelSize(fonti.pixelSize() * m_scaleFactor); + const_cast(fonti).setPixelSize( + static_cast(fonti.pixelSize() * m_scaleFactor)); } } else if (isEnabled()) { switch(e->type()) { -- cgit v1.2.3 From a4659dcf31f6f1863ed08ee802fb5d2d39c710d0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 19:24:16 +0200 Subject: effects/builtin/balanceeffect: Use decltype for static_cast --- src/effects/builtin/balanceeffect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/effects/builtin/balanceeffect.cpp b/src/effects/builtin/balanceeffect.cpp index e120c101e7..db24066a3f 100644 --- a/src/effects/builtin/balanceeffect.cpp +++ b/src/effects/builtin/balanceeffect.cpp @@ -116,8 +116,8 @@ void BalanceEffect::processChannel(const ChannelHandle& handle, CSAMPLE_GAIN balance = 0; CSAMPLE_GAIN midSide = 0; if (enableState != EffectEnableState::Disabling) { - balance = static_cast(m_pBalanceParameter->value()); - midSide = static_cast(m_pMidSideParameter->value()); + balance = static_cast(m_pBalanceParameter->value()); + midSide = static_cast(m_pMidSideParameter->value()); } CSAMPLE_GAIN balanceDelta = (balance - pGroupState->m_oldBalance) -- cgit v1.2.3 From 51dcacbf7950f409ed615f539777847fa8ca315a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 19:25:54 +0200 Subject: engine/filters/enginefilterpansingle: Use const auto --- src/engine/filters/enginefilterpansingle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/filters/enginefilterpansingle.h b/src/engine/filters/enginefilterpansingle.h index 383377cdf0..df0a608148 100644 --- a/src/engine/filters/enginefilterpansingle.h +++ b/src/engine/filters/enginefilterpansingle.h @@ -53,9 +53,9 @@ class EngineFilterPanSingle { m_delayFrame = (m_delayFrame + 1) % SIZE; // prepare coefficients for linear interpolation using a linear stretching - CSAMPLE_GAIN timeBetweenFullSamplesLeft = + const auto timeBetweenFullSamplesLeft = static_cast(fmod(delayLeftSourceFrame, 1)); - CSAMPLE_GAIN timeBetweenFullSamplesRight = + const auto timeBetweenFullSamplesRight = static_cast(fmod(delayRightSourceFrame, 1)); // applying the delay on left channel with linear interpolation between each sample -- cgit v1.2.3 From 4f800a941c1eabbcfb3306dc3f869e3acc0dcabb Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 25 Sep 2020 19:26:08 +0200 Subject: library/dlgcoverartfullsize: Use const auto --- src/library/dlgcoverartfullsize.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/library/dlgcoverartfullsize.cpp b/src/library/dlgcoverartfullsize.cpp index 79e7d49df0..02f8ca3212 100644 --- a/src/library/dlgcoverartfullsize.cpp +++ b/src/library/dlgcoverartfullsize.cpp @@ -261,12 +261,10 @@ void DlgCoverArtFullSize::wheelEvent(QWheelEvent* event) { QPoint oldPointUnderCursor = event->pos(); #endif - int newPointX = - static_cast(static_cast(oldPointUnderCursor.x()) / - oldWidth * newSize.width()); - int newPointY = - static_cast(static_cast(oldPointUnderCursor.y()) / - oldHeight * newSize.height()); + const auto newPointX = static_cast( + static_cast(oldPointUnderCursor.x()) / oldWidth * newSize.width()); + const auto newPointY = static_cast( + static_cast(oldPointUnderCursor.y()) / oldHeight * newSize.height()); QPoint newOrigin = QPoint( oldOrigin.x() + (oldPointUnderCursor.x() - newPointX), oldOrigin.y() + (oldPointUnderCursor.y() - newPointY)); -- cgit v1.2.3 From 9f117b68d355c2b8f86f6ad1302f83a2005541f6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 00:35:29 +0200 Subject: effects/builtin/echoeffect: Use CSAMPLE_GAIN --- src/effects/builtin/echoeffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects/builtin/echoeffect.cpp b/src/effects/builtin/echoeffect.cpp index 9487711a1d..e8d27cb457 100644 --- a/src/effects/builtin/echoeffect.cpp +++ b/src/effects/builtin/echoeffect.cpp @@ -198,7 +198,7 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr CSAMPLE bufferedSampleLeft = gs.delay_buf[read_position]; CSAMPLE bufferedSampleRight = gs.delay_buf[read_position + 1]; if (read_position != prev_read_position) { - const auto frac = static_cast(static_cast(i) / + const auto frac = static_cast(static_cast(i) / bufferParameters.samplesPerBuffer()); bufferedSampleLeft *= frac; bufferedSampleRight *= frac; -- cgit v1.2.3 From 984aa95cd6fa5eab5c9d21dfc0453df8a12a6fe3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 00:35:53 +0200 Subject: effects/builtin/flangereffect: Optimize gain correction constant --- src/effects/builtin/flangereffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects/builtin/flangereffect.cpp b/src/effects/builtin/flangereffect.cpp index 1211098b46..4e32ed0cad 100644 --- a/src/effects/builtin/flangereffect.cpp +++ b/src/effects/builtin/flangereffect.cpp @@ -7,7 +7,7 @@ namespace{ // Gain correction was verified with replay gain and default parameters -constexpr CSAMPLE kGainCorrection = 1.4125375446227544f; // 3 dB +constexpr CSAMPLE kGainCorrection = 1.41253754f; // 3 dB inline CSAMPLE tanh_approx(CSAMPLE input) { // return tanhf(input); // 142ns for process; -- cgit v1.2.3 From acecea84a3783c350c5b47b11d4461ff183ca154 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 00:36:21 +0200 Subject: effects/builtin/flangereffect: Improve periodFraction calculation --- src/effects/builtin/flangereffect.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/effects/builtin/flangereffect.cpp b/src/effects/builtin/flangereffect.cpp index 4e32ed0cad..37e632e261 100644 --- a/src/effects/builtin/flangereffect.cpp +++ b/src/effects/builtin/flangereffect.cpp @@ -209,8 +209,7 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, pState->lfoFrames = 0; } - auto periodFraction = static_cast( - static_cast(pState->lfoFrames) / lfoPeriodFrames); + 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; -- cgit v1.2.3 From 6d2b13a18a652db94aee09d77504ecff4020a783 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 00:40:13 +0200 Subject: track/replaygain: Use toFloat() for normalizedPeak --- src/track/replaygain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/track/replaygain.cpp b/src/track/replaygain.cpp index c3282d12c4..c2a1ed0146 100644 --- a/src/track/replaygain.cpp +++ b/src/track/replaygain.cpp @@ -120,7 +120,7 @@ CSAMPLE ReplayGain::peakFromString(QString strPeak, bool* pValid) { return kPeakUndefined; } isValid = false; - const auto peak = static_cast(normalizedPeak.toDouble(&isValid)); + const CSAMPLE peak = normalizedPeak.toFloat(&isValid); if (isValid) { if (isValidPeak(peak)) { if (pValid) { -- cgit v1.2.3 From 26166f45a412030549fca9fbeffedc7abad6a91b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 01:00:59 +0200 Subject: waveform/renderers/waveformrenderersignalbase: Use float math for gain --- src/waveform/renderers/waveformrenderersignalbase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/waveform/renderers/waveformrenderersignalbase.cpp b/src/waveform/renderers/waveformrenderersignalbase.cpp index 008915aff0..5373ff5f77 100644 --- a/src/waveform/renderers/waveformrenderersignalbase.cpp +++ b/src/waveform/renderers/waveformrenderersignalbase.cpp @@ -153,10 +153,10 @@ void WaveformRendererSignalBase::setup(const QDomNode& node, void WaveformRendererSignalBase::getGains(float* pAllGain, float* pLowGain, float* pMidGain, float* pHighGain) { WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); - if (pAllGain != NULL) { - double allGain = m_waveformRenderer->getGain(); - allGain *= factory->getVisualGain(::WaveformWidgetFactory::All); - *pAllGain = static_cast(allGain); + if (pAllGain) { + *pAllGain = static_cast(m_waveformRenderer->getGain()) * + static_cast(factory->getVisualGain(WaveformWidgetFactory::All)); + ; } if (pLowGain || pMidGain || pHighGain) { -- cgit v1.2.3 From 73d4ae03e83cbfaacaf44d181b088fde8779b9c9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 01:14:31 +0200 Subject: effects/builtin/echoeffect: Simplify timecast and use CSAMPLE_GAIN --- src/effects/builtin/echoeffect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/effects/builtin/echoeffect.cpp b/src/effects/builtin/echoeffect.cpp index e8d27cb457..fe1809b4ec 100644 --- a/src/effects/builtin/echoeffect.cpp +++ b/src/effects/builtin/echoeffect.cpp @@ -198,8 +198,8 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr CSAMPLE bufferedSampleLeft = gs.delay_buf[read_position]; CSAMPLE bufferedSampleRight = gs.delay_buf[read_position + 1]; if (read_position != prev_read_position) { - const auto frac = static_cast(static_cast(i) / - bufferParameters.samplesPerBuffer()); + const CSAMPLE_GAIN frac = static_cast(i) / + bufferParameters.samplesPerBuffer(); bufferedSampleLeft *= frac; bufferedSampleRight *= frac; bufferedSampleLeft += gs.delay_buf[prev_read_position] * (1 - frac); -- cgit v1.2.3 From 74dfd27bc22099301f3244048141a2fbe1e95672 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 26 Sep 2020 01:16:23 +0200 Subject: effects/builtin/flangereffect: Fix types used for frac math --- src/effects/builtin/flangereffect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/effects/builtin/flangereffect.cpp b/src/effects/builtin/flangereffect.cpp index 37e632e261..27a8f8c17f 100644 --- a/src/effects/builtin/flangereffect.cpp +++ b/src/effects/builtin/flangereffect.cpp @@ -223,7 +223,8 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, CSAMPLE prevRight = delayRight[framePrev]; CSAMPLE nextRight = delayRight[frameNext]; - auto frac = static_cast(delayFrames - floorf(static_cast(delayFrames))); + const CSAMPLE_GAIN frac = static_cast( + delayFrames - floorf(static_cast(delayFrames))); CSAMPLE delayedSampleLeft = prevLeft + frac * (nextLeft - prevLeft); CSAMPLE delayedSampleRight = prevRight + frac * (nextRight - prevRight); -- cgit v1.2.3