Skip to content

Commit 9ca7644

Browse files
authored
feat(studio): play the scenario's audio while previewing (#182)
The studio had no audio output at all — no backend in its dependencies, no stream anywhere, Present mode included. Judging a cut without sound is half the job, so the transport now plays. What it plays is the output of mix_audio_tracks, the same function the encoder calls, so start/end, fades, per-track volume and volume keyframes are heard exactly as they will be muxed. A preview that ignored the envelope would misreport the edit. The mix spans the whole scenario, silence included, which lets the playhead follow the audio clock instead of a 1/fps timer that drifts against the sound card over a long scenario. With no track — or no output device, as in CI — the timer stays in charge and nothing changes. cpal's stream is not Send, so it runs on its own thread behind a command channel; position and state are published as atomics the UI reads without touching it. Seeking publishes the new position on the caller's side so a scrub cannot read back as the old one and snap the playhead backwards. Play/pause, scrub and a mute button drive it; the mix is rebuilt whenever the model reloads, so opening another file does not keep the previous sound.
1 parent da98916 commit 9ca7644

6 files changed

Lines changed: 481 additions & 20 deletions

File tree

Cargo.lock

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rustmotion-studio/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ serde_json = { version = "1", features = ["preserve_order"] }
2222
tokio = { version = "1", features = ["time"] }
2323
dioxus-icons = { version = "0.1.0", default-features = false }
2424
rfd = "0.17"
25+
rodio = { version = "0.22", default-features = false, features = ["playback"] }
2526
dirs = "6.0.0"
2627
palette = { version = "0.7.6", default-features = false }
2728
schemars = "0.8"

0 commit comments

Comments
 (0)