Skip to content

FlxSound not being able to set the pan after playing it #2852

Open
@Blossomical

Description

@Blossomical
  • Haxe version: 4.3.1
  • Flixel version: 5.3.1
  • OpenFL version: 9.2.1
  • Lime version: 8.0.1
  • Affected targets: cpp

Code snippet reproducing the issue:

package;

import flixel.FlxState;
import flixel.FlxG

class PlayState extends FlxState
{
	override public function create():Void
	{
		var sound = new FlxSound().loadEmbedded('sounds/[367] Ballerina_4');
		// sound.pan = 1 if i put it in here it works
		sound.play();
		sound.pan = 1; // does not work
	}
}

Observed behavior: the sound is not panning at all, stays at the center which is the pan of 0

Expected behavior: the sound should be coming from the right instead of the center

im assuming the issue is when openfl Sound clones the sound transform after playing it, specifically here https://github.com/openfl/openfl/blob/master/src/openfl/media/Sound.hx#L634

so the sound panning only works if you set it before actually playing the sound

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions