Background music never loops -- bgmprops is 0, which is SDL's "no property set" sentinel #16

Open
opened 2026-08-02 18:32:56 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.md, "Found while rewriting the Doxygen comments", item 19 (at bbb7b8f)

src/assets.c initialises bgmprops to 0, sets MIX_PROP_PLAY_LOOPS_NUMBER on
it, and plays the track with it:

SDL_PropertiesID bgmprops = 0;
...
SDL_SetNumberProperty(bgmprops, MIX_PROP_PLAY_LOOPS_NUMBER, -1);

if (!MIX_PlayTrack(bgmtrack, bgmprops)) {

0 is SDL's "no property set" sentinel, not a set this function owns, so the write
is rejected -- unchecked -- and the play call is given no options. The music
plays once and stops.
akgl_load_start_bgm reports success either way.

Fix: SDL_CreateProperties() into bgmprops, check it, and destroy it in
CLEANUP.

Related: there is no sound-effect API at all, filed separately. This is the only
file-audio entry point the library has, and its one option is the one that does
not work.

Files: src/assets.c:20-47


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md, "Found while rewriting the Doxygen comments", item 19 (at bbb7b8f) `src/assets.c` initialises `bgmprops` to 0, sets `MIX_PROP_PLAY_LOOPS_NUMBER` on it, and plays the track with it: ```c SDL_PropertiesID bgmprops = 0; ... SDL_SetNumberProperty(bgmprops, MIX_PROP_PLAY_LOOPS_NUMBER, -1); if (!MIX_PlayTrack(bgmtrack, bgmprops)) { ``` 0 is SDL's "no property set" sentinel, not a set this function owns, so the write is rejected -- unchecked -- and the play call is given no options. **The music plays once and stops.** `akgl_load_start_bgm` reports success either way. **Fix:** `SDL_CreateProperties()` into `bgmprops`, check it, and destroy it in `CLEANUP`. Related: there is no sound-effect API at all, filed separately. This is the only file-audio entry point the library has, and its one option is the one that does not work. **Files:** `src/assets.c:20-47` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 0.9.x milestone 2026-08-02 18:32:56 -04:00
tachikoma added the defectblast-radius:high labels 2026-08-02 18:32:56 -04:00
tachikoma added the status::grooming label 2026-08-02 18:49:13 -04:00
Sign in to join this conversation.