diff options
-rw-r--r-- | Alc/ALu.c | 4 | ||||
-rw-r--r-- | Alc/effects/autowah.c | 6 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 8 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 6 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 6 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 6 | ||||
-rw-r--r-- | Alc/effects/echo.c | 8 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 6 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 8 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 14 | ||||
-rw-r--r-- | Alc/effects/null.c | 5 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 20 | ||||
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 4 |
14 files changed, 53 insertions, 52 deletions
@@ -1179,7 +1179,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) V((*slot)->EffectState,update)(device, *slot); V((*slot)->EffectState,process)(SamplesToDo, (*slot)->WetBuffer[0], - device->DryBuffer); + device->DryBuffer, device->NumChannels); for(i = 0;i < SamplesToDo;i++) (*slot)->WetBuffer[0][i] = 0.0f; @@ -1197,7 +1197,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) V((*slot)->EffectState,update)(device, *slot); V((*slot)->EffectState,process)(SamplesToDo, (*slot)->WetBuffer[0], - device->DryBuffer); + device->DryBuffer, device->NumChannels); for(i = 0;i < SamplesToDo;i++) (*slot)->WetBuffer[0][i] = 0.0f; diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 8caf1fcc..6f16743d 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -78,7 +78,7 @@ static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *device, co ComputeAmbientGains(device, slot->Gain, state->Gain); } -static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE]) +static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALuint it, kt; ALuint base; @@ -135,10 +135,10 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, } state->GainCtrl = gain; - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 0dde134a..02887fde 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -203,7 +203,7 @@ DECL_TEMPLATE(Sinusoid) #undef DECL_TEMPLATE -static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALuint it, kt; ALuint base; @@ -223,17 +223,17 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, co break; } - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[0][kt]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(it = 0;it < td;it++) SamplesOut[kt][it+base] += temps[it][0] * gain; } gain = state->Gain[1][kt]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(it = 0;it < td;it++) SamplesOut[kt][it+base] += temps[it][1] * gain; diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index ab88ecf0..f9964427 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -62,7 +62,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, ALCdevice *devi ComputeAmbientGains(device, slot->Gain, state->Gain); } -static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE]) +static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALuint it, kt; ALuint base; @@ -116,10 +116,10 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples } - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 2d955888..e09cc682 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -75,14 +75,14 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, ALCdevice *device } } -static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { const ALfloat *gains = state->gains; ALuint i, c; - for(c = 0;c < MAX_OUTPUT_CHANNELS;c++) + for(c = 0;c < NumChannels;c++) { - if(!(gains[c] > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gains[c]) > GAIN_SILENCE_THRESHOLD)) continue; for(i = 0;i < SamplesToDo;i++) diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 9474f3ae..7098cdf9 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -84,7 +84,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi ComputeAmbientGains(Device, Slot->Gain, state->Gain); } -static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { const ALfloat fc = state->edge_coeff; float oversample_buffer[64][4]; @@ -154,10 +154,10 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples temps[it] = oversample_buffer[it][0] * state->attenuation; } - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index d6c62a30..fd85bdb0 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -109,7 +109,7 @@ static ALvoid ALechoState_update(ALechoState *state, ALCdevice *Device, const AL ComputeDirectionalGains(Device, pandir, gain, state->Gain[1]); } -static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { const ALuint mask = state->BufferLength-1; const ALuint tap1 = state->Tap[0].delay; @@ -138,17 +138,17 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const offset++; } - for(k = 0;k < MAX_OUTPUT_CHANNELS;k++) + for(k = 0;k < NumChannels;k++) { ALfloat gain = state->Gain[0][k]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(i = 0;i < td;i++) SamplesOut[k][i+base] += temps[i][0] * gain; } gain = state->Gain[1][k]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(i = 0;i < td;i++) SamplesOut[k][i+base] += temps[i][1] * gain; diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index dc02e9b0..7caec266 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -118,7 +118,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, ALCdevice *device 0.0f); } -static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALuint base; ALuint it; @@ -140,10 +140,10 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo temps[it] = smp; } - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index e5a49a43..460bb866 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -203,7 +203,7 @@ DECL_TEMPLATE(Sinusoid) #undef DECL_TEMPLATE -static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALuint it, kt; ALuint base; @@ -223,17 +223,17 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, break; } - for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++) + for(kt = 0;kt < NumChannels;kt++) { ALfloat gain = state->Gain[0][kt]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(it = 0;it < td;it++) SamplesOut[kt][it+base] += temps[it][0] * gain; } gain = state->Gain[1][kt]; - if(gain > GAIN_SILENCE_THRESHOLD) + if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) { for(it = 0;it < td;it++) SamplesOut[kt][it+base] += temps[it][1] * gain; diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index c69a8a09..4d183449 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -69,7 +69,7 @@ static inline ALfloat Square(ALuint index) #define DECL_TEMPLATE(func) \ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ const ALfloat *restrict SamplesIn, \ - ALfloat (*restrict SamplesOut)[BUFFERSIZE]) \ + ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) \ { \ const ALuint step = state->step; \ ALuint index = state->index; \ @@ -92,10 +92,10 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ temps[i] = samp * func(index); \ } \ \ - for(k = 0;k < MAX_OUTPUT_CHANNELS;k++) \ + for(k = 0;k < NumChannels;k++) \ { \ ALfloat gain = state->Gain[k]; \ - if(!(gain > GAIN_SILENCE_THRESHOLD)) \ + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) \ continue; \ \ for(i = 0;i < td;i++) \ @@ -152,20 +152,20 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device ComputeAmbientGains(Device, Slot->Gain, state->Gain); } -static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { switch(state->Waveform) { case SINUSOID: - ProcessSin(state, SamplesToDo, SamplesIn, SamplesOut); + ProcessSin(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels); break; case SAWTOOTH: - ProcessSaw(state, SamplesToDo, SamplesIn, SamplesOut); + ProcessSaw(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels); break; case SQUARE: - ProcessSquare(state, SamplesToDo, SamplesIn, SamplesOut); + ProcessSquare(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels); break; } } diff --git a/Alc/effects/null.c b/Alc/effects/null.c index 6dacd021..adc4ca81 100644 --- a/Alc/effects/null.c +++ b/Alc/effects/null.c @@ -41,11 +41,8 @@ static ALvoid ALnullState_update(ALnullState* UNUSED(state), ALCdevice* UNUSED(d * input to the output buffer. The result should be added to the output buffer, * not replace it. */ -static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloat *restrict UNUSED(samplesIn), ALfloat (*restrict samplesOut)[BUFFERSIZE]) +static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloat *restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels)) { - /* NOTE: Couldn't use the UNUSED macro on samplesOut due to the way GCC's - * __attribute__ declaration interacts with the parenthesis. */ - (void)samplesOut; } /* This allocates memory to store the object, before it gets constructed. diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index e1b47ec2..95957737 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -556,7 +556,7 @@ static inline ALvoid EAXVerbPass(ALreverbState *State, ALfloat in, ALfloat *rest State->Offset++; } -static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALfloat (*restrict out)[4] = State->ReverbSamples; ALuint index, c; @@ -565,10 +565,10 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples for(index = 0;index < SamplesToDo;index++) VerbPass(State, SamplesIn[index], out[index]); - for(c = 0;c < MAX_OUTPUT_CHANNELS;c++) + for(c = 0;c < NumChannels;c++) { ALfloat gain = State->Gain[c]; - if(!(gain > GAIN_SILENCE_THRESHOLD)) + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(index = 0;index < SamplesToDo;index++) @@ -576,7 +576,7 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples } } -static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { ALfloat (*restrict early)[4] = State->EarlySamples; ALfloat (*restrict late)[4] = State->ReverbSamples; @@ -586,18 +586,18 @@ static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, for(index = 0;index < SamplesToDo;index++) EAXVerbPass(State, SamplesIn[index], early[index], late[index]); - for(c = 0;c < MAX_OUTPUT_CHANNELS;c++) + for(c = 0;c < NumChannels;c++) { ALfloat earlyGain, lateGain; earlyGain = State->Early.PanGain[c]; - if(earlyGain > GAIN_SILENCE_THRESHOLD) + if(fabsf(earlyGain) > GAIN_SILENCE_THRESHOLD) { for(index = 0;index < SamplesToDo;index++) SamplesOut[c][index] += earlyGain*early[index][c&3]; } lateGain = State->Late.PanGain[c]; - if(lateGain > GAIN_SILENCE_THRESHOLD) + if(fabsf(lateGain) > GAIN_SILENCE_THRESHOLD) { for(index = 0;index < SamplesToDo;index++) SamplesOut[c][index] += lateGain*late[index][c&3]; @@ -605,12 +605,12 @@ static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, } } -static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) +static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { if(State->IsEax) - ALreverbState_processEax(State, SamplesToDo, SamplesIn, SamplesOut); + ALreverbState_processEax(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); else - ALreverbState_processStandard(State, SamplesToDo, SamplesIn, SamplesOut); + ALreverbState_processStandard(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); } // Given the allocated sample buffer, this function updates each delay line diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 286aa95d..0f0d3ef8 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -22,7 +22,7 @@ struct ALeffectStateVtable { ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device); void (*const update)(ALeffectState *state, ALCdevice *device, const struct ALeffectslot *slot); - void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]); + void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels); void (*const Delete)(void *ptr); }; @@ -31,7 +31,7 @@ struct ALeffectStateVtable { DECLARE_THUNK(T, ALeffectState, void, Destruct) \ DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ DECLARE_THUNK2(T, ALeffectState, void, update, ALCdevice*, const ALeffectslot*) \ -DECLARE_THUNK3(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict) \ +DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \ static void T##_ALeffectState_Delete(void *ptr) \ { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \ \ diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a592ef52..297919c8 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -382,6 +382,10 @@ static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \ static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \ { return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c); } +#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c, d); } + #define DECLARE_DEFAULT_ALLOCATORS(T) \ static void* T##_New(size_t size) { return al_malloc(16, size); } \ static void T##_Delete(void *ptr) { al_free(ptr); } |