From ce575718ef495c3c146d7a1b443ce556014e057f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 17 Mar 2016 10:10:26 -0700 Subject: Store the effect's output buffer in the effect state --- Alc/ALc.c | 7 ++++++- Alc/ALu.c | 10 +++++----- OpenAL32/Include/alAuxEffectSlot.h | 3 +++ OpenAL32/alAuxEffectSlot.c | 2 ++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index f22cb7c1..091a5473 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -2170,6 +2170,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { ALeffectslot *slot = context->EffectSlotMap.array[pos].value; + slot->EffectState->OutBuffer = device->Dry.Buffer; + slot->EffectState->OutChannels = device->Dry.NumChannels; if(V(slot->EffectState,deviceUpdate)(device) == AL_FALSE) { UnlockUIntMapRead(&context->EffectSlotMap); @@ -2217,8 +2219,11 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(device->DefaultSlot) { ALeffectslot *slot = device->DefaultSlot; + ALeffectState *state = slot->EffectState; - if(V(slot->EffectState,deviceUpdate)(device) == AL_FALSE) + state->OutBuffer = device->Dry.Buffer; + state->OutChannels = device->Dry.NumChannels; + if(V(state,deviceUpdate)(device) == AL_FALSE) { V0(device->Backend,unlock)(); RestoreFPUMode(&oldMode); diff --git a/Alc/ALu.c b/Alc/ALu.c index 5064a588..55ed84dc 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -1417,8 +1417,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { const ALeffectslot *slot = VECTOR_ELEM(ctx->ActiveAuxSlots, i); ALeffectState *state = slot->EffectState; - V(state,process)(SamplesToDo, slot->WetBuffer, device->Dry.Buffer, - device->Dry.NumChannels); + V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, + state->OutChannels); } ctx = ctx->next; @@ -1428,8 +1428,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { const ALeffectslot *slot = device->DefaultSlot; ALeffectState *state = slot->EffectState; - V(state,process)(SamplesToDo, slot->WetBuffer, device->Dry.Buffer, - device->Dry.NumChannels); + V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, + state->OutChannels); } /* Increment the clock time. Every second's worth of samples is @@ -1503,7 +1503,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) if(buffer) { ALfloat (*OutBuffer)[BUFFERSIZE] = device->RealOut.Buffer; - ALuint OutChannels = device->RealOut.NumChannels;; + ALuint OutChannels = device->RealOut.NumChannels; #define WRITE(T, a, b, c, d) do { \ Write_##T((a), (b), (c), (d)); \ diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 3f677fd1..2c9a83e5 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -15,6 +15,9 @@ struct ALeffectslot; typedef struct ALeffectState { const struct ALeffectStateVtable *vtbl; + + ALfloat (*OutBuffer)[BUFFERSIZE]; + ALuint OutChannels; } ALeffectState; struct ALeffectStateVtable { diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index b0dba25d..c80bab22 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -464,6 +464,8 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e SetMixerFPUMode(&oldMode); ALCdevice_Lock(Device); + State->OutBuffer = Device->Dry.Buffer; + State->OutChannels = Device->Dry.NumChannels; if(V(State,deviceUpdate)(Device) == AL_FALSE) { ALCdevice_Unlock(Device); -- cgit v1.2.3