feat(slint): lyrics sync engine with karaoke fill and auto-center scroll
S4 of the lyrics epic: ms-precision position source, 30Hz sync engine, word-anchored karaoke fill, auto-centered ladder scroll, QConnect peer following. - qbz-player: read-only SharedState::current_position_ms() derived from the existing playback_start_millis/position_at_start anchors (Q1; no stream/seek/format path touched) + unit test - qbz-lyrics: new sync module porting the Tauri active-line math (binary search active index, per-line progress with the 0.99 snap) plus the word-anchored clip fraction for Qobuz wsync lines (char-proportional word width approximation, Q2); unit tests - qbz-slint: lyrics_sync engine - adaptive slint::Timer (33ms while panel open + synced + playing, 250ms gate polling otherwise), equality-guarded pushes, fill animation zeroed across discontinuities (line change / backward seek); kick() on doc commit and panel open - QConnect (Q7): the poll loop controller branch publishes the raw renderer anchor; the engine extrapolates it per tick so lyrics follow the peer (Tauri freezes); local fallthrough clears the anchor - LyricsLinesView: karaoke fill via clipped bright overlay text over the dim base (rect-clip approximation, D5); auto-center scroll from layout-relative active-row geometry, smooth for <=2-line moves and instant for jumps/initial sync, animated via a separate scroll-target property so user wheel input is never animated - LyricsState: line-progress + fill-anim-ms properties cc
This commit is contained in:
9 files changed
+761
-18
No files matched your search
@@ -63,6 +63,7 @@ mod local_library;
|
||||
mod local_playlist;
|
||||
mod local_library_settings;
|
||||
mod lyrics;
|
||||
mod lyrics_sync;
|
||||
mod media_controls;
|
||||
mod locallibrary_prefs;
|
||||
mod tag_editor;
|
||||
@@ -6410,6 +6411,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let weak = window.as_weak();
|
||||
let handle = tokio_rt.handle().clone();
|
||||
window.global::<LyricsState>().on_panel_opened(move || {
|
||||
// Immediate sync pass for an already-loaded doc, so opening
|
||||
// mid-song lands on the correct line instantly (even paused) —
|
||||
// the duplicate-fetch guard below skips the re-fetch then.
|
||||
lyrics_sync::kick();
|
||||
let runtime = runtime.clone();
|
||||
let weak = weak.clone();
|
||||
handle.spawn(async move {
|
||||
@@ -6422,6 +6427,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
}
|
||||
|
||||
// S4 lyrics sync engine — a UI-thread `slint::Timer` driving
|
||||
// `LyricsState.active-index` / `line-progress` at ~30Hz while the panel
|
||||
// is open + the doc is synced + playback is live (idle gate polling
|
||||
// otherwise). Position: local ms getter, or the published QConnect peer
|
||||
// anchor while controlling a remote renderer (Q7).
|
||||
lyrics_sync::start(app_runtime.clone(), window.as_weak());
|
||||
|
||||
// Album track search — client-side filter, no backend round-trip.
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
|
||||
Reference in new issue
Block a user