roomeq-model 0.5.5

RoomEQ configuration, pipeline, and DSP-chain contracts
Documentation
use super::default::default_tilt_reference_freq;
use super::default::default_tilt_slope;
use super::role_target_config::RoleTargetConfig;
use super::types::TargetShape;
use super::user_preference::UserPreference;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// Unified target response configuration for room correction
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct TargetResponseConfig {
    /// Target shape preset
    #[serde(default)]
    pub shape: TargetShape,
    /// Slope in dB per octave (used when shape == Custom)
    #[serde(default = "default_tilt_slope")]
    pub slope_db_per_octave: f64,
    /// Reference frequency where target shape equals 0 dB (Hz)
    #[serde(default = "default_tilt_reference_freq")]
    pub reference_freq: f64,
    /// Path to custom target curve CSV (used when shape == File)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub curve_path: Option<std::path::PathBuf>,
    /// User preference adjustments (layered ON TOP of the target shape)
    #[serde(default)]
    pub preference: UserPreference,
    /// Enable broadband pre-correction (shelf+gain fit before fine EQ)
    #[serde(default)]
    pub broadband_precorrection: bool,
    /// Optional home-cinema role-aware target adjustments.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub role_targets: Option<RoleTargetConfig>,
}

impl Default for TargetResponseConfig {
    fn default() -> Self {
        Self {
            shape: TargetShape::Flat,
            slope_db_per_octave: default_tilt_slope(),
            reference_freq: default_tilt_reference_freq(),
            curve_path: None,
            preference: UserPreference::default(),
            broadband_precorrection: false,
            role_targets: None,
        }
    }
}