var sound = openfl.Assets.getSound(‘Sounds/test.wav’);
var transform = new openfl.media.SoundTransform(1, 1); // volume 100%, pan Right 100%
var channel = sound.play(transform);
[…]
transform = new openfl.media.SoundTransform(1, -1); // volume 100%, pan Left 100%
channel.transform = transform;
I’m testing on mono wav/ogg/mp3 and the sound always plays as “center”.
It looks like this feature is TODO in the new code base.
OpenFL uses a Lime audio API to help manage the sound on all platforms except for HTML5, which uses Sound.js currently. In the future, I think we should see if Lime’s audio API can gain good HTML5 audio support so we can unify everything.
For Sound.js, I think OpenFL has sound pan, but for the Lime audio API (using OpenAL on native targets currently) there is no pan support. We should add true 3D position support (which can simplify down to 2D pan) and then bind into from OpenFL. Not hard to do, more a matter of defining the API and wiring it.
OpenFL samples don’t use sound panning, I’m sorry this was overlooked.
The first thing to do would be looking at the Lime playing sound sample, and seeing about changes to the AudioSource API to allow for a sound 3D position
If we can get that Lime sample to work properly (and decide on the API to use for it) then it should be easy to add the remaining hook-ups on the OpenFL side to use it