Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogg file exists (synchronously) but fails to load #1704

Open
Geokureli opened this issue Aug 9, 2023 · 2 comments
Open

ogg file exists (synchronously) but fails to load #1704

Geokureli opened this issue Aug 9, 2023 · 2 comments

Comments

@Geokureli
Copy link
Contributor

Continued from: HaxeFlixel/flixel#2848

Project recreating the issue: https://github.com/lol4meh/flixelsoundtest

I tried your project, sorry for the delay. it doesn't crash for me, but the sound doesn't play, for some reason openfl finds that the asset exists and tries to load it, but fails to do so. I tried opening your sound in audacity, saving it as a new file and trying that, it also didn't work. I grabbed a sound from another project and tried that, it worked. I have no idea what's going on with that sound but lime says it exists but NativeCFFI.lime_audio_load_file(path, audioBuffer) returns null. This may be why it's crashing for you

The issue is here: https://github.com/openfl/lime/blob/develop/src/lime/utils/Assets.hx#L122
symbol.library.getAsset(symbol.symbolName, type) returns null even though symbol.exists(type) && symbol.isLocal(type) is true.

in my case I used NativeCFFI.lime_audio_load_file, and it seemed specific to the .ogg file included in that project; this did not happen for other sound files I tried.

Seems like there should be a null check here, like so

var asset = symbol.library.getAsset(symbol.symbolName, type);
if (asset == null)
{
	Log.error(type + " asset \"" + id + "\" exists synchronously, but failed to load");
	return null;
}

But ultimately I wonder why this sound can't be loaded

@player-03
Copy link
Contributor

I know almost nothing about this, but I can at least track down some relevant lines numbers.

If audio_load_file() returns null, then OGG::Decode() returned false. This can happen in one of two ways. The first of those refers to VorbisFile, which relies on ov_open_callbacks(), which calls a bunch of different functions in the same file and errors if any of them fail. The second relies on ov_info(), which can return null "in the case that the machine is not initialized." Pretty sure it's the first option, since that one depends heavily on the details of the ogg file.

Maybe it's fixable, but let's see if we can find a workaround. Try opening in Audacity and exporting as wav or mp3. Then open that file and export as ogg. This should force it to recreate the whole thing from scratch, hopefully no longer causing the bug.

If that doesn't work (or doesn't fit the user's workflow), it's also worth trying a newer version of the Ogg library by switching to 8.2.0-Dev. (This might require OpenFL 8.3.0-Dev, not sure.)

@Geokureli
Copy link
Contributor Author

Try opening in Audacity and exporting as wav or mp3. Then open that file and export as ogg. This should force it to recreate the whole thing from scratch, hopefully no longer causing the bug.

this worked, @lol4meh
lol4meh/flixelsoundtest#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants