diff options
Diffstat (limited to 'Alc/panning.c')
-rw-r--r-- | Alc/panning.c | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/Alc/panning.c b/Alc/panning.c index e73c99aa..85de3626 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -76,51 +76,64 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl { enum Channel chan = device->Speaker[i].ChanName; for(j = 0;j < MAX_AMBI_COEFFS;j++) - gains[chan] += device->Speaker[i].Coeff[j]*coeffs[j]; + gains[chan] += device->Speaker[i].HOACoeff[j]*coeffs[j]; gains[chan] = maxf(gains[chan], 0.0f) * ingain; } } +void ComputeBFormatGains(const ALCdevice *device, ALuint channum, ALfloat ingain, ALfloat gains[MaxChannels]) +{ + ALuint i; + + for(i = 0;i < MaxChannels;i++) + gains[i] = 0.0f; + for(i = 0;i < device->NumSpeakers;i++) + { + enum Channel chan = device->Speaker[i].ChanName; + gains[chan] = device->Speaker[i].FOACoeff[channum] * ingain; + } +} + ALvoid aluInitPanning(ALCdevice *device) { static const ChannelConfig MonoCfg[1] = { - { FrontCenter, DEG2RAD(0.0f), DEG2RAD(0.0f), { 1.4142f } } + { FrontCenter, DEG2RAD(0.0f), DEG2RAD(0.0f), { 1.4142f }, { 1.4142f } } }, StereoCfg[2] = { - { FrontLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, 0.5f, 0.0f } }, - { FrontRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, -0.5f, 0.0f } } + { FrontLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, 0.5f, 0.0f }, { 0.7071f, 0.0f, 0.5f, 0.0f } }, + { FrontRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, -0.5f, 0.0f }, { 0.7071f, 0.0f, -0.5f, 0.0f } } }, QuadCfg[4] = { - { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f), { 0.353558f, 0.306181f, 0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f } }, - { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f), { 0.353543f, 0.306181f, -0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f } }, - { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f), { 0.353543f, -0.306192f, 0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f } }, - { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f), { 0.353558f, -0.306192f, -0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f } } + { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f), { 0.353558f, 0.306181f, 0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f }, { 0.353553f, 0.250000f, 0.250000f, 0.0f } }, + { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f), { 0.353543f, 0.306181f, -0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f }, { 0.353553f, 0.250000f, -0.250000f, 0.0f } }, + { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f), { 0.353543f, -0.306192f, 0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f }, { 0.353553f, -0.250000f, 0.250000f, 0.0f } }, + { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f), { 0.353558f, -0.306192f, -0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f }, { 0.353553f, -0.250000f, -0.250000f, 0.0f } } }, X51Cfg[5] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f } }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.208950f, 0.212842f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017740f, -0.204011f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051022f, -0.047489f } }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } }, - { BackLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f), { 0.470934f, -0.369630f, 0.349383f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031379f, -0.058143f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007116f, -0.043968f } }, - { BackRight, DEG2RAD( 110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f } } + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f }, { 0.208954f, 0.162905f, 0.182425f, 0.0f } }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f }, { 0.208954f, 0.162905f, -0.182425f, 0.0f } }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } }, + { BackLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f }, { 0.470934f, -0.282903f, 0.267406f, 0.0f } }, + { BackRight, DEG2RAD( 110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f }, { 0.470934f, -0.282903f, -0.267406f, 0.0f } } }, X51SideCfg[5] = { - { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } }, - { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } } + { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } }, + { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f }, { 0.289151f, -0.062225f, 0.307136f, 0.0f } }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f }, { 0.289151f, -0.062225f, -0.307136f, 0.0f } } }, X61Cfg[6] = { - { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } }, - { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f), { 0.353556f, -0.461940f, -0.000006f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, -0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000005f } }, - { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } } + { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } }, + { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f), { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000005f }, { 0.353556f, -0.353554f, 0.000000f, 0.0f } }, + { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f }, { 0.289151f, -0.062225f, 0.307136f, 0.0f } }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f }, { 0.289151f, -0.062225f, -0.307136f, 0.0f } } }, X71Cfg[7] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } }, - { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f), { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065799f } }, - { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f), { 0.224739f, -0.295005f, -0.170331f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105342f, 0.182470f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065792f } }, - { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f), { 0.224739f, 0.000002f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065795f } }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.224754f, 0.000004f, -0.340647f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, -0.000004f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065796f } } + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } }, + { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f), { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065799f }, { 0.224752f, -0.225790f, 0.130361f, 0.0f } }, + { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f), { 0.224739f, -0.295005f, -0.170331f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105342f, 0.182470f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065792f }, { 0.224752f, -0.225790f, -0.130361f, 0.0f } }, + { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f), { 0.224739f, 0.000002f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065795f }, { 0.224739f, 0.000000f, 0.260717f, 0.0f } }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.224754f, 0.000004f, -0.340647f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, -0.000004f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065796f }, { 0.224739f, 0.000000f, -0.260717f, 0.0f } } }; const ChannelConfig *config; ALuint i; |