summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-09-25 15:52:28 +0200
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-09-25 16:07:22 +0200
commit59854ebaa28006ac3aac9b0388959b191d2ac244 (patch)
treef8e5e3fde31d8dbe5a3ad33c5118fe58921b10c3
parentb2442fc994a3ea69d9cd2e739f135f8be86e9db7 (diff)
effects/builtin/bitcrushereffect: Add explicit casts to CSAMPLE
-rw-r--r--src/effects/builtin/bitcrushereffect.cpp10
1 files 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<CSAMPLE>(
+ m_pDownsampleParameter ? m_pDownsampleParameter->value() : 0.0);
- CSAMPLE bit_depth = m_pBitDepthParameter ?
- m_pBitDepthParameter->value() : 16;
+ auto bit_depth = static_cast<CSAMPLE>(
+ 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;