Skip to content

Add diagnostic logging to AudioManager and use explicit mixer params#14

Merged
CAG07 merged 3 commits intomainfrom
copilot/fix-audio-issues-in-game
Feb 15, 2026
Merged

Add diagnostic logging to AudioManager and use explicit mixer params#14
CAG07 merged 3 commits intomainfrom
copilot/fix-audio-issues-in-game

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 15, 2026

Audio initialization was silently failing with no way to diagnose why. The mixer was using default parameters which behave inconsistently across environments.

Changes

  • src/ui/audio.pyinit(): Print each SDL driver attempt with success/failure and error details. Use explicit mixer params (frequency=22050, size=-16, channels=2, buffer=512). Separate ImportError from general exceptions for clarity.
  • src/ui/audio.py_load_sounds(): Print per-file load status and summary count (loaded N/7 sounds).
  • main.py: Log whether audio init succeeded or fell back to silent mode.
  • Tests: 3 new tests covering diagnostic output for disabled, uninitialized, and missing-files cases.

Example output

AudioManager: trying default driver
AudioManager: FAILED with driver 'default': No available audio device
AudioManager: trying driver 'pulseaudio'
AudioManager: SUCCESS with driver 'pulseaudio'
AudioManager: mixer config: (22050, -16, 2)
AudioManager: loading sounds from 'data/sfx'
AudioManager: file not found: data/sfx/fire_abm.wav
...
AudioManager: loaded 0/7 sounds
WARNING: Audio system failed to initialize - game will run silently

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 15, 2026 20:36
- AudioManager.init(): Added print diagnostics for each driver attempt,
  success/failure messages, and specific mixer params (22050Hz, 16-bit, stereo, 512 buffer)
- AudioManager._load_sounds(): Added print diagnostics for sound file loading
- main.py: Added audio initialization success/failure message
- Tests: Added 3 new tests for diagnostic output verification

Co-authored-by: CAG07 <18625460+CAG07@users.noreply.github.com>
Co-authored-by: CAG07 <18625460+CAG07@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix audio issues in game initialization Add diagnostic logging to AudioManager and use explicit mixer params Feb 15, 2026
Copilot AI requested a review from CAG07 February 15, 2026 20:38
@CAG07 CAG07 marked this pull request as ready for review February 15, 2026 20:45
@CAG07 CAG07 merged commit faf6044 into main Feb 15, 2026
4 checks passed
@CAG07 CAG07 deleted the copilot/fix-audio-issues-in-game branch February 15, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants