feat(audio): implement gapless playback for cached tracks
Backend: Add PlayNext command to audio thread that appends decoded sources to the existing Rodio Sink for seamless transitions. The audio thread detects when ~5s remain and signals gapless_ready via SharedState. Position-based transition detection updates track metadata when the queued source begins playing. Frontend: playerStore detects gapless_ready flag, invokes play_next_gapless (cache-only lookup), and handles transitions by advancing the queue without stop/play cycle. playbackService gains gaplessTransition option to skip stop_playback when backend already transitioned. Gapless is only eligible when: same sample rate/channels, cached data, Rodio backend (not ALSA Direct), not streaming, not a user skip. Falls back to normal stop-play flow when ineligible.
This commit is contained in:
1 parent
eaacc9e3a7
commit
a21f7c7a93
6 files changed
+434
-44
No files matched your search
@@ -336,6 +336,8 @@ pub fn run() {
|
||||
shuffle: Some(shuffle),
|
||||
repeat: Some(repeat.to_string()),
|
||||
normalization_gain,
|
||||
gapless_ready: player_state.is_gapless_ready(),
|
||||
gapless_next_track_id: player_state.get_gapless_next_track_id(),
|
||||
};
|
||||
let _ = app_handle.emit("playback:state", &event);
|
||||
api_server::broadcast_playback_event(&app_handle, &event);
|
||||
@@ -449,6 +451,7 @@ pub fn run() {
|
||||
commands::pause_playback,
|
||||
commands::resume_playback,
|
||||
commands::stop_playback,
|
||||
commands::play_next_gapless,
|
||||
commands::set_volume,
|
||||
commands::seek,
|
||||
commands::get_playback_state,
|
||||
|
||||
Reference in new issue
Block a user