SOLVED: FlxSound not panning mono sounds ?

  • Haxe 3.2.1 - HaxeFlixel 4.0.1

    I was wondering if anyone else has experienced issues with FlxSound not using the pan information its given? No matter what value I store in a FlxSound object's pan property (between -1 and 1), it always seems to play the sound directly in the center of the stereo field ...

    I've been building my project using C++ on Mac and Neko on Windows, and in both cases the result is the same ...

    Has anyone had a similar experience or have any ideas ?


  • I was able to figure this out after a bit of digging, and get 2D panning working.

    OpenFL was not set up to pass pan information to OpenAL (Lime)

    In in the play() method, add this pan property:

    if (sndTransform != null) {
    	source.gain = sndTransform.volume;
    	source.pan = sndTransform.pan;

    Then in, add that property to theAudioSource class:

    public var pan:Float;

    then add these two lines before AL.sourcePlay(id):

    AL.source3f(id, AL.POSITION, pan, 0, -1 * Math.sqrt(1 - Math.pow(pan, 2)));

    Word is it's on the official fix list for OpenFL, so it'll probably get a proper fix soon.

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.