Skip to content

Commit

Permalink
Fix from Jonas Echterhoff to correct panning.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 30, 2005
1 parent 71892d7 commit 14809cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions osx/alSoftware.c
Expand Up @@ -393,13 +393,14 @@ ALvoid __alRecalcMonoSource(ALcontext *ctx, ALsource *src)
if (!EPSILON_EQUAL(Distance, 0.0f))
{
register ALfloat Panning;

// this is broken, pushes everything to the right.
//Panning = 2.0f * ( (0.5f + (0.5f * 0.707f)) *
// cosf(atan2f(Position[2],Position[0])) );

// not perfect, but fast and functional.
Panning = 0.5f + (0.5f*Position[0]);
CLAMP(Panning, -1.0f, 1.0f);
// Jonas Echterhoff caught the problem...too many parentheses!
Panning = 2.0f * ( 0.5f + (0.5f * 0.707f) *
cosf(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 14809cb

Please sign in to comment.