fix(studio): re-analyse audio on every scenario load, and report failures - #181
Merged
Conversation
…ures The studio analysed audio tracks exactly once, in run_preview_root. Every later load path — the file watcher, opening a scenario from the library, undo — replaced the model without touching the analysis, so a scenario that gained a track, or whose track path was corrected, kept the previous (or no) analysis for the whole session. waveform and audio_spectrum then drew their flat fallback with nothing to explain it, because analyze_scenario_audio turned a failed decode into a bare `continue`. Move the call into StudioModel::new, the constructor every load path already funnels through, and return the tracks that could not be analysed instead of swallowing them. The encoders print them as a warning; the studio shows them in the topbar next to the write-error indicator. The cache is keyed by path alone (the painters look tracks up that way), so also record what each entry was computed from — file length, mtime, fps — and re-analyse when that changes. Re-exporting a mix under the same name while the studio is open used to keep serving the first envelope.
LeadcodeDev
added a commit
that referenced
this pull request
Aug 12, 2026
#195) A gif component showed its first frame and then nothing — no error, no warning, scenario valid, render successful. Every frame after the first is usually a sub-rectangle holding only the pixels that changed. The decoder stored frame.buffer alongside the *canvas* dimensions, so the buffer was shorter than width * height * 4; raster_from_data returned None and the `if let Some(img)` arm was skipped. The first frame is full-canvas in most encoders, which is why it was the only one that ever appeared. Compose each frame onto a persistent canvas at (left, top), honouring alpha 0 as "leave what is underneath" and the disposal method (Background clears the frame's rect, Previous restores the canvas, Keep/Any leave it). Even at the right size, drawing an optimised frame alone would have shown a fragment on an empty background. The three silent exits now report once per source, the way #181 made the audio analysis report. AlphaType is Unpremul: the decoder emits straight RGBA.
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.
What
The studio analysed audio tracks exactly once, in
run_preview_root. Every later load path — the file watcher, opening a scenario from the library, undo — replaced the model without touching the analysis.So a scenario that gained a track, or whose track path was corrected, kept the previous (or no) analysis for the whole session.
waveformandaudio_spectrumthen drew their flat fallback with nothing to explain it, becauseanalyze_scenario_audioturned a failed decode into a barecontinue.Found while building a showcase scenario: the preview showed a flat line while the rendered mp4 showed the real envelope, and nothing in either output said why.
How
StudioModel::new, the constructor every load path already funnels through.analyze_scenario_audioreturns the tracks it could not analyse instead of swallowing them. The encoders print a warning; the studio shows them in the topbar next to the write-error indicator.Tests
Two added in
audio_tests:cargo test --workspacegreen,cargo fmt,cargo clippy --all-targetsclean.