diff options
author | Chris Robinson <[email protected]> | 2015-02-10 06:46:02 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-02-10 06:46:02 -0800 |
commit | b9e81794e40a3ddb25c56ebd20e3cb1ad18f3849 (patch) | |
tree | e2a2afb7d6f1728a467f2be18331e051a2f8c0f3 | |
parent | cf5856ed481009621882078727212e5da65e60ee (diff) |
Pass the (FuMa) channel number to GetBFormatHrtfCoeffs
-rw-r--r-- | Alc/hrtf.c | 13 | ||||
-rw-r--r-- | Alc/hrtf.h | 2 | ||||
-rw-r--r-- | Alc/panning.c | 5 |
3 files changed, 10 insertions, 10 deletions
@@ -313,7 +313,7 @@ ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat a /* Calculates HRTF coefficients for a B-Format channel (first order only). */ -void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALfloat ambi_coeffs[4], ALfloat (*coeffs)[2], ALuint *delays) +void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALuint chan_num, ALfloat (*coeffs)[2], ALuint *delays) { ALuint elev_idx, azi_idx; ALfloat scale; @@ -345,6 +345,7 @@ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALfloat ambi_coeffs[4], { ALuint lidx, ridx; ALfloat az; + ALfloat ambi_coeffs[4]; ALfloat x, y, z; ALfloat gain; @@ -363,12 +364,12 @@ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALfloat ambi_coeffs[4], y = sinf(-az) * cosf(elev); z = sinf(elev); - gain = 0.0f; - gain += ambi_coeffs[0]*0.7071f; /* sqrt(1.0 / 2.0) */ - gain += ambi_coeffs[1]*x; /* X */ - gain += ambi_coeffs[2]*y; /* Y */ - gain += ambi_coeffs[3]*z; /* Z */ + ambi_coeffs[0] = 0.7071f; /* sqrt(1.0 / 2.0) */ + ambi_coeffs[1] = x; /* X */ + ambi_coeffs[2] = y; /* Y */ + ambi_coeffs[3] = z; /* Z */ + gain = ambi_coeffs[chan_num]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; @@ -23,6 +23,6 @@ void FreeHrtfs(void); ALuint GetHrtfIrSize(const struct Hrtf *Hrtf); void GetLerpedHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat dirfact, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays); ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat dirfact, ALfloat gain, ALfloat delta, ALint counter, ALfloat (*coeffs)[2], ALuint *delays, ALfloat (*coeffStep)[2], ALint *delayStep); -void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALfloat ambi_coeffs[4], ALfloat (*coeffs)[2], ALuint *delays); +void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALuint chan_num, ALfloat (*coeffs)[2], ALuint *delays); #endif /* ALC_HRTF_H */ diff --git a/Alc/panning.c b/Alc/panning.c index b7b8a0c7..9b1721cf 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -366,9 +366,8 @@ ALvoid aluInitPanning(ALCdevice *device) SetChannelMap(device, chanmap, count); for(i = 0;i < count;i++) { - GetBFormatHrtfCoeffs(device->Hrtf, chanmap[i].Config.FOACoeff, - device->Hrtf_Params[i].Coeffs, device->Hrtf_Params[i].Delay - ); + GetBFormatHrtfCoeffs(device->Hrtf, i, device->Hrtf_Params[i].Coeffs, + device->Hrtf_Params[i].Delay); } return; |