diff options
author | Chris Robinson <[email protected]> | 2016-03-11 20:59:12 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-11 20:59:12 -0800 |
commit | 22abaa287d7c10fb1ae8ae34b32d5e0ebbbfad78 (patch) | |
tree | d2bc8ff92512024e5fefae19ca6ed6208ad1e61d /Alc/ALu.c | |
parent | 532897219326e5ee47eb08810734b2f2ed4409a3 (diff) |
Use the real output's left and right channels with HRTF
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -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 { |