Crash when using FlxG.sound.play in Windows

75 views
Skip to first unread message

James Grimwood

unread,
Oct 30, 2014, 5:42:50 AM10/30/14
to haxef...@googlegroups.com
Sometimes, randomly, only (it seems) on my PC I've found the first call to FlxG.sound.play() in my game will cause the whole program to crash.

After a bit of poking about, I've managed to narrow it down to SoundFrontEnd.cache(), specifically the bit where it does

return Assets.getSound(EmbeddedSound, true);

I wrapped this with try/catch like this 

    try {
// load the sound into the OpenFL assets cache
        return Assets.getSound(EmbeddedSound, true);
    } catch (msg: String) {
        trace ("Error: " + msg);
        trace (CallStack.toString(CallStack.exceptionStack()));
        return null;
    }


and got this in the FlashDevelop output window

SoundFrontEnd.hx:143: Error: Not Sound
SoundFrontEnd.hx:144: 
Called from openfl._v2.Assets.getSound (openfl/_v2/Assets.hx line 481)
Called from DefaultAssetLibrary.getSound (DefaultAssetLibrary.hx line 1085)
Called from Type.createInstance (C:\HaxeToolkit\haxe\std/cpp/_std/Type.hx line 82)
Called from __ASSET__assets_sounds_startup_wav.new (openfl/_v2/Assets.hx line 1800)
Called from openfl._v2.media.Sound.loadCompressedDataFromByteArray (openfl/_v2/media/Sound.hx line 119)
Called from extern.cffi (C:/HaxeToolkit/haxe/lib/hxcpp/3,1,39/src/hx/Lib.cpp line 126)
Done(1)

In my code I'm simply calling

FlxG.sound.play("assets/sounds/startup.wav");

And most of the time it works fine, but randomly it fails. However it works fine on Android and my Windows laptop...

Has anyone else seen this happen, and is there a way to fix it?

James Grimwood

unread,
Oct 30, 2014, 7:11:59 AM10/30/14
to haxef...@googlegroups.com
I think I've fixed it (and managed to work out why it only affects one of my machines) by following this thread


and removing and reinstalling lime and lime-tools. I must have missed them when doing an update once.

I did learn about the hxcpp-debugger though, which was useful.
Reply all
Reply to author
Forward
0 new messages