Repository navigation
Conversation
lunaynx
force-pushed
the
fix/ambience-orphaned-copy
branch
2 times, most recently
from
November 15, 2026 20:21
9468602 to
930e84d
Compare
Tellinq
suggested changes
Nov 20, 2026
Comment on lines
+221
to
+223
| // 1.8.9 starts streams on Paulscode's threads, so a fresh stream reports inactive until its preload ends. | ||
| // Stopping it then is lost: preload finishes afterwards and starts the channel untracked. | ||
| // A zero-volume play is skipped by the engine, so it never starts and gets no grace. |
Contributor
There was a problem hiding this comment.
This is an overly verbose comment. I personally would just remove this as it's not really needed. This can just be explained in the PR.
lunaynx
force-pushed
the
v1
branch
4 times, most recently
from
November 20, 2026 18:18
6fea82e to
d7a54ab
Compare
On 1.8.9 sounds start asynchronously, so a stream that was just started can still report inactive for up to 20 ticks. When the ambience watch loop hit that window it started a new copy and dropped the reference to the old one, which kept playing. stopAmbience only fades the tracked copy, so turning UI Ambience off or closing the menu left the music playing (forever for the looping Polyglass pad).
lunaynx
force-pushed
the
fix/ambience-orphaned-copy
branch
from
November 21, 2026 14:15
930e84d to
d85f569
Compare
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.
Description
On 1.8.9, turning off UI Ambience (or closing the menu) sometimes leaves the music playing.
Cause: the ambience watch loop in
McUiSoundService.driveAmbienceLooprestarts the track whensoundManager.isActive(current)is false, but it never stopscurrentbefore replacingambience. On 1.8.9 that check can be false for a sound that is actually starting:play()only queues a command, sosndSystem.playing()is false until the command thread and stream thread have started the source.SoundManager.isSoundPlayingonly relies onsndSystem.playing().addScheduledTasktasks run back to back in one frame, so after a main thread stall over 500 ms several checks run in a row and each one sees the brand new instance as inactive.Each hit starts another copy and drops the reference to the previous one.
stopAmbienceonly fades the tracked instance, so the dropped copies keep playing. With the Polyglass pad (natively looping) they never end.Fix: stop
currentbefore starting the replacement. Every place that replacesambiencenow stops the old instance first (startAmbiencealready did). On 1.21isActiveis accurate, so the addedstopis a no-op for an already finished sound.Trade-off: if the check still lands in that window, the track restarts once instead of a duplicate being left behind.
Testing: not built or tested in game yet. The diagnosis comes from reading OneConfig's code alongside the 1.8.9
SoundManagerand Paulscode sources.Related Issue(s)
None filed. Reported on 1.8.9 while playing on Hypixel.
Checklist