Skip to content

Commit

Permalink
More attempts at fixing the busted spatialization code.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 31, 2005
1 parent 7e4a4e9 commit 69101f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions osx/alMath.h
Expand Up @@ -216,9 +216,9 @@ static inline ALvoid __alMatrixVector(ALfloat matrix[3][3], ALvector v)
{
ALvector result;

result[0]=matrix[0][0]*v[0]+matrix[0][1]*v[1]+matrix[0][2]*v[2];
result[1]=matrix[1][0]*v[0]+matrix[1][1]*v[1]+matrix[1][2]*v[2];
result[2]=matrix[2][0]*v[0]+matrix[2][1]*v[1]+matrix[2][2]*v[2];
result[0]=v[0]*matrix[0][0]+v[1]*matrix[1][0]+v[2]*matrix[2][0];
result[1]=v[0]*matrix[0][1]+v[1]*matrix[1][1]+v[2]*matrix[2][1];
result[2]=v[0]*matrix[0][2]+v[1]*matrix[1][2]+v[2]*matrix[2][2];

__alVectorAssign3(v, result);
} // __alMatrixVector
Expand Down
8 changes: 4 additions & 4 deletions osx/alSoftware.c
Expand Up @@ -353,9 +353,9 @@ ALvoid __alRecalcMonoSource(ALcontext *ctx, ALsource *src)
__alNormalize(V);
__alVectorAssign3(N, listener->Forward);
__alNormalize(N);
Matrix[0][0]=U[0]; Matrix[0][1]=V[0]; Matrix[0][2]=N[0];
Matrix[1][0]=U[1]; Matrix[1][1]=V[1]; Matrix[1][2]=N[1];
Matrix[2][0]=U[2]; Matrix[2][1]=V[2]; Matrix[2][2]=N[2];
Matrix[0][0]=U[0]; Matrix[0][1]=V[0]; Matrix[0][2]=-N[0];
Matrix[1][0]=U[1]; Matrix[1][1]=V[1]; Matrix[1][2]=-N[1];
Matrix[2][0]=U[2]; Matrix[2][1]=V[2]; Matrix[2][2]=-N[2];
__alMatrixVector(Matrix,Position);
// Convert into falloff and panning
Distance = __alSqrt(Position[0]*Position[0]+Position[1]*Position[1]+Position[2]*Position[2]);
Expand Down Expand Up @@ -400,7 +400,7 @@ ALvoid __alRecalcMonoSource(ALcontext *ctx, ALsource *src)

// Jonas Echterhoff caught the problem...too many parentheses!
Panning = 2.0f * ( 0.5f + (0.5f * 0.707f) *
cosf(atan2f(Position[2],Position[0])) );
(ALfloat) (cos(atan2f(Position[2],Position[0]))) );

src->channelGain0 = CalcVolume * Panning * ctx->device->speakergains[0];
src->channelGain1 = CalcVolume * (1.0f - Panning) * ctx->device->speakergains[1];
Expand Down

0 comments on commit 69101f9

Please sign in to comment.