Stable Reworked Audio

- Reworked Internal Audio to work with Streaming Vorbis Files (for now?)
- FlxSound.amplitude, FlxSound.amplitudeLeft, FlxSound.amplitudeRight, SoundChannel.leftPeak, SoundChannel.rightPeak now works. (Streamed Audio on this seems to be half-broken)
- Reworked AudioAnalyzer to work with all type of audios (hopefully) and work with Streamed Audio.
- Redo AudioSwitchFix to work in time instead of when switching states.

gosh, and all that i hope it doesnt break anything.
This commit is contained in:
Ralty
2025-07-13 19:56:26 +07:00
parent 3f19afd66d
commit e669eb32af
10 changed files with 647 additions and 219 deletions
@@ -16,8 +16,13 @@ import haxe.Timer;
class AudioSwitchFix {
public static function onAudioDisconnected() @:privateAccess {
var soundList:Array<FlxSound> = [FlxG.sound.music];
for (sound in FlxG.sound.list) if (sound.playing) soundList.push(sound);
for (source in AudioSource.activeSources) source.dispose();
for (sound in FlxG.sound.list) if (sound.playing) {
sound.pause();
soundList.push(sound);
}
var i = AudioSource.activeSources.length;
while (i-- > 0) AudioSource.activeSources[i].dispose();
AudioManager.shutdown();
@@ -36,7 +41,7 @@ class AudioSwitchFix {
// #end
for (sound in soundList) {
sound._paused = true;
sound.makeChannel();
sound.resume();
}