Keep streamed music alive across the enemy bgm crossfade - #7126
Conversation
|
I found a somewhat similar bug that happens in the vanilla game too, but kept it in a separate branch as this is unrelated to what's fixed here. I reproed also in the royal family tomb, when you approach enemies, the battle music will sometimes not start. I remember this behavior also on console. The channel stop silences both players together for part of every crossfade in vanilla Branch for anyone who wants to read the code, gated behind a checkbox under @lankv2 worth pursuing, or too subtle to bother? Your call is better than mine here. It One tradeoff a programmer should weigh first: the stop is how the quieter player |
|
@bassdr not sure what you're asking is too subtle but after testing the build linked, i think it's pretty much perfect! The battle music resumes properly. |
Fixes HarbourMasters#5706. Audio_SplitBgmChannels stops the channels of the quieter bgm player so it gives its notes back to the pool. A sequence loses nothing, since its script issues fresh notes every tick, but streamed music is a single note that lasts the whole song and then waits on a long delay: stopping its channel ends the track for good, and neither the mask clearing nor the volume returning brings it back. Both players are stopped together while volSplit is between 40 and 87, and the sub player is also stopped at the instant enemy mode engages, before the queued sequence has reached it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Ex3z29fQzPEZgwH4EA641
Thanks @lankv2 for confirming the fix works! On my other question: nobody has raised this in all the audio-mod work you've done, which is answer enough — it's not annoying in practice. I won't PR the enhancement for now. |
75697ce to
1a2d8f2
Compare
|
@bassdr yah so i tested the build with the enhancement on and off and i don't notice much of a difference tbh, so i think it's fine without the enhancement. Also btw, have you tried out my music mod? |
|
@lankv2, yes I tried it, nice work :) I'll try it again during my next playthrough. If there are other bugs preventing it to sound like you want, I might look into it, as audio was the part I felt un-"enhanced", and also why I created my fluidsynth integration, but it also has limitations (Malon and some songs are not Midi-friendly at all, as they have custom instruments). |
Fixes #5706.
Audio_SplitBgmChannels()stops the channels of the quieter bgm player so it hands its notes back to the pool. A sequence loses nothing by that - its script issues fresh notes every tick. Streamed music is a single note lasting the whole song, so stopping its channel ends the track for good; neither the mask clearing nor the volume returning brings it back.Two ways in, which is why it looked intermittent: both players are stopped together while
volSplitis between 40 and 87 (roughly 260 to 390 units from the enemy), and the sub player is stopped the instant enemy mode engages, before the queued sequence has reached it. The second depends on the distance at that exact moment, so the same route reproduces or not.Testing
Instrumented build, Dodongo's Cavern with a streamed music pack, same route each run, counting log lines where a player's volume says it should be audible while all of its channels are stopped:
Also entered encounters at the two distances that previously killed the battle track before it could start, with no stop applied. A streamed track ran 1.6 million samples uninterrupted across an encounter, against roughly 580 thousand before.
Build Artifacts