No sound on load: [Sound.hx:118: Error] #1644

Using HaxeFlixel, this error is happening inconsistently on both neko and cpp, resulting in no sound being able to load.

On both targets, it may happen at any time the game is started, after it’s already been compiled.


Build succeeded
haxelib run lime run "Project.xml" neko -debug
Running process: D:\hyperdev\haxe\haxe\haxelib.exe run lime run "Project.xml" neko -debug
Sound.hx:118: Error: Could not load "assets/music/SnowPath_nonproperloop.ogg"
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
Invalid operation (/)
Called from flixel.system.FlxSound::update line 241
Called from flixel.system.frontEnds.SoundFrontEnd::update line 273
Called from flixel.FlxGame::update line 696
Called from flixel.FlxGame::step line 648
Called from flixel.FlxGame::onEnterFrame line 493
Called from line 98
Called from openfl._legacy.display.DisplayObject::__dispatchEvent line 182
Called from openfl._legacy.display.DisplayObject::__broadcast line 161
Called from openfl._legacy.display.DisplayObjectContainer::__broadcast line 280
Called from openfl._legacy.display.Stage::__render line 1103
Called from openfl._legacy.display.Stage::__checkRender line 351
Called from openfl._legacy.display.Stage::__pollTimers line 1084
Called from openfl._legacy.display.Stage::__doProcessStageEvent line 430


Build succeeded
haxelib run lime run "project.xml" windows -debug
Running process: D:\Projects\hyperdev\haxe\haxelib.exe run lime run "project.xml" windows -debug
Sound.hx:118: Error: Could not load "assets/sounds/PizzaIntro4_1.ogg"

This error has been persisting across different sounds (both .ogg and .wav), states and even games for me. If you want to try it yourself, this game should have the error on about every 20th start, bringing up my silly workaround screen:

I havn’t had any luck replicating this issue on anything but my own system, so this would probably be a weird quirk on my side rather than a problem with OpenFL. Still, I would be quite happy about any kind of solution.

I’m using Win 7, 64 bit. My haxelib list:

actuate: [1.8.6]
box2d: [1.2.3]
flixel-addons: 1.1.0 git [dev:D:\Projects\hyperdev\haxe\lib/flixel-addons/git]
flixel-demos: 1.1.2 git [dev:D:\Projects\hyperdev\haxe\lib/flixel-demos/git]
flixel-tools: 1.1.1 git [dev:D:\Projects\hyperdev\haxe\lib/flixel-tools/git]
flixel: 3.3.11 git [dev:D:\Projects\hyperdev\haxe\lib/flixel/git]
haxe: git [dev:D:\Projects\hyperdev\haxe\lib/haxe/git]
haxelib_client: [3.2.0-rc.3]
hscript: [2.0.5]
hxcpp: [3.2.193]
layout: [1.2.1]
lime-samples: [2.6.0]
lime: 2.7.0 2.8.0 [2.8.1]
openfl-samples: [3.3.1]
openfl: 3.4.0 3.5.0 [3.5.1]
swf: 2.1.3 2.1.4 [2.1.5]

I think we did a thorough sweep through our code to prevent file handle leaks – if you open too many files (and do not close them) the OS might stop giving you file handles. This can sometimes be the cause of intermittent (and difficult to reproduce) problems where files will not load.

I’m not sure if the legacy code is “air tight” but this would be my first guess – you can try loading the same file (without cache enabled) repeatedly on a loop, and see if it fails at some point.

Has anyone else been having problems like this one?

We might be misunderstanding each other. What’s happening is that not a single one of all the audio files embedded in the project via the project.xml loads on start of the game. This happens before any audio is being played within the game, right upon running it. Nine out of ten times it all works fine, but every other time none get loaded whatsoever.

Maybe I’m going about embedding the files wrong in the project.xml? The code looks like this:

<assets path="assets/sounds" unless="flash">
<sound path="skulltalk1.ogg" id="typesfx1" />
<sound path="skulltalk2.ogg" id="typesfx2" />
<sound path="PizzaIntro4_1.ogg" id="pizzaintro" />
<sound path="stepsfx1.ogg" id="step1sfx" />
<sound path="stepsfx2.ogg" id="step2sfx" />
<sound path="castle_thunder.ogg" id="castlethunder" />
<sound path="menu_sfx1.ogg" id="menusfx1" />
<sound path="menu_confirm_title.ogg" id="menusfx2" />
<sound path="menusfx3.ogg" id="menusfx3" />
<sound path="menu_confirm3.ogg" id="menuconfirm" />
<sound path="typeend.ogg" id="typeend" />
<sound path="title_appear.ogg" id="title_appear" />
<sound path="title_disappear.ogg" id="title_disappear" />
<sound path="kill.ogg" id="kill" />
<sound path="killend.ogg" id="killend" />

<assets path="assets/music" unless="flash">
<music path="castle_intro.ogg" id="castleintro" />
<music path="castle_intro_chapter.ogg" id="castleintrochapter" />
<music path="castlesong.ogg" id="castlesong" />
<music path="skullz2charcreation_2.ogg" id="snow01" />
<music path="snowwalk_01.ogg" id="snowwalk_01" />
<music path="snowwalk_02.ogg" id="snowwalk_02" />
<music path="snowwalk_03.ogg" id="snowwalk_03" />
<music path="snowwalk_04.ogg" id="snowwalk_04" />
<music path="snowwalk_end.ogg" id="snowwalk_end" />

Started working on a new game last week and had the issue happen about 2-3 times randomly while testing since.

debugging through cmd, this is what gets thrown:

The project only has 2 sound files yet, both being 1-2 minute long songs, so I doubt capacity has anything to do with the issue. Files aren’t embedded via the project.xml but simply played with“path/to/sound.ogg”);

As described, the game will crash every couple tens of starts, outputting what’s shown in the screenshot above.

Should I open an issue on Github?