flixel icon indicating copy to clipboard operation
flixel copied to clipboard

No warning if FlxSound fails to play because audio sampling is above 44.1 kHZ

Open TripleSmeven opened this issue 4 years ago • 2 comments

class PlayState extends FlxState
{
        var mySound:FlxSound;
	override public function create():Void
	{
		mySound = FlxG.sound.load(AssetPaths.high_quality_sound__wav); // sound file is sampled higher than 44.1 kHz
                mySound.play()
	}
}

Observed behavior: I haven't done extensive testing on other targets, but I believe on neko and probably flash, sound files with audio sampling over 44.1 kHz do not play. There's no warning. I only realized this in my own project because it was mentioned in this guide: https://gamefromscratch.com/haxeflixel-tutorial-sound-and-music/.

Expected behavior: The sound either plays, or warns you that it can't be played because it is sampled at a higher rate than allowed.

I've been told this is an openFL thing and not really a flixel thing, so I wonder if a simple warning would be best. I also wonder if this can be better documented somewhere.

TripleSmeven avatar Dec 25 '20 19:12 TripleSmeven

I've been told this is an openFL thing and not really a flixel thing, so I wonder if a simple warning would be best.

I think the warning would have to be at OpenFL level too.

Gama11 avatar Dec 25 '20 20:12 Gama11

Turns out there is a warning at the Lime level for Flash: https://github.com/haxelime/lime/blob/1b809a4918780e01f73c9dfdb608ba83a3cfbde7/src/lime/tools/FlashHelper.hx#L161

But you were testing on Neko, which I don't see anything for. I figured Neko could handle different sample rates, but maybe not.

MSGhero avatar Dec 26 '20 01:12 MSGhero