Skip to content

fix(audio): log SDL audio driver and error when open fails (issue 99) - #110

Merged
Sacrappy merged 1 commit into
Sacrappy:mainfrom
Mooseca:fix/audio-open-log
Nov 20, 2026
Merged

Sacrappy merged 1 commit into
Sacrappy:mainfrom
Mooseca:fix/audio-open-log

Conversation

@Mooseca

@Mooseca Mooseca commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Issue 99: a failed audio start on Linux says nothing about why. The game plays through SDL, but waveOutOpen failed (MMRESULT 1) gives no clue whether the driver is wrong, the device is unavailable, or something else.

This change adds two logs to engine/host/hos_sdl.c:

  • the SDL audio driver in use, once the audio subsystem starts (SDL_GetCurrentAudioDriver());
  • SDL's own error (SDL_GetError()), with the rate, channels and format asked for, when the audio init or the device open fails.

Tested on Linux (PipeWire, SDL 3.4.20):

  • normal start: audio: SDL driver pipewire, and sound works;
  • forced failure (SDL_AUDIO_DRIVER=nosuchdriver): audio: SDL audio init failed (Audio target 'nosuchdriver' not available), and the game keeps running;
  • unit tests: 488 passed, 3 failed, the same 3 as on main (nx2/test_nup_read_name.py, tests/test_crash_record.py, tests/test_switches_documented.py).

You wrote on #99 that the next version would also write SDL's own error into the log when the sound device fails. This does that, so take it or keep your own, whichever fits better.

It does not close #99: the reporter has not confirmed sound yet.

🤖 Generated with Claude Code

Log SDL_GetCurrentAudioDriver() after the audio subsystem starts,
and SDL_GetError() with freq, channels, and format (S16LE/F32LE)
when the open fails. Also log the init failure path.
@Sacrappy
Sacrappy merged commit 068033d into Sacrappy:main Nov 20, 2026
2 of 3 checks passed
@Mooseca
Mooseca deleted the fix/audio-open-log branch November 21, 2026 01:56
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.

[Ubuntu 26.04] No sound

2 participants