refactor: Update audio logging for clarity and consistency

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-19 16:54:03 +01:00
parent 225840f3ee
commit 7e1855ebda

View File

@@ -1,9 +1,9 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:audioplayers/audioplayers.dart'; import 'package:audioplayers/audioplayers.dart';
import 'package:wolf_3d_dart/src/synth/imf_renderer.dart';
import 'package:wolf_3d_dart/wolf_3d_data_types.dart'; import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
import 'package:wolf_3d_dart/wolf_3d_engine.dart'; import 'package:wolf_3d_dart/wolf_3d_engine.dart';
import 'package:wolf_3d_dart/src/synth/imf_renderer.dart';
class WolfAudio implements EngineAudio { class WolfAudio implements EngineAudio {
@override @override
@@ -11,7 +11,7 @@ class WolfAudio implements EngineAudio {
// Play the first 50 sounds with a 2-second gap to identify them // Play the first 50 sounds with a 2-second gap to identify them
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
Future.delayed(Duration(seconds: i * 2), () { Future.delayed(Duration(seconds: i * 2), () {
print("Testing Sound ID: $i"); print("[AUDIO] Testing Sound ID: $i");
playSoundEffect(i); playSoundEffect(i);
}); });
} }
@@ -51,10 +51,10 @@ class WolfAudio implements EngineAudio {
_isInitialized = true; _isInitialized = true;
print( print(
"WolfAudio: AudioPlayers initialized successfully with $_maxSfxChannels SFX channels.", "[AUDIO] AudioPlayers initialized successfully with $_maxSfxChannels SFX channels.",
); );
} catch (e) { } catch (e) {
print("WolfAudio: Failed to initialize AudioPlayers - $e"); print("[AUDIO] Failed to initialize AudioPlayers - $e");
} }
} }
@@ -90,7 +90,7 @@ class WolfAudio implements EngineAudio {
); );
await _musicPlayer.play(BytesSource(wavBytes)); await _musicPlayer.play(BytesSource(wavBytes));
} catch (e) { } catch (e) {
print("WolfAudio: Error playing music track - $e"); print("[AUDIO] Error playing music track - $e");
} }
} }
@@ -124,7 +124,7 @@ class WolfAudio implements EngineAudio {
if (index < data.music.length) { if (index < data.music.length) {
await playMusic(data.music[index]); await playMusic(data.music[index]);
} else { } else {
print("WolfAudio: Warning - Track index $index out of bounds."); print("[AUDIO] Warning - Track index $index out of bounds.");
} }
} }
@@ -134,7 +134,7 @@ class WolfAudio implements EngineAudio {
@override @override
Future<void> playSoundEffect(int sfxId) async { Future<void> playSoundEffect(int sfxId) async {
print("Playing sfx id $sfxId"); print("[AUDIO] Playing sfx id $sfxId");
// The original engine uses a specific starting chunk for digitized sounds. // The original engine uses a specific starting chunk for digitized sounds.
// In many loaders, the 'sounds' list is already just the digitized ones. // In many loaders, the 'sounds' list is already just the digitized ones.
// If your list contains EVERYTHING, you need to add the offset (174). // If your list contains EVERYTHING, you need to add the offset (174).
@@ -168,7 +168,7 @@ class WolfAudio implements EngineAudio {
// Note: We use BytesSource because createWavFile returns Uint8List (the file bytes) // Note: We use BytesSource because createWavFile returns Uint8List (the file bytes)
await player.play(BytesSource(wavBytes)); await player.play(BytesSource(wavBytes));
} catch (e) { } catch (e) {
print("WolfAudio: SFX Error - $e"); print("[AUDIO] SFX Error - $e");
} }
} }
} }