roomeq-model 0.5.5

RoomEQ configuration, pipeline, and DSP-chain contracts
Documentation
use super::default::default_high_freq_extra_deadband_db;
use super::default::default_high_freq_guard_max_q;
use super::default::default_high_freq_guard_start_hz;
use super::default::default_high_freq_smoothing_n;
use super::default::default_true;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// Safer high-frequency correction behavior when users opt above the
/// conservative RoomEQ correction ceiling.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct HighFrequencyCorrectionConfig {
    /// Enable the high-frequency safeguard.
    #[serde(default = "default_true")]
    pub enabled: bool,
    /// Frequency above which the safeguard is considered active.
    #[serde(default = "default_high_freq_guard_start_hz")]
    pub start_hz: f64,
    /// Minimum extra deadband added above `start_hz`.
    #[serde(default = "default_high_freq_extra_deadband_db")]
    pub extra_deadband_db: f64,
    /// Stronger psychoacoustic smoothing resolution above the guard start,
    /// expressed as 1/N octave. Lower N means broader smoothing.
    #[serde(default = "default_high_freq_smoothing_n")]
    pub smoothing_n: usize,
    /// If the global Q bound is still at/above this value, cap it when the
    /// policy is applied. Frequency-selective Q caps are not available in the
    /// current PEQ parameterization, so this is intentionally conservative.
    #[serde(default = "default_high_freq_guard_max_q")]
    pub max_q: f64,
}

impl Default for HighFrequencyCorrectionConfig {
    fn default() -> Self {
        Self {
            enabled: true,
            start_hz: default_high_freq_guard_start_hz(),
            extra_deadband_db: default_high_freq_extra_deadband_db(),
            smoothing_n: default_high_freq_smoothing_n(),
            max_q: default_high_freq_guard_max_q(),
        }
    }
}