- Add spectrum-analyzer crate for FFT processing - Create visualizer module with: - RingBuffer: lockless SPSC buffer for audio samples - FFT processor: dedicated thread for spectrum analysis - TappedSource: rodio Source wrapper for sample capture - VisualizerTap: shared state for audio thread integration - Add Tauri commands: set_visualizer_enabled, is_visualizer_enabled - Register visualizer in AppState and lib.rs Backend compiles. Next: integrate with audio thread to capture samples.
20 lines
501 B
Rust
20 lines
501 B
Rust
//! Visualizer Commands
|
|
//!
|
|
//! Tauri commands for controlling the audio visualizer.
|
|
|
|
use tauri::State;
|
|
use crate::AppState;
|
|
|
|
/// Enable or disable the audio visualizer
|
|
#[tauri::command]
|
|
pub fn set_visualizer_enabled(enabled: bool, state: State<'_, AppState>) -> Result<(), String> {
|
|
state.visualizer.set_enabled(enabled);
|
|
Ok(())
|
|
}
|
|
|
|
/// Check if the visualizer is enabled
|
|
#[tauri::command]
|
|
pub fn is_visualizer_enabled(state: State<'_, AppState>) -> bool {
|
|
state.visualizer.is_enabled()
|
|
}
|