fix: play update audio effects as the incoming track of new BGM - #374
Merged
Merged
Conversation
A line whose BGM action uses an update audio effect threw at line entry
when the music started or changed source ("has type update, but the BGM
action changes source identity"). Creator's fullscreen preview could not
open, and a game would stop at that line.
An update effect now animates the music the line plays: a retained sound
updates, and an added or source-replaced sound plays the update as its
incoming (enter) track, as visual update animations play when their
element appears. Its final keyframes must still match the persistent mix.
A removed sound stops without an effect, since an update has no outgoing
track.
Address review of the update-effect change: - When a line stops every BGM sound, an update effect now plays as each sound's outgoing (exit) track, matching the visual update fallback that animates a removed element. An update that fades to 0 fades the music out, and the selection is validated again on stop lines. A sound removed while others play or enter still stops without an effect. - Compile transition and update tracks through one helper, and compute the transition-only graph comparison and id map only where they are used. - Update the audio effect resource schema description. - Tests: exact enter keyframes in the engine source-change test, removed plus retained plus added sounds in one update, stop as exit, and speed validation on stop lines.
…ates Address the second review: - An update played as the incoming track of a source change measured relative pan from the next BGM pan, which already holds the tween's final value, so a +0.2 step overshot. It now continues from the channel pan before the line, or from the new channel pan when music starts. - compileLifecycleTrack takes one explicit side (sound, BGM, resources) and baseline instead of choosing them through an implicit default. - Docs and schema: the BGM update section no longer says updates require retained sounds, the persistent-value rule covers stop lines, and a partial removal whose remaining sounds do not change has no effect. - Tests: relative pan on a source change and on a start, playback rate as an incoming track, and a partial removal at the engine level.
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.
Problem
A line whose BGM action uses an update audio effect throws at line entry when the music starts or changes source:
In RouteVN Creator, fullscreen Preview fails to open with this error (seen on an iPad with a real project). The scene editor hides it because it strips the selected line's update effects. A game would also stop at that line.
Visual animations already allow this: an update animation used for add, remove, or replace animates one available target instead of throwing (
docs/AnimationModel.md, "Update fallback").Fix
An update effect now animates one track per sound, like the visual update fallback, preferring the sounds the line plays:
enter) track. The final keyframes must still match the sound's persistent mix, as before. Without aninitialValueorstartValue, the track starts at its persistent level, as Route Graphics does forenter.exit) track, as a visual update animation plays on a removed element. An update that fades to 0 fades the music out.Transition and update tracks now compile through one helper.
docs/RouteEngine.mdand the audio effect resource schema description document the rule.Transition effects are unchanged. #355 separately skips a transition effect on music that keeps playing.
Validation
src,startAt,endAt,startDelayMs), switching sound ids, retained plus added plus removed sounds in one update, stop as an outgoing track, speed validation on stop lines, and the endpoint rule. 14 of them fail onmain; the other two guard behaviormainalready has.vt/specs/audioChannels/specs, in the style ofaudio-effects-initial-entry.yaml, run the built engine in Chromium and assert the render state and emitted effect:audio-effects-update-initial-entry,audio-effects-update-source-change, andaudio-effects-update-stop. All three pass and fail onmain, where the line throws: the music never starts, the old track keeps playing, or the music never stops. The stop spec checks the outgoing fade-to-0 track. Running all 23audioChannelsspecs locally (rtgl vt screenshot --folder audioChannels), 22 pass.audio-effects-initial-entryfails the same way onmain("expected 70, got 100"), so it predates this PR. These specs are not in CI, which only runsrobustness/*.yamlVT specs that have screenshot references.entertracks.OfflineAudioContext) and measured the output level every 100 ms. Route Graphics accepted every effect.0.11constant.initialValue: 0→ 100 over 1 s) on music start:0.01 0.02 … 0.10 0.11, an audible fade-in.0.11until 0.5 s, then the new track fades in from0.02to0.11over 1 s.0.11until 0.5 s, then0.10 0.08 … 0.01 0.00, an audible fade-out.bun run lint,check:test-markers,format:changed, andbun run testpass (2,178 tests).Review
A code review found these; fixed in this PR:
A second review found more; fixed in this PR:
+0.2step overshot (0.7 → 0.5instead of-0.2 → 0.5).Not changed here:
engine.initwhile the renderer still plays the same track, an entry-only effect can mismatch the renderer's lifecycle. Initial transition effects already behave this way, and Creator's snapshot mode avoids it.Version bumped to 1.46.6.