Repository navigation
Conversation
Scenes request their music every frame (the login scene, the map themes) and rely on PlayMusic() doing nothing while that track plays. A track that cannot be opened never becomes the current one, so every request opened the file again, ran the decoder probe on the main thread and wrote another "failed to init stream" line to the log - every frame, for as long as the scene was shown. MiniAudioBackend now remembers the last track that failed and skips plain requests for it. It is tried again when another track was requested in between, when the request is enforced, or after all music or that track was stopped (turning the music off and on stops all of it). The per-frame stops of other maps' tracks leave it alone. Seen with music on and no music files, login then Lorencia, Devias and Noria: before, 307-350 errors per track; after, one per track and visit. The destructor now calls MiniAudioBackend::Shutdown() qualified (Cppcheck virtualCallInConstructor on the touched file; behaviour unchanged).
alandarev
marked this pull request as ready for review
October 13, 2026 06:24
Contributor
Author
|
Closing as superseded by 122cc57, merged into main via #610. Upstream now keeps failed music tracks cached for the audio session, including named stop/replay loops in Balgass Barracks/Refuge and Cursed Temple. This also covers the edge case identified in this PR, so keeping upstream’s stronger implementation instead of duplicating it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scenes request their music every frame and rely on
PlayMusic()doing nothingwhile that track plays. A track that cannot be opened never becomes the current
one, so every request opened the file again — the decoder probe ran on the main
thread and another
failed to init streamline went to the log on every frame,as #584 describes (and on macOS the synchronous stream init could hang the main
thread).
MiniAudioBackendnow remembers the last track that failed and skips plainrequests for it. It is tried again when another track is requested in between,
when the request is enforced, or after all music or that track was stopped
(turning the music off and on stops all of it); the per-frame stops of other
maps' tracks leave it alone. The destructor's
Shutdown()call is qualified soCppcheck's
virtualCallInConstructoris satisfied for the touched file(behaviour unchanged).
Related issues
Closes #584.
Testing
tests/core/test_audio_playback.cpp):a missing track is not reopened by plain requests or other tracks' stops, and is
reopened after another request, an enforced request or a stop. The first fails
without the fix.
ctest: 455/455; clang-format 21.1.8 and Cppcheck with the CI options: no findings.Data/Musicfolder, logging in and visitingLorencia, Devias and Noria: before, 307–350
failed to init streamlines pertrack; after, one per track and visit.
Written with AI assistance and tested by hand.
Checklist
docs/CODING_RULES.md.docs/build/README.md).