feat(slint): ImmersiveView base - reusable atmosphere + compact player + audio-transport lift

Foundation for the ImmersiveView Slint port. Authored by Codex and accepted by
the owner after live visual iteration; committed here so the panel work builds
on top of it. The Album Reactive foreground was intentionally left out (a prior
attempt was rejected) so it can be rebuilt cleanly on this base.

Audio-transport lift (slice 1):
- qbz-audio: VizFrame/VizSink trait + spawn_visualizer_thread; FFT producer
  lifted off tauri::AppHandle. Protected audio path untouched (seam =
  RingBuffer.snapshot).
- src-tauri: fft_processor gutted to a thin TauriVizSink emitting byte-identical
  viz:* events.
- qbz-app: AppRuntime::with_visualizer + visualizer_tap accessor.
- qbz-slint: SlintVizSink + install() publishing VisualizerState
  bars/spectral/energy/waveform/transient at 30fps, zero IPC.

Immersive base (slice 2a):
- immersive.rs: host-side atmosphere generation from decoded artwork
  (8x8 sample -> upscale -> blur -> saturate/contrast/normalize -> vignette),
  mirroring Tauri texture-loader.ts::generateAtmosphere; plus glow_color.
- ImmersiveAtmosphere.slint: reusable animated atmosphere (4 counter-drifting
  copies via animation-tick); usable static for Album/Artist headers later.
- ImmersiveView.slint: base overlay (atmosphere + auto-hide Tauri-shaped compact
  player only). Foreground panels are rebuilt on this base.
- AppShell mounts the overlay; ViewMode menu opens Immersive in PlayerBar/Small.

cc
This commit is contained in:
vicrodh committed 2026-06-13 04:11:53 -06:00
1 parent 4e8703d660
commit 3adb517236
18 files changed
+1275 -341

No files matched your search

+36
View File
@@ -50,6 +50,10 @@ pub struct AppRuntime<A: FrontendAdapter + Send + Sync + 'static> {
runtime: Arc<RuntimeManager>,
user_paths: UserDataPaths,
session: Mutex<Option<ActiveSession>>,
/// The visualizer tap handed to the player, retained so the shell can start
/// the FFT producer and toggle capture. `None` for shells that do not drive
/// audio visualization (the default `new`/`with_audio_settings` path).
visualizer_tap: Option<VisualizerTap>,
}
impl<A: FrontendAdapter + Send + Sync + 'static> AppRuntime<A> {
@@ -71,6 +75,7 @@ impl<A: FrontendAdapter + Send + Sync + 'static> AppRuntime<A> {
runtime: Arc::new(RuntimeManager::new()),
user_paths: UserDataPaths::new(),
session: Mutex::new(None),
visualizer_tap: None,
}
}
@@ -95,6 +100,37 @@ impl<A: FrontendAdapter + Send + Sync + 'static> AppRuntime<A> {
Self::with_audio_settings(adapter, device_name, audio_settings, None)
}
/// Build like [`AppRuntime::new`], but also wire a [`VisualizerTap`] into the
/// player and retain it so the shell can start the frontend-agnostic FFT
/// producer ([`qbz_audio::visualizer::spawn_visualizer_thread`]) and toggle
/// capture via the tap's `set_enabled`. Used by the Slint shell for the
/// ImmersiveView audio visualizers. The tap starts disabled, so it adds no
/// runtime cost until the immersive view enables it.
pub fn with_visualizer(adapter: A) -> Self {
let (device_name, audio_settings) = AudioSettingsStore::new()
.ok()
.and_then(|store| {
store
.get_settings()
.ok()
.map(|settings| (settings.output_device.clone(), settings))
})
.unwrap_or_else(|| {
log::info!("[AppRuntime] No saved audio settings, using defaults");
(None, AudioSettings::default())
});
let tap = VisualizerTap::new();
let mut rt =
Self::with_audio_settings(adapter, device_name, audio_settings, Some(tap.clone()));
rt.visualizer_tap = Some(tap);
rt
}
/// The visualizer tap, if this runtime was built with [`AppRuntime::with_visualizer`].
pub fn visualizer_tap(&self) -> Option<&VisualizerTap> {
self.visualizer_tap.as_ref()
}
/// Initialize the core (extracts Qobuz bundle tokens).
///
/// Best-effort and offline-tolerant: a network failure here leaves the