2
\$\begingroup\$

in libgdx there is a lot of audio classes but i haven't seem to of found anything relating to balancing sound in one speaker and or the other to get surround sound

say you check if an object is more to the left or to the right of the screen, is there anything or any classes relating to something like set speaker balance by percent like 50% would be default audio on the left and right side equally where you can change the balance, 50 - 100 percent is right side, 0 - 50 percent would be left

if this isn't possible, would it be possible two have 2 different audios (Left Explosion sound & Right Explosion sound) with each being 100 percent on the left or right side then change the volume percent of either one to get a surround sound feel?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

You can use the pan parameter on Sounds play method to balance a sound.

-1 is full left, 1 is full right and 0 is center.

// last parameter is pan and this will play the sound with a full left pan
mySound.play(1f, 1f, -1);

There is also a setPan method which you can use to update the pan of an already playing Sound.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .