diff options
-rw-r--r-- | Alc/ALu.c | 12 | ||||
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 2 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 4 |
4 files changed, 15 insertions, 5 deletions
@@ -92,7 +92,6 @@ typedef long long ALint64; #define __min min #endif -#define BUFFERSIZE 24000 #define FRACTIONBITS 14 #define FRACTIONMASK ((1L<<FRACTIONBITS)-1) #define MAX_PITCH 65536 @@ -894,7 +893,8 @@ static __inline ALshort lerp(ALshort val1, ALshort val2, ALint frac) ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum format) { static float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS]; - static float WetBuffer[BUFFERSIZE]; + static float DummyBuffer[BUFFERSIZE]; + ALfloat *WetBuffer = NULL; ALfloat (*Matrix)[OUTPUTCHANNELS] = ALContext->ChannelMatrix; ALfloat newDrySend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; ALfloat newWetSend = 0.0f; @@ -963,7 +963,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma rampLength = max(rampLength, SamplesToDo); //Clear mixing buffer - memset(WetBuffer, 0, SamplesToDo*sizeof(ALfloat)); memset(DryBuffer, 0, SamplesToDo*OUTPUTCHANNELS*sizeof(ALfloat)); //Actual mixing loop @@ -997,6 +996,9 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma //Get source info DryFilter = &ALSource->iirFilter; WetFilter = &ALSource->Send[0].iirFilter; + WetBuffer = (ALSource->Send[0].Slot ? + ALSource->Send[0].Slot->WetBuffer : + DummyBuffer); DrySend = ALSource->DryGains; WetSend = &ALSource->WetGain; @@ -1339,8 +1341,10 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma while(ALEffectSlot) { if(ALEffectSlot->effect.type == AL_EFFECT_REVERB) - VerbProcess(ALEffectSlot->ReverbState, SamplesToDo, WetBuffer, DryBuffer); + VerbProcess(ALEffectSlot->ReverbState, SamplesToDo, ALEffectSlot->WetBuffer, DryBuffer); + for(i = 0;i < SamplesToDo;i++) + ALEffectSlot->WetBuffer[i] = 0.0f; ALEffectSlot = ALEffectSlot->next; } diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index cc5b9d34..a818bb47 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -25,6 +25,8 @@ typedef struct ALeffectslot ALverbState *ReverbState; + ALfloat WetBuffer[BUFFERSIZE]; + ALuint refcount; // Index to itself diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 913b0a51..7c6e95b7 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -22,6 +22,8 @@ enum { OUTPUTCHANNELS }; +#define BUFFERSIZE 24000 + extern ALboolean DuplicateStereo; __inline ALuint aluBytesFromFormat(ALenum format); diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index dd524f02..65db34b3 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -38,7 +38,7 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { ALCcontext *Context; - ALsizei i; + ALsizei i, j; Context = alcGetCurrentContext(); if(!Context) @@ -74,6 +74,8 @@ ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) (*list)->Gain = 1.0; (*list)->AuxSendAuto = AL_TRUE; + for(j = 0;j < BUFFERSIZE;j++) + (*list)->WetBuffer[j] = 0.0f; (*list)->refcount = 0; effectslots[i] = (ALuint)ALTHUNK_ADDENTRY(*list); |