feat(qbz-audio): implement Phase 2 - audio backend system
CRITICAL: Copied audio modules from qbz-nix WITHOUT modifying logic. This code handles bit-perfect playback and is IMMUTABLE. Copied modules: - backend.rs: Backend trait and manager - pipewire_backend.rs: PipeWire/PulseAudio backend - alsa_backend.rs: ALSA backend with device enumeration - pulse_backend.rs: PulseAudio fallback - alsa_direct.rs: Direct ALSA hardware access (hw:X,Y) - diagnostic.rs: Audio diagnostic tools - loudness.rs: ReplayGain extraction - loudness_analyzer.rs: EBU R128 analysis - loudness_cache.rs: SQLite cache for loudness data - dynamic_amplify.rs: Dynamic volume amplification - analyzer_tap.rs: Audio analyzer tap Dependencies: - Uses vendored rodio from src-tauri/vendor/rodio - symphonia-all feature for f32 pipeline - ebur128 for loudness analysis - rusqlite for caching Also updated qbz-models to remove incomplete audio types (AudioBackendType, AudioDevice) - these stay in qbz-audio.
This commit is contained in:
1 parent
deafa15205
commit
3c8fc35fcb
16 files changed
+3117
-52
No files matched your search
@@ -145,7 +145,8 @@ pub enum CoreEvent {
|
||||
|
||||
/// Audio backend changed
|
||||
AudioBackendChanged {
|
||||
backend: crate::playback::AudioBackendType,
|
||||
/// Backend name: "pipewire", "alsa", "pulse"
|
||||
backend: String,
|
||||
},
|
||||
|
||||
/// Audio system diagnostic info
|
||||
|
||||
@@ -38,10 +38,7 @@ pub mod types;
|
||||
// Re-export commonly used types at crate root
|
||||
pub use error::{QbzError, QbzResult};
|
||||
pub use events::CoreEvent;
|
||||
pub use playback::{
|
||||
AudioBackendType, AudioDevice, PlaybackState, PlaybackStatus, QueueState, QueueTrack,
|
||||
RepeatMode,
|
||||
};
|
||||
pub use playback::{PlaybackState, PlaybackStatus, QueueState, QueueTrack, RepeatMode};
|
||||
pub use traits::{FrontendAdapter, LoggingAdapter, NoOpAdapter};
|
||||
pub use types::{
|
||||
Album, AlbumSummary, Artist, ArtistAlbums, ArtistBiography, Favorites, Genre, GenreInfo,
|
||||
|
||||
@@ -117,27 +117,5 @@ impl Default for PlaybackStatus {
|
||||
}
|
||||
}
|
||||
|
||||
// ============ Audio Backend Types ============
|
||||
|
||||
/// Audio backend type selection
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum AudioBackendType {
|
||||
/// PipeWire/PulseAudio via CPAL (default, most compatible)
|
||||
PipeWire,
|
||||
/// Direct ALSA for bit-perfect playback
|
||||
AlsaDirect,
|
||||
}
|
||||
|
||||
impl Default for AudioBackendType {
|
||||
fn default() -> Self {
|
||||
Self::PipeWire
|
||||
}
|
||||
}
|
||||
|
||||
/// Audio device information
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AudioDevice {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub is_default: bool,
|
||||
}
|
||||
// Note: Audio backend types (AudioBackendType, AudioDevice, etc.) are defined
|
||||
// in qbz-audio crate to keep the audio module self-contained and immutable.
|
||||
Reference in new issue
Block a user