Audio: ENABLE the engine (relax dead AWE-card gate) + diagnose the real silence (task #50)

User reported never hearing any audio. Root-caused: the KB "Audio: DONE" was wrong.
The OpenAL playback chain IS fully implemented (device/buffers/sources; PlayNote
really calls alSourcePlay), but three gaps kept it silent:

1. GATED OFF (the "no sound" root cause): BTL4Application::MakeAudioRenderer returned
   NULL unless the pod's AWE_FRONT/AWE_REAR AWE32-card env vars were set -- authentic
   1995 pod behavior, dead on modern hardware, so the renderer was NEVER created.
   FIXED: default audio ON (BT_NO_AUDIO=1 restores silence; AWE vars still force-on).
   Verified: the OpenAL device now opens with no env vars ([audio] device OPENED).
2. Soundbank STUB: allPresets[2][100] (btstubs.cpp) is zero-init -> PRESET_isImplemented
   false -> 0 buffers load. Sample data exists (AUDIO1/2.RES: EnginePower/LaserAFire/...)
   but the event->sample map is gone (not in the decomp). STILL OPEN.
3. No triggering: the reconstructed game never creates AudioEntities on events. STILL OPEN.

So the device opens but nothing loads/plays yet -- enabling real sound needs the
soundbank reconstructed + the game triggers wired (a proper audio wave). Added a
BT_AUDIO_LOG trace harness across L4AUDRND/L4AUDRES/L4AUDLVL. KB corrected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-15 18:02:31 -05:00
co-authored by Claude Opus 4.8
parent d624b9b783
commit 52440e13b0
6 changed files with 38 additions and 3 deletions
+3
View File
@@ -1,3 +1,4 @@
#include <cstdlib>
#include "mungal4.h"
#pragma hdrstop
@@ -140,6 +141,7 @@ void
if (sourceState == AL_INITIAL)
{
alSourcei(sourceSet.sources[i],AL_BUFFER,AL_getBuffer(info.bufferIndex));
{ static int s_a=0; if (getenv("BT_AUDIO_LOG") && s_a++<8) DEBUG_STREAM << "[audio] SetupPatch attach bank=" << (int)bankID << " patch=" << (int)patchID << " buf=" << info.bufferIndex << "\n" << std::flush; }
alSourcei(sourceSet.sources[i],AL_SOURCE_RELATIVE,AL_TRUE);
AudioRenderer *render = application->GetAudioRenderer();
@@ -188,6 +190,7 @@ void PatchLevelOfDetail::PlayNote(SourceSet sourceSet)
if (state != AL_PLAYING)
{
alSourcePlay(sourceSet.sources[i]);
{ static int s_p=0; if (getenv("BT_AUDIO_LOG") && s_p++<8) DEBUG_STREAM << "[audio] PlayNote alSourcePlay src=" << sourceSet.sources[i] << "\n" << std::flush; }
}
ALenum error = alGetError();
+2
View File
@@ -1,3 +1,4 @@
#include <cstdlib>
#include "mungal4.h"
#pragma hdrstop
@@ -558,6 +559,7 @@ void
alGetError();
g_buffers = new ALuint[g_numBuffers];
alGenBuffers(g_numBuffers,g_buffers);
if (getenv("BT_AUDIO_LOG")) DEBUG_STREAM << "[audio] alGenBuffers count=" << g_numBuffers << "\n" << std::flush;
ALenum error;
if ((error = alGetError()) != AL_NO_ERROR)
{
+8
View File
@@ -1,3 +1,4 @@
#include <cstdlib>
#include "mungal4.h"
#pragma hdrstop
@@ -98,6 +99,7 @@ void
L4AudioRenderer::Initialize()
{
Check(this);
if (getenv("BT_AUDIO_LOG")) DEBUG_STREAM << "[audio] L4AudioRenderer::Initialize ENTERED\n" << std::flush;
//
//----------------------------------------------------------------------
@@ -133,6 +135,7 @@ void
NotationFile notation_file(audio_file_name);
Check(&notation_file);
if (getenv("BT_AUDIO_LOG")) DEBUG_STREAM << "[audio] notation file opened; about to read scalars\n" << std::flush;
//
//----------------------------------------------------------------------
@@ -379,6 +382,11 @@ void
{
ALCcontext *context = alcCreateContext(device,NULL);
alcMakeContextCurrent(context);
if (getenv("BT_AUDIO_LOG")) DEBUG_STREAM << "[audio] OpenAL device OPENED + context current\n" << std::flush;
}
else
{
if (getenv("BT_AUDIO_LOG")) DEBUG_STREAM << "[audio] OpenAL device FAILED to open (alcOpenDevice NULL)\n" << std::flush;
}
//