Skip to main content

rustriff_lib/
config.rs

1/// Application-wide configuration constants.
2///
3/// This module provides a single source of truth for configuration values
4/// that are referenced throughout the application, ensuring consistency
5///
6/// between backend logic, frontend defaults, and bundled resources.
7/// Default cabinet impulse-response WAV file name loaded when no explicit
8/// profile is selected by the user.
9///
10/// **Important**: This filename must match one of the WAV files bundled in
11/// `resources/default_ir/` so that newly created Cabinet effects work
12/// out-of-the-box without falling back to passthrough mode.
13pub const DEFAULT_IR_FILE: &str = "Vox-ac30.wav";
14/// Filename used for the persisted amplifier configuration JSON document.
15pub const AMP_CONFIG_FILE_NAME: &str = "amp-config.json";
16/// Initializes the application's tracing subscriber for structured logging.
17///
18/// Reads the log filter from the `RUST_LOG` environment variable if present,
19/// otherwise defaults to `info` level for all modules.
20pub fn init_tracing() {
21    use tracing_subscriber::EnvFilter;
22
23    tracing_subscriber::fmt()
24        .with_env_filter(
25            EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
26        )
27        .init();
28}
29
30/// Returns the default cabinet IR filename.
31///
32/// This Tauri command exposes the backend's `DEFAULT_IR_FILE` constant to
33/// the frontend, ensuring the UI uses the same default as the backend logic.
34#[tauri::command]
35pub fn get_default_ir_file() -> String {
36    DEFAULT_IR_FILE.to_string()
37}