diff options
author | Chris Robinson <[email protected]> | 2019-05-29 09:37:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-05-29 09:37:25 -0700 |
commit | ec3a6f8cded70aeb54e9c658fa68a680c017e1ef (patch) | |
tree | ba1d289c58645040cf0aaccaf6405dae8a87c414 /Alc/effects | |
parent | b923eb187991a8db56fd23cffa70f946ce24c1ff (diff) |
Use FloatBufferLine for the effect process method
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.cpp | 8 | ||||
-rw-r--r-- | Alc/effects/base.h | 2 | ||||
-rw-r--r-- | Alc/effects/chorus.cpp | 9 | ||||
-rw-r--r-- | Alc/effects/compressor.cpp | 4 | ||||
-rw-r--r-- | Alc/effects/dedicated.cpp | 9 | ||||
-rw-r--r-- | Alc/effects/distortion.cpp | 4 | ||||
-rw-r--r-- | Alc/effects/echo.cpp | 9 | ||||
-rw-r--r-- | Alc/effects/equalizer.cpp | 9 | ||||
-rw-r--r-- | Alc/effects/fshifter.cpp | 8 | ||||
-rw-r--r-- | Alc/effects/modulator.cpp | 8 | ||||
-rw-r--r-- | Alc/effects/null.cpp | 4 | ||||
-rw-r--r-- | Alc/effects/pshifter.cpp | 8 | ||||
-rw-r--r-- | Alc/effects/reverb.cpp | 30 |
13 files changed, 60 insertions, 52 deletions
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp index dc03dee1..2b01f70a 100644 --- a/Alc/effects/autowah.cpp +++ b/Alc/effects/autowah.cpp @@ -72,7 +72,7 @@ struct ALautowahState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(ALautowahState) }; @@ -128,7 +128,7 @@ void ALautowahState::update(const ALCcontext *context, const ALeffectslot *slot, } } -void ALautowahState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void ALautowahState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { const ALfloat attack_rate = mAttackRate; const ALfloat release_rate = mReleaseRate; @@ -194,8 +194,8 @@ void ALautowahState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl mChans[c].Filter.z2 = z2; /* Now, mix the processed sound data to the output. */ - MixSamples(mBufferOut, numOutput, samplesOut, mChans[c].CurrentGains, - mChans[c].TargetGains, samplesToDo, 0, samplesToDo); + MixSamples(mBufferOut, numOutput, &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), + mChans[c].CurrentGains, mChans[c].TargetGains, samplesToDo, 0, samplesToDo); } } diff --git a/Alc/effects/base.h b/Alc/effects/base.h index 467fb5af..c7c6f1c0 100644 --- a/Alc/effects/base.h +++ b/Alc/effects/base.h @@ -151,7 +151,7 @@ struct EffectState { virtual ALboolean deviceUpdate(const ALCdevice *device) = 0; virtual void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) = 0; - virtual void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) = 0; + virtual void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) = 0; void IncRef() noexcept; void DecRef() noexcept; diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp index d12d2484..e953d3e3 100644 --- a/Alc/effects/chorus.cpp +++ b/Alc/effects/chorus.cpp @@ -101,7 +101,7 @@ struct ChorusState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(ChorusState) }; @@ -198,7 +198,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co } } -void ChorusState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void ChorusState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { const auto bufmask = static_cast<ALsizei>(mSampleBuffer.size()-1); const ALfloat feedback{mFeedback}; @@ -255,8 +255,9 @@ void ChorusState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI } for(c = 0;c < 2;c++) - MixSamples(temps[c], numOutput, samplesOut, mGains[c].Current, mGains[c].Target, - samplesToDo-base, base, todo); + MixSamples(temps[c], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mGains[c].Current, + mGains[c].Target, samplesToDo-base, base, todo); base += todo; } diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp index 2a441b0e..a3435d61 100644 --- a/Alc/effects/compressor.cpp +++ b/Alc/effects/compressor.cpp @@ -52,7 +52,7 @@ struct CompressorState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(CompressorState) }; @@ -87,7 +87,7 @@ void CompressorState::update(const ALCcontext* UNUSED(context), const ALeffectsl } } -void CompressorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { ALsizei i, j, k; ALsizei base; diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp index 14d0c3c8..7b44e392 100644 --- a/Alc/effects/dedicated.cpp +++ b/Alc/effects/dedicated.cpp @@ -40,7 +40,7 @@ struct DedicatedState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(DedicatedState) }; @@ -90,10 +90,11 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo } } -void DedicatedState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void DedicatedState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { - MixSamples(samplesIn[0], numOutput, samplesOut, mCurrentGains, mTargetGains, samplesToDo, 0, - samplesToDo); + MixSamples(samplesIn[0].data(), numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mCurrentGains, mTargetGains, + samplesToDo, 0, samplesToDo); } diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp index 7ef77c69..ffe2a102 100644 --- a/Alc/effects/distortion.cpp +++ b/Alc/effects/distortion.cpp @@ -50,7 +50,7 @@ struct DistortionState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(DistortionState) }; @@ -95,7 +95,7 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot ComputePanGains(target.Main, coeffs, slot->Params.Gain*props->Distortion.Gain, mGain); } -void DistortionState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void DistortionState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { ALfloat (*RESTRICT buffer)[BUFFERSIZE] = mBuffer; const ALfloat fc = mEdgeCoeff; diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp index 158ab856..e684039d 100644 --- a/Alc/effects/echo.cpp +++ b/Alc/effects/echo.cpp @@ -60,7 +60,7 @@ struct EchoState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(EchoState) }; @@ -119,7 +119,7 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons ComputePanGains(target.Main, coeffs[1], slot->Params.Gain, mGains[1].Target); } -void EchoState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { const auto mask = static_cast<ALsizei>(mSampleBuffer.size()-1); ALfloat *RESTRICT delaybuf{mSampleBuffer.data()}; @@ -158,8 +158,9 @@ void EchoState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn) mOffset = offset; for(ALsizei c{0};c < 2;c++) - MixSamples(mTempBuffer[c], numOutput, samplesOut, mGains[c].Current, mGains[c].Target, - samplesToDo, 0, samplesToDo); + MixSamples(mTempBuffer[c], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mGains[c].Current, + mGains[c].Target, samplesToDo, 0, samplesToDo); } diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp index cc701e8d..53f8e153 100644 --- a/Alc/effects/equalizer.cpp +++ b/Alc/effects/equalizer.cpp @@ -94,7 +94,7 @@ struct EqualizerState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(EqualizerState) }; @@ -158,17 +158,18 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot, } } -void EqualizerState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void EqualizerState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { ASSUME(numInput > 0); for(ALsizei c{0};c < numInput;c++) { - mChans[c].filter[0].process(mSampleBuffer, samplesIn[c], samplesToDo); + mChans[c].filter[0].process(mSampleBuffer, samplesIn[c].data(), samplesToDo); mChans[c].filter[1].process(mSampleBuffer, mSampleBuffer, samplesToDo); mChans[c].filter[2].process(mSampleBuffer, mSampleBuffer, samplesToDo); mChans[c].filter[3].process(mSampleBuffer, mSampleBuffer, samplesToDo); - MixSamples(mSampleBuffer, numOutput, samplesOut, mChans[c].CurrentGains, + MixSamples(mSampleBuffer, numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mChans[c].CurrentGains, mChans[c].TargetGains, samplesToDo, 0, samplesToDo); } } diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp index e3dc6f1d..0b8d33e4 100644 --- a/Alc/effects/fshifter.cpp +++ b/Alc/effects/fshifter.cpp @@ -83,7 +83,7 @@ struct FshifterState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(FshifterState) }; @@ -138,7 +138,7 @@ void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot, ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains); } -void FshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void FshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { static constexpr complex_d complex_zero{0.0, 0.0}; ALfloat *RESTRICT BufferOut = mBufferOut; @@ -198,8 +198,8 @@ void FshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sample } /* Now, mix the processed sound data to the output. */ - MixSamples(BufferOut, numOutput, samplesOut, mCurrentGains, mTargetGains, - maxi(samplesToDo, 512), 0, samplesToDo); + MixSamples(BufferOut, numOutput, &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), + mCurrentGains, mTargetGains, maxi(samplesToDo, 512), 0, samplesToDo); } diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp index f926cb87..ec0b6184 100644 --- a/Alc/effects/modulator.cpp +++ b/Alc/effects/modulator.cpp @@ -93,7 +93,7 @@ struct ModulatorState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(ModulatorState) }; @@ -141,7 +141,7 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot, } } -void ModulatorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void ModulatorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { const ALsizei step = mStep; ALsizei base; @@ -165,8 +165,8 @@ void ModulatorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl for(i = 0;i < td;i++) temps[i] *= modsamples[i]; - MixSamples(temps, numOutput, samplesOut, mChans[c].CurrentGains, - mChans[c].TargetGains, samplesToDo-base, base, td); + MixSamples(temps, numOutput, &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), + mChans[c].CurrentGains, mChans[c].TargetGains, samplesToDo-base, base, td); } base += td; diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp index 5a2e4d78..96c0e928 100644 --- a/Alc/effects/null.cpp +++ b/Alc/effects/null.cpp @@ -19,7 +19,7 @@ struct NullState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(NullState) }; @@ -55,7 +55,7 @@ void NullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* UN * input to the output buffer. The result should be added to the output buffer, * not replace it. */ -void NullState::process(ALsizei /*samplesToDo*/, const ALfloat (*RESTRICT /*samplesIn*/)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT /*samplesOut*/)[BUFFERSIZE], const ALsizei /*numOutput*/) +void NullState::process(const ALsizei /*samplesToDo*/, const FloatBufferLine *RESTRICT /*samplesIn*/, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT /*samplesOut*/, const ALsizei /*numOutput*/) { } diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp index 1d85fb9e..a3e946c0 100644 --- a/Alc/effects/pshifter.cpp +++ b/Alc/effects/pshifter.cpp @@ -153,7 +153,7 @@ struct PshifterState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(PshifterState) }; @@ -197,7 +197,7 @@ void PshifterState::update(const ALCcontext* UNUSED(context), const ALeffectslot ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains); } -void PshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei /*numInput*/, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void PshifterState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { /* Pitch shifter engine based on the work of Stephan Bernsee. * http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/ @@ -321,8 +321,8 @@ void PshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sample mCount = count; /* Now, mix the processed sound data to the output. */ - MixSamples(bufferOut, numOutput, samplesOut, mCurrentGains, mTargetGains, - maxi(samplesToDo, 512), 0, samplesToDo); + MixSamples(bufferOut, numOutput, &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), + mCurrentGains, mTargetGains, maxi(samplesToDo, 512), 0, samplesToDo); } diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index d65a642d..fe660fd7 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -375,16 +375,15 @@ struct ReverbState final : public EffectState { alignas(16) ALfloat mEarlyBuffer[NUM_LINES][BUFFERSIZE]{}; alignas(16) ALfloat mLateBuffer[NUM_LINES][BUFFERSIZE]{}; - using MixOutT = void (ReverbState::*)(const ALsizei numOutput, - ALfloat (*samplesOut)[BUFFERSIZE], const ALsizei todo); + using MixOutT = void (ReverbState::*)(const ALsizei numOutput, FloatBufferLine *samplesOut, + const ALsizei todo); MixOutT mMixOut{&ReverbState::MixOutPlain}; std::array<ALfloat,MAX_AMBI_ORDER+1> mOrderScales{}; std::array<std::array<BandSplitter,NUM_LINES>,2> mAmbiSplitter; - void MixOutPlain(const ALsizei numOutput, ALfloat (*samplesOut)[BUFFERSIZE], - const ALsizei todo) + void MixOutPlain(const ALsizei numOutput, FloatBufferLine *samplesOut, const ALsizei todo) { ASSUME(todo > 0); @@ -393,7 +392,8 @@ struct ReverbState final : public EffectState { { std::fill_n(std::begin(mTempSamples[0]), todo, 0.0f); MixRowSamples(mTempSamples[0], A2B[c], mEarlyBuffer, NUM_LINES, 0, todo); - MixSamples(mTempSamples[0], numOutput, samplesOut, mEarly.CurrentGain[c], + MixSamples(mTempSamples[0], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mEarly.CurrentGain[c], mEarly.PanGain[c], todo, 0, todo); } @@ -401,13 +401,13 @@ struct ReverbState final : public EffectState { { std::fill_n(std::begin(mTempSamples[0]), todo, 0.0f); MixRowSamples(mTempSamples[0], A2B[c], mLateBuffer, NUM_LINES, 0, todo); - MixSamples(mTempSamples[0], numOutput, samplesOut, mLate.CurrentGain[c], + MixSamples(mTempSamples[0], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mLate.CurrentGain[c], mLate.PanGain[c], todo, 0, todo); } } - void MixOutAmbiUp(const ALsizei numOutput, ALfloat (*samplesOut)[BUFFERSIZE], - const ALsizei todo) + void MixOutAmbiUp(const ALsizei numOutput, FloatBufferLine *samplesOut, const ALsizei todo) { ASSUME(todo > 0); @@ -422,7 +422,8 @@ struct ReverbState final : public EffectState { const ALfloat hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; mAmbiSplitter[0][c].applyHfScale(mTempSamples[0], hfscale, todo); - MixSamples(mTempSamples[0], numOutput, samplesOut, mEarly.CurrentGain[c], + MixSamples(mTempSamples[0], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mEarly.CurrentGain[c], mEarly.PanGain[c], todo, 0, todo); } @@ -434,7 +435,8 @@ struct ReverbState final : public EffectState { const ALfloat hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; mAmbiSplitter[1][c].applyHfScale(mTempSamples[0], hfscale, todo); - MixSamples(mTempSamples[0], numOutput, samplesOut, mLate.CurrentGain[c], + MixSamples(mTempSamples[0], numOutput, + &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(samplesOut[0]), mLate.CurrentGain[c], mLate.PanGain[c], todo, 0, todo); } } @@ -448,7 +450,7 @@ struct ReverbState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) override; + void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) override; DEF_NEWDEL(ReverbState) }; @@ -1444,7 +1446,7 @@ void LateReverb_Faded(ReverbState *State, const ALsizei offset, const ALsizei to VectorScatterRevDelayIn(late_delay, offset, mixX, mixY, base, out, todo); } -void ReverbState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput) +void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, FloatBufferLine *RESTRICT samplesOut, const ALsizei numOutput) { ALsizei fadeCount{mFadeCount}; @@ -1455,7 +1457,9 @@ void ReverbState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(std::begin(afmt[c]), samplesToDo, 0.0f); - MixRowSamples(afmt[c], B2A[c], samplesIn, numInput, 0, samplesToDo); + MixRowSamples(afmt[c], B2A[c], + &reinterpret_cast<const ALfloat(&)[BUFFERSIZE]>(samplesIn[0]), numInput, 0, + samplesToDo); /* Band-pass the incoming samples. */ mFilter[c].Lp.process(afmt[c], afmt[c], samplesToDo); |