Combine EffectState::deviceUpdate with setBuffer

This commit is contained in:
Chris Robinson 2020-12-26 12:33:00 -08:00
parent 54719de132
commit 507cbfa027
17 changed files with 33 additions and 45 deletions

View File

@ -655,7 +655,7 @@ START_API_FUNC
FPUCtl mixer_mode{};
auto *state = slot->Effect.State.get();
state->setBuffer(device, buffer);
state->deviceUpdate(device, buffer);
}
break;
@ -935,9 +935,7 @@ ALenum ALeffectslot::initEffect(ALeffect *effect, ALCcontext *context)
State->mOutTarget = Device->Dry.Buffer;
{
FPUCtl mixer_mode{};
State->deviceUpdate(Device);
if(Buffer)
State->setBuffer(Device, Buffer);
State->deviceUpdate(Device, Buffer);
}
Effect.Type = newtype;

View File

@ -2117,9 +2117,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
EffectState *state{slot->Effect.State.get()};
state->mOutTarget = device->Dry.Buffer;
state->deviceUpdate(device);
if(ALbuffer *buffer{slot->Buffer})
state->setBuffer(device, buffer);
state->deviceUpdate(device, slot->Buffer);
slot->updateProps(context);
}
@ -2138,9 +2136,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
EffectState *state{slot->Effect.State.get()};
state->mOutTarget = device->Dry.Buffer;
state->deviceUpdate(device);
if(ALbuffer *buffer{slot->Buffer})
state->setBuffer(device, buffer);
state->deviceUpdate(device, slot->Buffer);
slot->updateProps(context);
}
}

View File

