aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-16 17:29:32 -0700
committerChris Robinson <[email protected]>2020-04-16 17:29:32 -0700
commit27ac637a66df64c4135b77ee123d1a02076b08a0 (patch)
treefb91318537aaa071000c1f4b340ed3822c01bc12 /alc/effects
parentcf4a848fd0c42e85e5ce68e33120386d932e6375 (diff)
Remove another unnecessary return value
Diffstat (limited to 'alc/effects')
-rw-r--r--alc/effects/autowah.cpp6
-rw-r--r--alc/effects/base.h2
-rw-r--r--alc/effects/chorus.cpp11
-rw-r--r--alc/effects/compressor.cpp10
-rw-r--r--alc/effects/dedicated.cpp5
-rw-r--r--alc/effects/distortion.cpp5
-rw-r--r--alc/effects/echo.cpp11
-rw-r--r--alc/effects/equalizer.cpp8
-rw-r--r--alc/effects/fshifter.cpp6
-rw-r--r--alc/effects/modulator.cpp5
-rw-r--r--alc/effects/null.cpp5
-rw-r--r--alc/effects/pshifter.cpp6
-rw-r--r--alc/effects/reverb.cpp10
-rw-r--r--alc/effects/vmorpher.cpp6
14 files changed, 34 insertions, 62 deletions
diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp
index 72ce4738..0bf2450d 100644
--- a/alc/effects/autowah.cpp
+++ b/alc/effects/autowah.cpp
@@ -69,14 +69,14 @@ struct AutowahState final : public EffectState {
alignas(16) float mBufferOut[BUFFERSIZE];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(AutowahState)
};
-bool AutowahState::deviceUpdate(const ALCdevice*)
+void AutowahState::deviceUpdate(const ALCdevice*)
{
/* (Re-)initializing parameters and clear the buffers. */
@@ -100,8 +100,6 @@ bool AutowahState::deviceUpdate(const ALCdevice*)
chan.Filter.z1 = 0.0f;
chan.Filter.z2 = 0.0f;
}
-
- return true;
}
void AutowahState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/base.h b/alc/effects/base.h
index 1ddc2f07..8ed3c6f8 100644
--- a/alc/effects/base.h
+++ b/alc/effects/base.h
@@ -165,7 +165,7 @@ struct EffectState : public al::intrusive_ref<EffectState> {
virtual ~EffectState() = default;
- virtual bool deviceUpdate(const ALCdevice *device) = 0;
+ virtual void deviceUpdate(const ALCdevice *device) = 0;
virtual void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) = 0;
virtual void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) = 0;
};
diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp
index 2ddc179c..97ab85d1 100644
--- a/alc/effects/chorus.cpp
+++ b/alc/effects/chorus.cpp
@@ -80,24 +80,21 @@ struct ChorusState final : public EffectState {
void getTriangleDelays(ALuint (*delays)[MAX_UPDATE_SAMPLES], const size_t todo);
void getSinusoidDelays(ALuint (*delays)[MAX_UPDATE_SAMPLES], const size_t todo);
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ChorusState)
};
-bool ChorusState::deviceUpdate(const ALCdevice *Device)
+void ChorusState::deviceUpdate(const ALCdevice *Device)
{
constexpr float max_delay{maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY)};
const auto frequency = static_cast<float>(Device->Frequency);
const size_t maxlen{NextPowerOf2(float2uint(max_delay*2.0f*frequency) + 1u)};
if(maxlen != mSampleBuffer.size())
- {
- mSampleBuffer.resize(maxlen);
- mSampleBuffer.shrink_to_fit();
- }
+ al::vector<float,16>(maxlen).swap(mSampleBuffer);
std::fill(mSampleBuffer.begin(), mSampleBuffer.end(), 0.0f);
for(auto &e : mGains)
@@ -105,8 +102,6 @@ bool ChorusState::deviceUpdate(const ALCdevice *Device)
std::fill(std::begin(e.Current), std::end(e.Current), 0.0f);
std::fill(std::begin(e.Target), std::end(e.Target), 0.0f);
}
-
- return true;
}
void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp
index d2a56a86..03751ef0 100644
--- a/alc/effects/compressor.cpp
+++ b/alc/effects/compressor.cpp
@@ -49,28 +49,26 @@ struct CompressorState final : public EffectState {
float mEnvFollower{1.0f};
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(CompressorState)
};
-bool CompressorState::deviceUpdate(const ALCdevice *device)
+void CompressorState::deviceUpdate(const ALCdevice *device)
{
/* Number of samples to do a full attack and release (non-integer sample
* counts are okay).
*/
- const float attackCount = static_cast<float>(device->Frequency) * ATTACK_TIME;
- const float releaseCount = static_cast<float>(device->Frequency) * RELEASE_TIME;
+ const float attackCount{static_cast<float>(device->Frequency) * ATTACK_TIME};
+ const float releaseCount{static_cast<float>(device->Frequency) * RELEASE_TIME};
/* Calculate per-sample multipliers to attack and release at the desired
* rates.
*/
mAttackMult = std::pow(AMP_ENVELOPE_MAX/AMP_ENVELOPE_MIN, 1.0f/attackCount);
mReleaseMult = std::pow(AMP_ENVELOPE_MIN/AMP_ENVELOPE_MAX, 1.0f/releaseCount);
-
- return true;
}
void CompressorState::update(const ALCcontext*, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp
index 76dec5e0..c1741f64 100644
--- a/alc/effects/dedicated.cpp
+++ b/alc/effects/dedicated.cpp
@@ -37,17 +37,16 @@ struct DedicatedState final : public EffectState {
float mTargetGains[MAX_OUTPUT_CHANNELS];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(DedicatedState)
};
-bool DedicatedState::deviceUpdate(const ALCdevice*)
+void DedicatedState::deviceUpdate(const ALCdevice*)
{
std::fill(std::begin(mCurrentGains), std::end(mCurrentGains), 0.0f);
- return true;
}
void DedicatedState::update(const ALCcontext*, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp
index 83283e50..565c5bbd 100644
--- a/alc/effects/distortion.cpp
+++ b/alc/effects/distortion.cpp
@@ -46,18 +46,17 @@ struct DistortionState final : public EffectState {
float mBuffer[2][BUFFERSIZE]{};
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(DistortionState)
};
-bool DistortionState::deviceUpdate(const ALCdevice*)
+void DistortionState::deviceUpdate(const ALCdevice*)
{
mLowpass.clear();
mBandpass.clear();
- return true;
}
void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp
index 6368718a..e14dc5cb 100644
--- a/alc/effects/echo.cpp
+++ b/alc/effects/echo.cpp
@@ -57,14 +57,14 @@ struct EchoState final : public EffectState {
alignas(16) float mTempBuffer[2][BUFFERSIZE];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(EchoState)
};
-bool EchoState::deviceUpdate(const ALCdevice *Device)
+void EchoState::deviceUpdate(const ALCdevice *Device)
{
const auto frequency = static_cast<float>(Device->Frequency);
@@ -73,10 +73,7 @@ bool EchoState::deviceUpdate(const ALCdevice *Device)
const ALuint maxlen{NextPowerOf2(float2uint(AL_ECHO_MAX_DELAY*frequency + 0.5f) +
float2uint(AL_ECHO_MAX_LRDELAY*frequency + 0.5f))};
if(maxlen != mSampleBuffer.size())
- {
- mSampleBuffer.resize(maxlen);
- mSampleBuffer.shrink_to_fit();
- }
+ al::vector<float,16>(maxlen).swap(mSampleBuffer);
std::fill(mSampleBuffer.begin(), mSampleBuffer.end(), 0.0f);
for(auto &e : mGains)
@@ -84,8 +81,6 @@ bool EchoState::deviceUpdate(const ALCdevice *Device)
std::fill(std::begin(e.Current), std::end(e.Current), 0.0f);
std::fill(std::begin(e.Target), std::end(e.Target), 0.0f);
}
-
- return true;
}
void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp
index f7d2d177..14ef1758 100644
--- a/alc/effects/equalizer.cpp
+++ b/alc/effects/equalizer.cpp
@@ -91,22 +91,20 @@ struct EqualizerState final : public EffectState {
FloatBufferLine mSampleBuffer{};
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(EqualizerState)
};
-bool EqualizerState::deviceUpdate(const ALCdevice*)
+void EqualizerState::deviceUpdate(const ALCdevice*)
{
for(auto &e : mChans)
{
- std::for_each(std::begin(e.filter), std::end(e.filter),
- std::mem_fn(&BiquadFilter::clear));
+ std::for_each(std::begin(e.filter), std::end(e.filter), std::mem_fn(&BiquadFilter::clear));
std::fill(std::begin(e.CurrentGains), std::end(e.CurrentGains), 0.0f);
}
- return true;
}
void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp
index 3fd322b9..c2ed5fb2 100644
--- a/alc/effects/fshifter.cpp
+++ b/alc/effects/fshifter.cpp
@@ -82,14 +82,14 @@ struct FshifterState final : public EffectState {
} mGains[2];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(FshifterState)
};
-bool FshifterState::deviceUpdate(const ALCdevice*)
+void FshifterState::deviceUpdate(const ALCdevice*)
{
/* (Re-)initializing parameters and clear the buffers. */
mCount = FIFO_LATENCY;
@@ -107,8 +107,6 @@ bool FshifterState::deviceUpdate(const ALCdevice*)
std::fill(std::begin(gain.Current), std::end(gain.Current), 0.0f);
std::fill(std::begin(gain.Target), std::end(gain.Target), 0.0f);
}
-
- return true;
}
void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp
index c86e6339..051f631a 100644
--- a/alc/effects/modulator.cpp
+++ b/alc/effects/modulator.cpp
@@ -82,21 +82,20 @@ struct ModulatorState final : public EffectState {
} mChans[MAX_AMBI_CHANNELS];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(ModulatorState)
};
-bool ModulatorState::deviceUpdate(const ALCdevice*)
+void ModulatorState::deviceUpdate(const ALCdevice*)
{
for(auto &e : mChans)
{
e.Filter.clear();
std::fill(std::begin(e.CurrentGains), std::end(e.CurrentGains), 0.0f);
}
- return true;
}
void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/null.cpp b/alc/effects/null.cpp
index 8ad928ca..5bef1827 100644
--- a/alc/effects/null.cpp
+++ b/alc/effects/null.cpp
@@ -18,7 +18,7 @@ struct NullState final : public EffectState {
NullState();
~NullState() override;
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
@@ -40,9 +40,8 @@ NullState::~NullState() = default;
* format) have been changed. Will always be followed by a call to the update
* method, if successful.
*/
-bool NullState::deviceUpdate(const ALCdevice* /*device*/)
+void NullState::deviceUpdate(const ALCdevice* /*device*/)
{
- return true;
}
/* This updates the effect state with new properties. This is called any time
diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp
index c4d70292..136558d5 100644
--- a/alc/effects/pshifter.cpp
+++ b/alc/effects/pshifter.cpp
@@ -96,14 +96,14 @@ struct PshifterState final : public EffectState {
float mTargetGains[MAX_OUTPUT_CHANNELS];
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
DEF_NEWDEL(PshifterState)
};
-bool PshifterState::deviceUpdate(const ALCdevice *device)
+void PshifterState::deviceUpdate(const ALCdevice *device)
{
/* (Re-)initializing parameters and clear the buffers. */
mCount = FIFO_LATENCY;
@@ -121,8 +121,6 @@ bool PshifterState::deviceUpdate(const ALCdevice *device)
std::fill(std::begin(mCurrentGains), std::end(mCurrentGains), 0.0f);
std::fill(std::begin(mTargetGains), std::end(mTargetGains), 0.0f);
-
- return true;
}
void PshifterState::update(const ALCcontext*, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp
index ac950731..60ae1020 100644
--- a/alc/effects/reverb.cpp
+++ b/alc/effects/reverb.cpp
@@ -531,7 +531,7 @@ struct ReverbState final : public EffectState {
void lateFaded(const size_t offset, const size_t todo, const float fade,
const float fadeStep);
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
@@ -597,10 +597,10 @@ void ReverbState::allocLines(const float frequency)
totalSamples += mLate.Delay.calcLineLength(length, totalSamples, frequency, 1);
if(totalSamples != mSampleBuffer.size())
- decltype(mSampleBuffer){totalSamples}.swap(mSampleBuffer);
+ decltype(mSampleBuffer)(totalSamples).swap(mSampleBuffer);
/* Clear the sample buffer. */
- std::fill(mSampleBuffer.begin(), mSampleBuffer.end(), std::array<float,NUM_LINES>{});
+ std::fill(mSampleBuffer.begin(), mSampleBuffer.end(), decltype(mSampleBuffer)::value_type{});
/* Update all delays to reflect the new sample buffer. */
mDelay.realizeLineOffset(mSampleBuffer.data());
@@ -610,7 +610,7 @@ void ReverbState::allocLines(const float frequency)
mLate.Delay.realizeLineOffset(mSampleBuffer.data());
}
-bool ReverbState::deviceUpdate(const ALCdevice *device)
+void ReverbState::deviceUpdate(const ALCdevice *device)
{
const auto frequency = static_cast<float>(device->Frequency);
@@ -678,8 +678,6 @@ bool ReverbState::deviceUpdate(const ALCdevice *device)
mAmbiSplitter[0][0].init(400.0f / frequency);
std::fill(mAmbiSplitter[0].begin()+1, mAmbiSplitter[0].end(), mAmbiSplitter[0][0]);
std::fill(mAmbiSplitter[1].begin(), mAmbiSplitter[1].end(), mAmbiSplitter[0][0]);
-
- return true;
}
/**************************************
diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp
index 5d06f635..249958c3 100644
--- a/alc/effects/vmorpher.cpp
+++ b/alc/effects/vmorpher.cpp
@@ -135,7 +135,7 @@ struct VmorpherState final : public EffectState {
float mSampleBufferA[MAX_UPDATE_SAMPLES]{};
float mSampleBufferB[MAX_UPDATE_SAMPLES]{};
- bool deviceUpdate(const ALCdevice *device) override;
+ void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override;
@@ -193,7 +193,7 @@ std::array<FormantFilter,4> VmorpherState::getFiltersByPhoneme(ALenum phoneme, f
}
-bool VmorpherState::deviceUpdate(const ALCdevice* /*device*/)
+void VmorpherState::deviceUpdate(const ALCdevice* /*device*/)
{
for(auto &e : mChans)
{
@@ -203,8 +203,6 @@ bool VmorpherState::deviceUpdate(const ALCdevice* /*device*/)
std::mem_fn(&FormantFilter::clear));
std::fill(std::begin(e.CurrentGains), std::end(e.CurrentGains), 0.0f);
}
-
- return true;
}
void VmorpherState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)