Skip to content

[raudio] Document direction of pan in SetSoundPan()/SetMusicPan() #5341

@JoeStrout

Description

@JoeStrout

Issue description

The documentation for SetSoundPan says Set pan for a sound (0.5 is center) (and similar for SetMusicPan). So I assumed that, as in other enviroments I've used, 0.0 meant fully left and 1.0 meant fully right. I was then surprised when my sounds were backwards, coming out of the opposite speaker.

I've traced through the code and found MixAudioFrames, where it appears this behavior is intentional: the pan value is used as the left channel volume, and 1.0 - pan is used for the right.

Suggested Doc Change

Change the comment on SetSoundPan to: Set pan for a sound (0.0 is right, 0.5 is center, 1.0 is left)

And change the comment on SetMusicPan to: Set pan for a music (0.0 is right, 0.5 is center, 1.0 is left)

Code Example

      InitWindow(800, 600, "SetSoundPan Test");
      InitAudioDevice();
      Sound sound = LoadSound("sound.wav");  // Any mono or stereo sound file
      SetSoundPan(sound, 0.0f);  // plays out the right speaker, not the left
      PlaySound(sound);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions