HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.97k stars 436 forks source link

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

Closed pizzamakesgames closed 8 years ago

pizzamakesgames commented 8 years ago

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.

Neko:

Build succeeded
Done(0)
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 openfl._legacy.events.EventDispatcher::dispatchEvent 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
Done(1)

Windows:

Build succeeded
Done(0)
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: https://www.dropbox.com/s/rdksc78r6l3vxm7/SkullzTwoSoundError118.rar

pizzamakesgames commented 8 years ago

Had a lot of people test it for me and even got a program written that starts the game in quick succession in the hope to force the error, though it has not been happening anywhere but on my own PC. I did do a complete reinstall of HaxeFlixel, Haxe, Neko, OpenFL, Lime and Flashdevelop already, though no change. What else could be the cause of this?

larsiusprime commented 8 years ago

Hmmm, this is really weird! As it happens, I seem to recall running across this myself once or twice.

Are you using the -Dnext flag or not?

pizzamakesgames commented 8 years ago

I'm not using the -Dnext flag. Using it for the windows target results in a lot of stuttering and frequent crashes. Using it for the neko target results in an error prompt saying something about a procedure entry point "neko_buffer_length" not found in "neko.dll" DLL and then this in the cmd window: Uncaught exception - load.c(237) : Failed to load library : ./std.ndll.

As the issue has only appeared on my system and only after compiling, maybe something completely unrelated to the compilation process might be at fault?

larsiusprime commented 8 years ago

It's hard to tell.

The neko_buffer_length thing might be related to your total project size; IIRC neko can't compile projects above a certain size, especially if you're embedding assets.

Also, are you using the release version of flixel or the dev version? dev version of HaxeFlixel combined with -Dnext has been very stable for me on a very large project.

sruloart commented 8 years ago

As far as I can read, this error is related to quite particular hardware setups / old audio drivers.

I did open an issue a long time ago (https://github.com/openfl/lime/issues/109), but it was on a laptop with a quirky sound system as well (laptop is now sadly deceased).

I see here: http://community.openfl.org/t/openal-errors-in-windows/111/4 that openfl-next might be able to prevent this crash (only on cpp?), and it seems important enough since we know that OpenFL based games are vulnerable (https://steamcommunity.com/app/253790/discussions/0/540732347262423880/#p2). @jgranick, @mrcdk is it something that can be resolved somehow on your end?

pizzamakesgames commented 8 years ago

Looking at this script: http://pastebin.com/DXf3nmkL

Might that be that issue: "I don't know what lime_sound_from_file is, but don't you typically pass the URLRequest itself, not the string version of the url" ?

pizzamakesgames commented 8 years ago

Got a case in which the error is consistently thrown during runtime now. It happens on neko, but not on windows cpp.

Here's the error: http://pastebin.com/sDPvJxv5 Here's the class: http://pastebin.com/guPVFZUm

The error happens on ProgressMusic01() every time with both .ogg and .wav.

Searching for the issue, I found this: https://github.com/openfl/openfl/issues/131 / https://github.com/openfl/openfl-native/issues/112

I'd love to try the fix, but I can't find this directory: lime/project/src/common/Audio.cpp

Gama11 commented 8 years ago

https://github.com/openfl/lime/blob/master/legacy/project/src/common/Audio.cpp

pizzamakesgames commented 8 years ago

Thank you, I was going to try out your fix but ever since changing to the dev branch of flixel and updating all libs in the process, I seem to be unable to reproduce the issue. I've run a program to start and close the game continuously in short intervals and even after close to 50 attempts the issue did not come up. For me, this would mark the issue as solved, as I don't have any reason to go back to the master branch of flixel, though I guess for the purposes of using the master branch, the issue'd pertain. I'd say I keep on developing and if it ever comes up again I'll chime in again...?

Gama11 commented 8 years ago

I doubt this is a Flixel issue / that you'd be able to reproduce it by going back to the master branch (there have barely been any changes to FlxSound, and none of those seem relevant to this). If anything, OpenFL / Lime changes made a difference.

I guess I'll close this until it comes up again.

pizzamakesgames commented 8 years ago

Happened for the first time again in forever, but it did happen. Completely different and new project.

Should I open an issue with OpenFL or...?

pizzamakesgames commented 8 years ago

Video showing the issue.