Android: .ogg extreme loading time

openfl: 5.1.5
lime: 5.2.1

openfl create PlayingSound
openfl test android

The starting of the app takes longer then expected
Tracing the load time

trace("begin getSound" + Math.round(haxe.Timer.stamp() * 100) / 100);
sound = Assets.getSound ("assets/stars.ogg");
trace("end getSound" + Math.round(haxe.Timer.stamp() * 100) / 100);

results in
8 seconds on my older phone
3 seconds on a not so old tablet.
For a 1.2Mb ogg file.
~+50% longer for my 3Mb music-track.

Digging for the cause, i ended up in

NativeCFFI.lime_audio_load (path, audioBuffer);

But now i am kinda clueless.

Is it possible to speed this up somehow?
(wav is a lot quicker to load, but not suitable for music-tracks)
Do others have the same problem?
Is there an alternative?

There’s beta support for streaming audio, it may be worth trying:

var vorbisFile = VorbisFile.fromFile (Assets.getPath ("audio.ogg"));
var audioBuffer = AudioBuffer.fromVorbisFile (vorbisFile);

var audioSource = new AudioSource (audioBuffer); ();

If it’s stable, we can wire the “music” path up (probably?) to using streaming audio instead of loading into memory completely

Thanks for that info.
But i cant figure out how i could mute/fade the volume on AudioSource.
Atm i am using the SoundChannel from the Sound itself.

No worries, im fine with the “old” solution, i was just suprised that loading of ogg files takes soo long.

I believe it’s audioSource.gain :slight_smile: