aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-11 20:59:12 -0800
committerChris Robinson <[email protected]>2016-03-11 20:59:12 -0800
commit22abaa287d7c10fb1ae8ae34b32d5e0ebbbfad78 (patch)
treed2bc8ff92512024e5fefae19ca6ed6208ad1e61d /Alc/ALu.c
parent532897219326e5ee47eb08810734b2f2ed4409a3 (diff)
Use the real output's left and right channels with HRTF
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 17c91e52..d139cb7b 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1454,20 +1454,25 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
if(device->Hrtf)
{
- HrtfMixerFunc HrtfMix = SelectHrtfMixer();
- ALuint irsize = GetHrtfIrSize(device->Hrtf);
- MixHrtfParams hrtfparams;
- memset(&hrtfparams, 0, sizeof(hrtfparams));
- for(c = 0;c < device->VirtOut.NumChannels;c++)
+ int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
+ int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
+ if(lidx != -1 && ridx != -1)
{
- hrtfparams.Current = &device->Hrtf_Params[c];
- hrtfparams.Target = &device->Hrtf_Params[c];
- HrtfMix(device->RealOut.Buffer, device->VirtOut.Buffer[c], 0,
- device->Hrtf_Offset, 0, irsize, &hrtfparams,
- &device->Hrtf_State[c], SamplesToDo
- );
+ HrtfMixerFunc HrtfMix = SelectHrtfMixer();
+ ALuint irsize = GetHrtfIrSize(device->Hrtf);
+ MixHrtfParams hrtfparams;
+ memset(&hrtfparams, 0, sizeof(hrtfparams));
+ for(c = 0;c < device->VirtOut.NumChannels;c++)
+ {
+ hrtfparams.Current = &device->Hrtf_Params[c];
+ hrtfparams.Target = &device->Hrtf_Params[c];
+ HrtfMix(device->RealOut.Buffer, lidx, ridx,
+ device->VirtOut.Buffer[c], 0, device->Hrtf_Offset, 0,
+ irsize, &hrtfparams, &device->Hrtf_State[c], SamplesToDo
+ );
+ }
+ device->Hrtf_Offset += SamplesToDo;
}
- device->Hrtf_Offset += SamplesToDo;
}
else
{