pwsp 1.7.4

PWSP lets you play audio files through your microphone. Has both CLI and GUI clients.
use crate::types::{
    audio_player::{PlayerState, TrackInfo},
    config::HotkeyConfig,
};

use egui::Id;

use std::{
    collections::{HashMap, HashSet},
    path::PathBuf,
    time::Instant,
};

#[derive(Default, Debug)]
pub struct TrackUiState {
    pub position_slider_value: f32,
    pub volume_slider_value: f32,

    pub position_dragged: bool,
    pub volume_dragged: bool,

    pub ignore_position_update_until: Option<Instant>,
    pub ignore_volume_update_until: Option<Instant>,
}

#[derive(Default, Debug)]
pub struct AppState {
    pub search_query: String,

    pub track_ui_states: HashMap<u32, TrackUiState>,

    pub show_settings: bool,
    pub volume_dragged: bool,
    pub force_focus_search: bool,

    pub volume_slider_value: f32,

    pub search_field_id: Option<Id>,

    pub ignore_volume_update_until: Option<Instant>,

    pub current_dir: Option<PathBuf>,
    pub dirs: Vec<PathBuf>,
    pub dirs_to_remove: HashSet<PathBuf>,

    pub selected_file: Option<PathBuf>,
    pub files: HashSet<PathBuf>,

    pub show_hotkeys: bool,
    pub hotkey_config: HotkeyConfig,
    pub hotkey_search_query: String,
    pub assigning_hotkey_slot: Option<String>,
    pub assigning_hotkey_for_file: Option<PathBuf>,
    pub hotkey_capture_active: bool,
}

#[derive(Default, Debug, Clone)]
pub struct AudioPlayerState {
    pub state: PlayerState,
    pub new_state: Option<PlayerState>,

    pub tracks: Vec<TrackInfo>,

    pub volume: f32, // Master volume

    pub current_input: String,
    pub all_inputs: HashMap<String, String>,
    pub all_inputs_sorted: Vec<(String, String)>,

    pub is_daemon_running: bool,

    pub hotkey_config: Option<HotkeyConfig>,
}