Add some debugging for later
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -6,6 +6,16 @@ import 'package:wolf_3d_engine/wolf_3d_engine.dart';
|
||||
import 'package:wolf_3d_synth/src/imf_renderer.dart';
|
||||
|
||||
class WolfAudio implements EngineAudio {
|
||||
void debugSoundTest() {
|
||||
// Play the first 50 sounds with a 2-second gap to identify them
|
||||
for (int i = 0; i < 50; i++) {
|
||||
Future.delayed(Duration(seconds: i * 2), () {
|
||||
print("Testing Sound ID: $i");
|
||||
playSoundEffect(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bool _isInitialized = false;
|
||||
|
||||
// --- Music State ---
|
||||
@@ -124,10 +134,15 @@ class WolfAudio implements EngineAudio {
|
||||
@override
|
||||
Future<void> playSoundEffect(int sfxId) async {
|
||||
print("Playing sfx id $sfxId");
|
||||
if (!_isInitialized || activeGame == null) return;
|
||||
// The original engine uses a specific starting chunk for digitized sounds.
|
||||
// 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 it's JUST digitized sounds, sfxId should work directly.
|
||||
|
||||
// 1. Get the raw 8-bit unsigned PCM bytes from the game data
|
||||
final Uint8List raw8bitBytes = activeGame!.sounds[sfxId].bytes;
|
||||
final soundsList = activeGame!.sounds;
|
||||
if (sfxId < 0 || sfxId >= soundsList.length) return;
|
||||
|
||||
final raw8bitBytes = soundsList[sfxId].bytes;
|
||||
if (raw8bitBytes.isEmpty) return;
|
||||
|
||||
// 2. Convert 8-bit Unsigned PCM -> 16-bit Signed PCM
|
||||
|
||||
Reference in New Issue
Block a user