diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 9 | ||||
-rw-r--r-- | alc/effects/autowah.cpp | 4 | ||||
-rw-r--r-- | alc/effects/chorus.cpp | 4 | ||||
-rw-r--r-- | alc/effects/compressor.cpp | 4 | ||||
-rw-r--r-- | alc/effects/convolution.cpp | 44 | ||||
-rw-r--r-- | alc/effects/dedicated.cpp | 4 | ||||
-rw-r--r-- | alc/effects/distortion.cpp | 4 | ||||
-rw-r--r-- | alc/effects/echo.cpp | 4 | ||||
-rw-r--r-- | alc/effects/equalizer.cpp | 4 | ||||
-rw-r--r-- | alc/effects/fshifter.cpp | 4 | ||||
-rw-r--r-- | alc/effects/modulator.cpp | 4 | ||||
-rw-r--r-- | alc/effects/null.cpp | 4 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 4 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 4 | ||||
-rw-r--r-- | alc/effects/vmorpher.cpp | 4 |
15 files changed, 49 insertions, 56 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index eb3873f2..af8ff55d 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2318,11 +2318,6 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) { auto *context = static_cast<ALCcontext*>(ctxbase); - auto GetEffectBuffer = [](ALbuffer *buffer) noexcept -> EffectState::Buffer - { - if(!buffer) return EffectState::Buffer{}; - return EffectState::Buffer{buffer, buffer->mData}; - }; std::unique_lock<std::mutex> proplock{context->mPropLock}; std::unique_lock<std::mutex> slotlock{context->mEffectSlotLock}; @@ -2359,7 +2354,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) EffectState *state{slot->Effect.State.get()}; state->mOutTarget = device->Dry.Buffer; - state->deviceUpdate(device, GetEffectBuffer(slot->Buffer)); + state->deviceUpdate(device, slot->Buffer); slot->updateProps(context); } @@ -2378,7 +2373,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) EffectState *state{slot->Effect.State.get()}; state->mOutTarget = device->Dry.Buffer; - state->deviceUpdate(device, GetEffectBuffer(slot->Buffer)); + state->deviceUpdate(device, slot->Buffer); slot->updateProps(context); } } diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index f32c69b8..4f874ef2 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -81,7 +81,7 @@ struct AutowahState final : public EffectState { alignas(16) float mBufferOut[BufferLineSize]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -90,7 +90,7 @@ struct AutowahState final : public EffectState { DEF_NEWDEL(AutowahState) }; -void AutowahState::deviceUpdate(const DeviceBase*, const Buffer&) +void AutowahState::deviceUpdate(const DeviceBase*, const BufferStorage*) { /* (Re-)initializing parameters and clear the buffers. */ diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index 4997a448..10ccf9f6 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -78,7 +78,7 @@ struct ChorusState final : public EffectState { void calcTriangleDelays(const size_t todo); void calcSinusoidDelays(const size_t todo); - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -87,7 +87,7 @@ struct ChorusState final : public EffectState { DEF_NEWDEL(ChorusState) }; -void ChorusState::deviceUpdate(const DeviceBase *Device, const Buffer&) +void ChorusState::deviceUpdate(const DeviceBase *Device, const BufferStorage*) { constexpr float max_delay{maxf(ChorusMaxDelay, FlangerMaxDelay)}; diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index 299394cf..0a7ed67a 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -76,7 +76,7 @@ struct CompressorState final : public EffectState { float mEnvFollower{1.0f}; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -85,7 +85,7 @@ struct CompressorState final : public EffectState { DEF_NEWDEL(CompressorState) }; -void CompressorState::deviceUpdate(const DeviceBase *device, const Buffer&) +void CompressorState::deviceUpdate(const DeviceBase *device, const BufferStorage*) { /* Number of samples to do a full attack and release (non-integer sample * counts are okay). diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp index e526e009..7f36c415 100644 --- a/alc/effects/convolution.cpp +++ b/alc/effects/convolution.cpp @@ -217,7 +217,7 @@ struct ConvolutionState final : public EffectState { void (ConvolutionState::*mMix)(const al::span<FloatBufferLine>,const size_t) {&ConvolutionState::NormalMix}; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -246,7 +246,7 @@ void ConvolutionState::UpsampleMix(const al::span<FloatBufferLine> samplesOut, } -void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buffer) +void ConvolutionState::deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) { using UhjDecoderType = UhjDecoder<512>; static constexpr auto DecoderPadding = UhjDecoderType::sInputPadding; @@ -266,16 +266,16 @@ void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buff mComplexData = nullptr; /* An empty buffer doesn't need a convolution filter. */ - if(!buffer.storage || buffer.storage->mSampleLen < 1) return; + if(!buffer || buffer->mSampleLen < 1) return; - mChannels = buffer.storage->mChannels; - mAmbiLayout = IsUHJ(mChannels) ? AmbiLayout::FuMa : buffer.storage->mAmbiLayout; - mAmbiScaling = IsUHJ(mChannels) ? AmbiScaling::UHJ : buffer.storage->mAmbiScaling; - mAmbiOrder = minu(buffer.storage->mAmbiOrder, MaxConvolveAmbiOrder); + mChannels = buffer->mChannels; + mAmbiLayout = IsUHJ(mChannels) ? AmbiLayout::FuMa : buffer->mAmbiLayout; + mAmbiScaling = IsUHJ(mChannels) ? AmbiScaling::UHJ : buffer->mAmbiScaling; + mAmbiOrder = minu(buffer->mAmbiOrder, MaxConvolveAmbiOrder); constexpr size_t m{ConvolveUpdateSize/2 + 1}; - const auto bytesPerSample = BytesFromFmt(buffer.storage->mType); - const auto realChannels = buffer.storage->channelsFromFmt(); + const auto bytesPerSample = BytesFromFmt(buffer->mType); + const auto realChannels = buffer->channelsFromFmt(); const auto numChannels = (mChannels == FmtUHJ2) ? 3u : ChannelsFromFmt(mChannels, mAmbiOrder); mChans = ChannelDataArray::Create(numChannels); @@ -286,11 +286,11 @@ void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buff * called very infrequently, go ahead and use the polyphase resampler. */ PPhaseResampler resampler; - if(device->Frequency != buffer.storage->mSampleRate) - resampler.init(buffer.storage->mSampleRate, device->Frequency); + if(device->Frequency != buffer->mSampleRate) + resampler.init(buffer->mSampleRate, device->Frequency); const auto resampledCount = static_cast<uint>( - (uint64_t{buffer.storage->mSampleLen}*device->Frequency+(buffer.storage->mSampleRate-1)) / - buffer.storage->mSampleRate); + (uint64_t{buffer->mSampleLen}*device->Frequency+(buffer->mSampleRate-1)) / + buffer->mSampleRate); const BandSplitter splitter{device->mXOverFreq / static_cast<float>(device->Frequency)}; for(auto &e : *mChans) @@ -312,12 +312,12 @@ void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buff std::fill_n(mComplexData.get(), complex_length, complex_f{}); /* Load the samples from the buffer. */ - const size_t srclinelength{RoundUp(buffer.storage->mSampleLen+DecoderPadding, 16)}; + const size_t srclinelength{RoundUp(buffer->mSampleLen+DecoderPadding, 16)}; auto srcsamples = std::make_unique<float[]>(srclinelength * numChannels); std::fill_n(srcsamples.get(), srclinelength * numChannels, 0.0f); for(size_t c{0};c < numChannels && c < realChannels;++c) - LoadSamples(srcsamples.get() + srclinelength*c, buffer.samples.data() + bytesPerSample*c, - realChannels, buffer.storage->mType, buffer.storage->mSampleLen); + LoadSamples(srcsamples.get() + srclinelength*c, buffer->mData.data() + bytesPerSample*c, + realChannels, buffer->mType, buffer->mSampleLen); if(IsUHJ(mChannels)) { @@ -325,11 +325,10 @@ void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buff std::array<float*,4> samples{}; for(size_t c{0};c < numChannels;++c) samples[c] = srcsamples.get() + srclinelength*c; - decoder->decode({samples.data(), numChannels}, buffer.storage->mSampleLen, - buffer.storage->mSampleLen); + decoder->decode({samples.data(), numChannels}, buffer->mSampleLen, buffer->mSampleLen); } - auto ressamples = std::make_unique<double[]>(buffer.storage->mSampleLen + + auto ressamples = std::make_unique<double[]>(buffer->mSampleLen + (resampler ? resampledCount : 0)); complex_f *filteriter = mComplexData.get() + mNumConvolveSegs*m; for(size_t c{0};c < numChannels;++c) @@ -337,14 +336,13 @@ void ConvolutionState::deviceUpdate(const DeviceBase *device, const Buffer &buff /* Resample to match the device. */ if(resampler) { - std::copy_n(srcsamples.get() + srclinelength*c, buffer.storage->mSampleLen, + std::copy_n(srcsamples.get() + srclinelength*c, buffer->mSampleLen, ressamples.get() + resampledCount); - resampler.process(buffer.storage->mSampleLen, ressamples.get()+resampledCount, + resampler.process(buffer->mSampleLen, ressamples.get()+resampledCount, resampledCount, ressamples.get()); } else - std::copy_n(srcsamples.get() + srclinelength*c, buffer.storage->mSampleLen, - ressamples.get()); + std::copy_n(srcsamples.get() + srclinelength*c, buffer->mSampleLen, ressamples.get()); /* Store the first segment's samples in reverse in the time-domain, to * apply as a FIR filter. diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp index e666df9f..047e6761 100644 --- a/alc/effects/dedicated.cpp +++ b/alc/effects/dedicated.cpp @@ -51,7 +51,7 @@ struct DedicatedState final : public EffectState { float mTargetGains[MAX_OUTPUT_CHANNELS]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -60,7 +60,7 @@ struct DedicatedState final : public EffectState { DEF_NEWDEL(DedicatedState) }; -void DedicatedState::deviceUpdate(const DeviceBase*, const Buffer&) +void DedicatedState::deviceUpdate(const DeviceBase*, const BufferStorage*) { std::fill(std::begin(mCurrentGains), std::end(mCurrentGains), 0.0f); } diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp index 5e277619..b4e2167e 100644 --- a/alc/effects/distortion.cpp +++ b/alc/effects/distortion.cpp @@ -56,7 +56,7 @@ struct DistortionState final : public EffectState { alignas(16) float mBuffer[2][BufferLineSize]{}; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -65,7 +65,7 @@ struct DistortionState final : public EffectState { DEF_NEWDEL(DistortionState) }; -void DistortionState::deviceUpdate(const DeviceBase*, const Buffer&) +void DistortionState::deviceUpdate(const DeviceBase*, const BufferStorage*) { mLowpass.clear(); mBandpass.clear(); diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index 7f9edf82..a69529dc 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -69,7 +69,7 @@ struct EchoState final : public EffectState { alignas(16) float mTempBuffer[2][BufferLineSize]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -78,7 +78,7 @@ struct EchoState final : public EffectState { DEF_NEWDEL(EchoState) }; -void EchoState::deviceUpdate(const DeviceBase *Device, const Buffer&) +void EchoState::deviceUpdate(const DeviceBase *Device, const BufferStorage*) { const auto frequency = static_cast<float>(Device->Frequency); diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index 9d7cccef..50bec4ad 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -100,7 +100,7 @@ struct EqualizerState final : public EffectState { alignas(16) FloatBufferLine mSampleBuffer{}; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -109,7 +109,7 @@ struct EqualizerState final : public EffectState { DEF_NEWDEL(EqualizerState) }; -void EqualizerState::deviceUpdate(const DeviceBase*, const Buffer&) +void EqualizerState::deviceUpdate(const DeviceBase*, const BufferStorage*) { for(auto &e : mChans) { diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index 147f7d08..3e6a7385 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -97,7 +97,7 @@ struct FshifterState final : public EffectState { } mGains[2]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -106,7 +106,7 @@ struct FshifterState final : public EffectState { DEF_NEWDEL(FshifterState) }; -void FshifterState::deviceUpdate(const DeviceBase*, const Buffer&) +void FshifterState::deviceUpdate(const DeviceBase*, const BufferStorage*) { /* (Re-)initializing parameters and clear the buffers. */ mCount = 0; diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index 79993c0d..14ee5004 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -93,7 +93,7 @@ struct ModulatorState final : public EffectState { } mChans[MaxAmbiChannels]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -102,7 +102,7 @@ struct ModulatorState final : public EffectState { DEF_NEWDEL(ModulatorState) }; -void ModulatorState::deviceUpdate(const DeviceBase*, const Buffer&) +void ModulatorState::deviceUpdate(const DeviceBase*, const BufferStorage*) { for(auto &e : mChans) { diff --git a/alc/effects/null.cpp b/alc/effects/null.cpp index cda1420e..1f9ae67b 100644 --- a/alc/effects/null.cpp +++ b/alc/effects/null.cpp @@ -20,7 +20,7 @@ struct NullState final : public EffectState { NullState(); ~NullState() override; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -44,7 +44,7 @@ NullState::~NullState() = default; * format) have been changed. Will always be followed by a call to the update * method, if successful. */ -void NullState::deviceUpdate(const DeviceBase* /*device*/, const Buffer& /*buffer*/) +void NullState::deviceUpdate(const DeviceBase* /*device*/, const BufferStorage* /*buffer*/) { } diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index 731a5baf..426a2264 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -105,7 +105,7 @@ struct PshifterState final : public EffectState { float mTargetGains[MaxAmbiChannels]; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -114,7 +114,7 @@ struct PshifterState final : public EffectState { DEF_NEWDEL(PshifterState) }; -void PshifterState::deviceUpdate(const DeviceBase*, const Buffer&) +void PshifterState::deviceUpdate(const DeviceBase*, const BufferStorage*) { /* (Re-)initializing parameters and clear the buffers. */ mCount = 0; diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 83e1207e..3875bedb 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -622,7 +622,7 @@ struct ReverbState final : public EffectState { void allocLines(const float frequency); - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -717,7 +717,7 @@ void ReverbState::allocLines(const float frequency) } } -void ReverbState::deviceUpdate(const DeviceBase *device, const Buffer&) +void ReverbState::deviceUpdate(const DeviceBase *device, const BufferStorage*) { const auto frequency = static_cast<float>(device->Frequency); diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index 97267ad9..872c7add 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -163,7 +163,7 @@ struct VmorpherState final : public EffectState { alignas(16) float mSampleBufferB[MAX_UPDATE_SAMPLES]{}; alignas(16) float mLfo[MAX_UPDATE_SAMPLES]{}; - void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; + void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override; void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, @@ -227,7 +227,7 @@ std::array<FormantFilter,4> VmorpherState::getFiltersByPhoneme(VMorpherPhenome p } -void VmorpherState::deviceUpdate(const DeviceBase*, const Buffer&) +void VmorpherState::deviceUpdate(const DeviceBase*, const BufferStorage*) { for(auto &e : mChans) { |