mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-21 22:15:40 +00:00
7e8acd86d6
Pull the atomic sink-swap block (~50 LOC) out of audio_play into play_input::swap_in_new_sink. The helper takes a SinkSwapInputs struct (sink, duration_secs, volume, gain_linear, fadeout trigger + samples, crossfade flag, measured fade seconds) and: 1. Locks state.current, atomically replaces sink + duration + seek/play timestamps + volume + replay-gain + fade-out handles, returns the old sink + its old fade-out handles. 2. If crossfade is on: stores total fade samples, flips trigger atomic on the old TriggeredFadeOut, parks the old sink in fading_out_sink, spawns a small task that drops it after `fade_secs + 0.5 s`. 3. If crossfade is off: stops the old sink immediately. Behaviour-preserving — same lock scope, same atomic ordering, same cleanup-task lifetime. audio/commands.rs: 600 → 563 LOC. With this the audio_play body has shrunk from the original ~760 LOC monolith to a top-level orchestration of named helper calls.