diff options
author | Chris Robinson <[email protected]> | 2011-03-13 08:46:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-03-13 08:46:54 -0700 |
commit | 4eeed5376f913aa27ad88738c14c2e1b25ab056b (patch) | |
tree | 8d1ba98053f38fb2ccc728e45f3e314abf9c01fd /Alc | |
parent | 77ad538e68ce17e29902680d8cce708a2a105b4e (diff) |
Invert the device matrix row/column
It is accessed now as mat[target][source]
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 8 | ||||
-rw-r--r-- | Alc/panning.c | 74 |
2 files changed, 41 insertions, 41 deletions
@@ -746,7 +746,7 @@ static void Write_##T##_##chans(ALCdevice *device, T *buffer, ALuint SamplesToDo { \ ALfloat samp = 0.0f; \ for(c = 0;c < MAXCHANNELS;c++) \ - samp += DryBuffer[i][c] * Matrix[c][chans[j]]; \ + samp += DryBuffer[i][c] * Matrix[chans[j]][c]; \ buffer[ChanMap[chans[j]]] = func(samp); \ } \ buffer += N; \ @@ -800,8 +800,8 @@ static void Write_##T##_##chans(ALCdevice *device, T *buffer, ALuint SamplesToDo float samples[2] = { 0.0f, 0.0f }; \ for(c = 0;c < MAXCHANNELS;c++) \ { \ - samples[0] += DryBuffer[i][c]*Matrix[c][FRONT_LEFT]; \ - samples[1] += DryBuffer[i][c]*Matrix[c][FRONT_RIGHT]; \ + samples[0] += DryBuffer[i][c]*Matrix[FRONT_LEFT][c]; \ + samples[1] += DryBuffer[i][c]*Matrix[FRONT_RIGHT][c]; \ } \ bs2b_cross_feed(device->Bs2b, samples); \ buffer[ChanMap[FRONT_LEFT]] = func(samples[0]); \ @@ -817,7 +817,7 @@ static void Write_##T##_##chans(ALCdevice *device, T *buffer, ALuint SamplesToDo { \ ALfloat samp = 0.0f; \ for(c = 0;c < MAXCHANNELS;c++) \ - samp += DryBuffer[i][c] * Matrix[c][chans[j]]; \ + samp += DryBuffer[i][c] * Matrix[chans[j]][c]; \ buffer[ChanMap[chans[j]]] = func(samp); \ } \ buffer += N; \ diff --git a/Alc/panning.c b/Alc/panning.c index dec2a361..034158a3 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -184,27 +184,27 @@ ALvoid aluInitPanning(ALCdevice *Device) switch(Device->FmtChans) { case DevFmtMono: - Matrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[SIDE_LEFT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[SIDE_RIGHT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[BACK_LEFT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[BACK_RIGHT][FRONT_CENTER] = aluSqrt(0.5); - Matrix[BACK_CENTER][FRONT_CENTER] = 1.0f; + Matrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][SIDE_LEFT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][BACK_LEFT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][BACK_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_CENTER][BACK_CENTER] = 1.0f; Device->NumChan = 1; Speaker2Chan[0] = FRONT_CENTER; SpeakerAngle[0] = 0.0f * M_PI/180.0f; break; case DevFmtStereo: - Matrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5); - Matrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5); - Matrix[SIDE_LEFT][FRONT_LEFT] = 1.0f; - Matrix[SIDE_RIGHT][FRONT_RIGHT] = 1.0f; - Matrix[BACK_LEFT][FRONT_LEFT] = 1.0f; - Matrix[BACK_RIGHT][FRONT_RIGHT] = 1.0f; - Matrix[BACK_CENTER][FRONT_LEFT] = aluSqrt(0.5); - Matrix[BACK_CENTER][FRONT_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5); + Matrix[FRONT_LEFT][SIDE_LEFT] = 1.0f; + Matrix[FRONT_LEFT][BACK_LEFT] = 1.0f; + Matrix[FRONT_LEFT][BACK_CENTER] = aluSqrt(0.5); + Matrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5); + Matrix[FRONT_RIGHT][SIDE_RIGHT] = 1.0f; + Matrix[FRONT_RIGHT][BACK_RIGHT] = 1.0f; + Matrix[FRONT_RIGHT][BACK_CENTER] = aluSqrt(0.5); Device->NumChan = 2; Speaker2Chan[0] = FRONT_LEFT; Speaker2Chan[1] = FRONT_RIGHT; @@ -214,14 +214,14 @@ ALvoid aluInitPanning(ALCdevice *Device) break; case DevFmtQuad: - Matrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5); - Matrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5); - Matrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5); - Matrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5); - Matrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(0.5); - Matrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(0.5); - Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5); - Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5); + Matrix[FRONT_LEFT][SIDE_LEFT] = aluSqrt(0.5); + Matrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5); + Matrix[FRONT_RIGHT][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(0.5); + Matrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5); + Matrix[BACK_RIGHT][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5); Device->NumChan = 4; Speaker2Chan[0] = BACK_LEFT; Speaker2Chan[1] = FRONT_LEFT; @@ -235,12 +235,12 @@ ALvoid aluInitPanning(ALCdevice *Device) break; case DevFmtX51: - Matrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5); - Matrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5); - Matrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(0.5); - Matrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(0.5); - Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5); - Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5); + Matrix[FRONT_LEFT][SIDE_LEFT] = aluSqrt(0.5); + Matrix[FRONT_RIGHT][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(0.5); + Matrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5); + Matrix[BACK_RIGHT][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5); Device->NumChan = 5; Speaker2Chan[0] = BACK_LEFT; Speaker2Chan[1] = FRONT_LEFT; @@ -256,10 +256,10 @@ ALvoid aluInitPanning(ALCdevice *Device) break; case DevFmtX61: - Matrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5); - Matrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(0.5); - Matrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5); - Matrix[BACK_RIGHT][SIDE_RIGHT] = aluSqrt(0.5); + Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5); + Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5); + Matrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5); + Matrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(0.5); Device->NumChan = 6; Speaker2Chan[0] = SIDE_LEFT; Speaker2Chan[1] = FRONT_LEFT; @@ -277,8 +277,8 @@ ALvoid aluInitPanning(ALCdevice *Device) break; case DevFmtX71: - Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5); - Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5); + Matrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5); + Matrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5); Device->NumChan = 7; Speaker2Chan[0] = BACK_LEFT; Speaker2Chan[1] = SIDE_LEFT; @@ -305,7 +305,7 @@ ALvoid aluInitPanning(ALCdevice *Device) { ALfloat out = 0.0f; for(s2 = 0;s2 < MAXCHANNELS;s2++) - out += Device->ChannelMatrix[s2][s]; + out += Device->ChannelMatrix[s][s2]; maxout = __max(maxout, out); } @@ -313,7 +313,7 @@ ALvoid aluInitPanning(ALCdevice *Device) for(s = 0;s < MAXCHANNELS;s++) { for(s2 = 0;s2 < MAXCHANNELS;s2++) - Device->ChannelMatrix[s2][s] *= maxout; + Device->ChannelMatrix[s][s2] *= maxout; } } |