refactor: extract psysonic-audio crate (M3/7)

Moves all audio playback code (Symphonia decode, rodio output, HTTP
streaming, gapless, previews, and the seven stream/ source-type
submodules from the prior split) out of the top crate into a new
psysonic-audio crate.

  crates/psysonic-audio/                  new lib crate, depends on
                                          psysonic-core + psysonic-analysis
    src/{engine,helpers,decode,…}.rs      flattened layout (no more
                                          extra audio/ namespace level)
    src/stream/                           seven submodules from M0
    src/lib.rs                            re-exports macros from
                                          psysonic-core and the public
                                          API surface

The audio↔analysis edges identified in the dep survey are now real
crate deps (audio depends on analysis directly: AnalysisCache reads,
recommended_gain_for_target, submit_analysis_cpu_seed). Only the
analysis→audio back-edge goes through the PlaybackQueryHandle port
registered in M2.

Cross-crate ref migrations applied via batch sed:
  crate::audio::*               → crate::*       (intra-crate)
  crate::analysis_cache::*      → psysonic_analysis::analysis_cache::*
  crate::submit_analysis_cpu_seed → psysonic_analysis::analysis_runtime::*
  crate::subsonic_wire_user_agent → psysonic_core::user_agent::*

Top crate keeps `crate::audio::*` paths working via
`pub use psysonic_audio as audio;` — lib_commands/cli callers untouched.
`stop_audio_engine` (mac process-exit cleanup) moved into the audio
crate as `pub fn stop_audio_engine` since it reaches AudioEngine
internals; tray.rs now re-exports the moved fn.

Two small visibility promotions in engine.rs:
  pub(crate) fn analysis_track_id_is_current_playback   → pub
  pub(crate) fn ranged_loudness_backfill_should_defer    → pub

Behaviour preserving. Cargo check + clippy --workspace clean.
This commit is contained in:
Psychotoxical
2026-05-09 13:33:44 +02:00
parent ff456dd823
commit 41e75663f1
35 changed files with 126 additions and 54 deletions
+29
View File
@@ -3609,6 +3609,7 @@ dependencies = [
"lofty",
"md5",
"psysonic-analysis",
"psysonic-audio",
"psysonic-core",
"reqwest",
"ringbuf",
@@ -3656,6 +3657,34 @@ dependencies = [
"tokio",
]
[[package]]
name = "psysonic-audio"
version = "1.46.0-dev"
dependencies = [
"biquad",
"dasp_sample",
"futures-util",
"id3",
"libc",
"lofty",
"md5",
"psysonic-analysis",
"psysonic-core",
"reqwest",
"ringbuf",
"rodio",
"serde",
"serde_json",
"symphonia",
"symphonia-adapter-libopus",
"tauri",
"thread-priority",
"tokio",
"url",
"windows 0.62.2",
"zbus 5.15.0",
]
[[package]]
name = "psysonic-core"
version = "1.46.0-dev"