@ -69,7 +69,7 @@ struct AutowahState final : public EffectState {
alignas(16) float mBufferOut[BufferLineSize];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *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 AutowahState final : public EffectState {
DEF_NEWDEL(AutowahState)
};
void AutowahState::deviceUpdate(const ALCdevice*)
void AutowahState::deviceUpdate(const ALCdevice*, const BufferStorage* /*buffer*/)
{
/* (Re-)initializing parameters and clear the buffers. */

View File

@ -169,8 +169,7 @@ struct EffectState : public al::intrusive_ref<EffectState> {
virtual ~EffectState() = default;
virtual void deviceUpdate(const ALCdevice *device) = 0;
virtual void setBuffer(const ALCdevice* /*device*/, const BufferStorage* /*buffer*/) { }
virtual void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) = 0;
virtual void update(const ALCcontext *context, const EffectSlot *slot,
const EffectProps *props, const EffectTarget target) = 0;
virtual void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,

View File

@ -68,7 +68,7 @@ struct ChorusState final : public EffectState {
void getTriangleDelays(uint (*delays)[MAX_UPDATE_SAMPLES], const size_t todo);
void getSinusoidDelays(uint (*delays)[MAX_UPDATE_SAMPLES], const size_t todo);
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -77,7 +77,7 @@ struct ChorusState final : public EffectState {
DEF_NEWDEL(ChorusState)
};
void ChorusState::deviceUpdate(const ALCdevice *Device)
void ChorusState::deviceUpdate(const ALCdevice *Device, const BufferStorage* /*buffer*/)
{
constexpr float max_delay{maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY)};

View File

@ -49,7 +49,7 @@ struct CompressorState final : public EffectState {
float mEnvFollower{1.0f};
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -58,7 +58,7 @@ struct CompressorState final : public EffectState {
DEF_NEWDEL(CompressorState)
};
void CompressorState::deviceUpdate(const ALCdevice *device)
void CompressorState::deviceUpdate(const ALCdevice *device, const BufferStorage* /*buffer*/)
{
/* Number of samples to do a full attack and release (non-integer sample
* counts are okay).

View File

@ -174,8 +174,7 @@ struct ConvolutionState final : public EffectState {
void (ConvolutionState::*mMix)(const al::span<FloatBufferLine>,const size_t)
{&ConvolutionState::NormalMix};
void deviceUpdate(const ALCdevice *device) override;
void setBuffer(const ALCdevice *device, const BufferStorage *buffer) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -204,11 +203,7 @@ void ConvolutionState::UpsampleMix(const al::span<FloatBufferLine> samplesOut,
}
void ConvolutionState::deviceUpdate(const ALCdevice* /*device*/)
{
}
void ConvolutionState::setBuffer(const ALCdevice *device, const BufferStorage *buffer)
void ConvolutionState::deviceUpdate(const ALCdevice *device, const BufferStorage *buffer)
{
constexpr uint MaxConvolveAmbiOrder{1u};

View File

@ -37,7 +37,7 @@ struct DedicatedState final : public EffectState {
float mTargetGains[MAX_OUTPUT_CHANNELS];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -46,7 +46,7 @@ struct DedicatedState final : public EffectState {
DEF_NEWDEL(DedicatedState)
};
void DedicatedState::deviceUpdate(const ALCdevice*)
void DedicatedState::deviceUpdate(const ALCdevice*, const BufferStorage*)
{
std::fill(std::begin(mCurrentGains), std::end(mCurrentGains), 0.0f);
}

View File

@ -45,7 +45,7 @@ struct DistortionState final : public EffectState {
float mBuffer[2][BufferLineSize]{};
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -54,7 +54,7 @@ struct DistortionState final : public EffectState {
DEF_NEWDEL(DistortionState)
};
void DistortionState::deviceUpdate(const ALCdevice*)
void DistortionState::deviceUpdate(const ALCdevice*, const BufferStorage*)
{
mLowpass.clear();
mBandpass.clear();

View File

@ -57,7 +57,7 @@ struct EchoState final : public EffectState {
alignas(16) float mTempBuffer[2][BufferLineSize];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -66,7 +66,7 @@ struct EchoState final : public EffectState {
DEF_NEWDEL(EchoState)
};
void EchoState::deviceUpdate(const ALCdevice *Device)
void EchoState::deviceUpdate(const ALCdevice *Device, const BufferStorage* /*buffer*/)
{
const auto frequency = static_cast<float>(Device->Frequency);

View File

@ -90,7 +90,7 @@ struct EqualizerState final : public EffectState {
FloatBufferLine mSampleBuffer{};
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -99,7 +99,7 @@ struct EqualizerState final : public EffectState {
DEF_NEWDEL(EqualizerState)
};
void EqualizerState::deviceUpdate(const ALCdevice*)
void EqualizerState::deviceUpdate(const ALCdevice*, const BufferStorage*)
{
for(auto &e : mChans)
{

View File

@ -81,7 +81,7 @@ struct FshifterState final : public EffectState {
} mGains[2];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *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 FshifterState final : public EffectState {
DEF_NEWDEL(FshifterState)
};
void FshifterState::deviceUpdate(const ALCdevice*)
void FshifterState::deviceUpdate(const ALCdevice*, const BufferStorage*)
{
/* (Re-)initializing parameters and clear the buffers. */
mCount = FIFO_LATENCY;

View File

@ -81,7 +81,7 @@ struct ModulatorState final : public EffectState {
} mChans[MaxAmbiChannels];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *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 ModulatorState final : public EffectState {
DEF_NEWDEL(ModulatorState)
};
void ModulatorState::deviceUpdate(const ALCdevice*)
void ModulatorState::deviceUpdate(const ALCdevice*, const BufferStorage*)
{
for(auto &e : mChans)
{

View File

@ -15,7 +15,7 @@ struct NullState final : public EffectState {
NullState();
~NullState() override;
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -39,7 +39,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 ALCdevice* /*device*/)
void NullState::deviceUpdate(const ALCdevice* /*device*/, const BufferStorage* /*buffer*/)
{
}

View File

@ -91,7 +91,7 @@ struct PshifterState final : public EffectState {
float mTargetGains[MAX_OUTPUT_CHANNELS];
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -100,7 +100,7 @@ struct PshifterState final : public EffectState {
DEF_NEWDEL(PshifterState)
};
void PshifterState::deviceUpdate(const ALCdevice* /*device*/)
void PshifterState::deviceUpdate(const ALCdevice* /*device*/, const BufferStorage* /*buffer*/)
{
/* (Re-)initializing parameters and clear the buffers. */
mCount = FIFO_LATENCY;

View File

@ -527,7 +527,7 @@ struct ReverbState final : public EffectState {
void lateFaded(const size_t offset, const size_t todo, const float fade,
const float fadeStep);
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -607,7 +607,7 @@ void ReverbState::allocLines(const float frequency)
mLate.Delay.realizeLineOffset(mSampleBuffer.data());
}
void ReverbState::deviceUpdate(const ALCdevice *device)
void ReverbState::deviceUpdate(const ALCdevice *device, const BufferStorage* /*buffer*/)
{
const auto frequency = static_cast<float>(device->Frequency);

View File

@ -136,7 +136,7 @@ struct VmorpherState final : public EffectState {
alignas(16) float mSampleBufferB[MAX_UPDATE_SAMPLES]{};
alignas(16) float mLfo[MAX_UPDATE_SAMPLES]{};
void deviceUpdate(const ALCdevice *device) override;
void deviceUpdate(const ALCdevice *device, const BufferStorage *buffer) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
const EffectTarget target) override;
void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
@ -200,7 +200,7 @@ std::array<FormantFilter,4> VmorpherState::getFiltersByPhoneme(VMorpherPhenome p
}
void VmorpherState::deviceUpdate(const ALCdevice* /*device*/)
void VmorpherState::deviceUpdate(const ALCdevice* /*device*/, const BufferStorage* /*buffer*/)
{
for(auto &e : mChans)
{