diff options
-rw-r--r-- | Alc/mixer.c | 4 | ||||
-rw-r--r-- | Alc/mixer_c.c | 14 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 15 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 14 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 14 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 24 |
6 files changed, 44 insertions, 41 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index e5ee4a45..e90bb482 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -374,7 +374,9 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) DoFilters(&sendparms->LpFilter[chan], &sendparms->HpFilter[chan], SrcData, ResampledData, DstBufferSize, sendparms->Filters[chan]); - src->WetMix(sendparms, SrcData, OutPos, DstBufferSize); + src->WetMix(sendparms->OutBuffer, SrcData, &sendparms->Gain, + maxu(sendparms->Counter, OutPos) - OutPos, + OutPos, DstBufferSize); } } /* Update positions */ diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 700b326b..4cc76a0f 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -121,17 +121,15 @@ void MixDirect_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, } -void MixSend_C(SendParams *params, const ALfloat *restrict data, - ALuint OutPos, ALuint BufferSize) +void MixSend_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + MixGainMono *Gain, ALuint Counter, ALuint OutPos, ALuint BufferSize) { - ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; - ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALfloat WetSend, Step; { ALuint pos = 0; - WetSend = params->Gain.Current; - Step = params->Gain.Step; + WetSend = Gain->Current; + Step = Gain->Step; if(Step != 1.0f && Counter > 0) { for(;pos < BufferSize && pos < Counter;pos++) @@ -140,8 +138,8 @@ void MixSend_C(SendParams *params, const ALfloat *restrict data, WetSend *= Step; } if(pos == Counter) - WetSend = params->Gain.Target; - params->Gain.Current = WetSend; + WetSend = Gain->Target; + Gain->Current = WetSend; } if(!(WetSend > GAIN_SILENCE_THRESHOLD)) diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index 8f5375f4..b19a847c 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -5,9 +5,8 @@ #include "AL/al.h" #include "alMain.h" -struct SendParams; - struct MixGains; +struct MixGainMono; struct HrtfParams; struct HrtfState; @@ -27,7 +26,9 @@ void MixDirect_Hrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat * void MixDirect_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, struct MixGains *Gains, ALuint Counter, ALuint OutPos, ALuint BufferSize); -void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint); +void MixSend_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + struct MixGainMono *Gain, ALuint Counter, ALuint OutPos, + ALuint BufferSize); /* SSE mixers */ void MixDirect_Hrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, @@ -37,7 +38,9 @@ void MixDirect_Hrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat void MixDirect_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, struct MixGains *Gains, ALuint Counter, ALuint OutPos, ALuint BufferSize); -void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint); +void MixSend_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + struct MixGainMono *Gain, ALuint Counter, ALuint OutPos, + ALuint BufferSize); /* Neon mixers */ void MixDirect_Hrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, @@ -47,6 +50,8 @@ void MixDirect_Hrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloa void MixDirect_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, struct MixGains *Gains, ALuint Counter, ALuint OutPos, ALuint BufferSize); -void MixSend_Neon(struct SendParams*,const ALfloat*restrict,ALuint,ALuint); +void MixSend_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + struct MixGainMono *Gain, ALuint Counter, ALuint OutPos, + ALuint BufferSize); #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 1fc56e53..6a0421a5 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -118,18 +118,16 @@ void MixDirect_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *da } -void MixSend_Neon(SendParams *params, const ALfloat *restrict data, - ALuint OutPos, ALuint BufferSize) +void MixSend_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + MixGainMono *Gain, ALuint Counter, ALuint OutPos, ALuint BufferSize) { - ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; - ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALfloat WetGain, Step; float32x4_t gain; { ALuint pos = 0; - WetGain = params->Gain.Current; - Step = params->Gain.Step; + WetGain = Gain->Current; + Step = Gain->Step; if(Step != 1.0f && Counter > 0) { for(;pos < BufferSize && pos < Counter;pos++) @@ -138,8 +136,8 @@ void MixSend_Neon(SendParams *params, const ALfloat *restrict data, WetGain *= Step; } if(pos == Counter) - WetGain = params->Gain.Target; - params->Gain.Current = WetGain; + WetGain = Gain->Target; + Gain->Current = WetGain; for(;pos < BufferSize && (pos&3) != 0;pos++) OutBuffer[0][OutPos+pos] += data[pos]*WetGain; } diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 21234f0f..d26866a9 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -202,18 +202,16 @@ void MixDirect_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *dat } -void MixSend_SSE(SendParams *params, const ALfloat *restrict data, - ALuint OutPos, ALuint BufferSize) +void MixSend_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + MixGainMono *Gain, ALuint Counter, ALuint OutPos, ALuint BufferSize) { - ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; - ALuint Counter = maxu(params->Counter, OutPos) - OutPos; ALfloat WetGain, Step; __m128 gain, step; { ALuint pos = 0; - WetGain = params->Gain.Current; - Step = params->Gain.Step; + WetGain = Gain->Current; + Step = Gain->Step; if(Step != 1.0f && Counter > 0) { if(BufferSize-pos > 3 && Counter-pos > 3) @@ -241,8 +239,8 @@ void MixSend_SSE(SendParams *params, const ALfloat *restrict data, WetGain *= Step; } if(pos == Counter) - WetGain = params->Gain.Target; - params->Gain.Current = WetGain; + WetGain = Gain->Target; + Gain->Current = WetGain; for(;pos < BufferSize && (pos&3) != 0;pos++) OutBuffer[0][OutPos+pos] += data[pos]*WetGain; } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 432e9bd3..4d0beb38 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -66,6 +66,12 @@ typedef struct MixGains { ALfloat Target[MaxChannels]; } MixGains; +typedef struct MixGainMono { + ALfloat Current; + ALfloat Step; + ALfloat Target; +} MixGainMono; + typedef struct DirectParams { ALfloat (*OutBuffer)[BUFFERSIZE]; @@ -106,27 +112,23 @@ typedef struct SendParams { /* Gain control, which applies to all input channels to a single (mono) * output buffer. */ - struct { - ALfloat Current; - ALfloat Step; - ALfloat Target; - } Gain; + MixGainMono Gain; } SendParams; typedef void (*ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -typedef ALvoid (*DryMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, - MixGains *Gains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); +typedef void (*DryMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + MixGains *Gains, ALuint Counter, ALuint OutPos, + ALuint BufferSize); typedef void (*HrtfMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, ALuint Counter, ALuint Offset, const ALuint IrSize, const HrtfParams *hrtfparams, HrtfState *hrtfstate, ALuint OutPos, ALuint BufferSize); -typedef ALvoid (*WetMixerFunc)(struct SendParams *params, - const ALfloat *restrict data, - ALuint OutPos, ALuint BufferSize); +typedef void (*WetMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + MixGainMono *Gain, ALuint Counter, ALuint OutPos, + ALuint BufferSize); #define GAIN_SILENCE_THRESHOLD (0.00001f) /* -100dB */ |