Skip to content

bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode#2313

Open
Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Caball009:fix_dummy_audio_manager
Open

bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode#2313
Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Caball009:fix_dummy_audio_manager

Conversation

@Caball009
Copy link

@Caball009 Caball009 commented Feb 16, 2026

Our current implementation of dummy audio manager is incomplete, because it cannot return the actual length of audio files. Replays will mismatch if they contain scripts that rely on this.

TODO:

  • Make sure the Github CI can access the audio files.
  • Replicate in Generals.

@Caball009 Caball009 added Audio Is audio related Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project Script Is related to Script Engine, SCB labels Feb 16, 2026
@Caball009 Caball009 changed the title bugfix(audiomanager): Fix audio manager implementation for failing script conditions in headless mode bugfix(audiomanager): Fix dummy audio manager implementation for failing script audio length conditions in headless mode Feb 16, 2026
@Caball009 Caball009 changed the title bugfix(audiomanager): Fix dummy audio manager implementation for failing script audio length conditions in headless mode bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode Feb 16, 2026
@Caball009 Caball009 force-pushed the fix_dummy_audio_manager branch from 7751f9e to 477d80b Compare February 28, 2026 16:19
@Caball009 Caball009 marked this pull request as ready for review February 28, 2026 16:21
@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR fixes a replay CRC mismatch in headless mode by replacing the stub AudioManagerDummy (which returned a hardcoded -1 for getFileLengthMS) with a new MilesAudioManagerDummy that inherits from MilesAudioManager. By not overriding openDevice(), closeDevice(), or getDevice(), the new dummy class lets the parent populate m_digitalHandle, which allows the inherited MilesAudioManager::getFileLengthMS() to open real audio streams and return accurate durations.\n\nThe companion change refactors the createAudioManager() and createRadar() factory methods across both Generals/ and GeneralsMD/ to accept a Bool dummy parameter, moving the dummy/real branching out of GameEngine::init() and into the concrete factory implementations in Win32GameEngine.h.\n\n- AudioManagerDummy removed from the shared Core/GameEngine/Include/Common/GameAudio.h header\n- MilesAudioManagerDummy added to MilesAudioManager.h, inheriting from MilesAudioManager\n- getFileLengthMS uses m_digitalHandle directly (not getDevice()), so the commented-out getDevice() override does not affect correctness\n- Factory signatures updated consistently across both game directories\n- Outstanding TODO: CI audio file access needs to be verified before this fix is fully validated

Confidence Score: 4/5

PR is on a clear path to merge; core logic is correct and all prior review concerns are resolved

The key fix — inheriting openDevice() from MilesAudioManager so that m_digitalHandle is populated and getFileLengthMS() can open real streams — is architecturally sound. getFileLengthMS accesses m_digitalHandle directly (confirmed in source), so neither the removed getDevice() override nor the empty selectProvider() override affects its correctness. All previously flagged issues are addressed. Score stays at 4 rather than 5 only because the PR's own TODO acknowledges that CI audio file access is not yet verified.

Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h — the new MilesAudioManagerDummy class

Important Files Changed

Filename Overview
Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h Core change: adds MilesAudioManagerDummy inheriting MilesAudioManager so openDevice() populates m_digitalHandle, enabling inherited getFileLengthMS() to function correctly; all audio playback methods overridden to no-ops
Core/GameEngine/Include/Common/GameAudio.h Removes the old AudioManagerDummy stub class entirely; no other changes
Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h Updates createAudioManager() and createRadar() to accept Bool dummy and inline the conditional allocation
GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h Mirror of Generals change: updates createAudioManager() and createRadar() with Bool dummy parameter
Generals/Code/GameEngine/Source/Common/GameEngine.cpp Replaces inline ternary allocation with createAudioManager(m_headless) and createRadar(m_headless) calls
GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp Same as Generals GameEngine.cpp: delegates headless branching to factory methods
Generals/Code/GameEngine/Include/Common/GameEngine.h Updates pure virtual declarations of createRadar and createAudioManager to accept Bool dummy
GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h Mirror of Generals GameEngine.h: updates pure virtual declarations for createRadar and createAudioManager

Reviews (5): Last reviewed commit: "Replicated in Generals." | Re-trigger Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

@Caball009
Copy link
Author

Addressed feedback.

@Caball009 Caball009 force-pushed the fix_dummy_audio_manager branch from 9432bea to c439704 Compare March 26, 2026 16:21
@Caball009
Copy link
Author

Replicated in Generals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audio Is audio related Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Script Is related to Script Engine, SCB ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete implementation of dummy audio manager can cause mismatches in headless mode

2 participants