Skip to main content

rustriff_lib/domain/dto/effect/
ir_profile_dto.rs

1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4/// Data transfer object describing a single cabinet impulse-response profile.
5///
6/// Instances are produced by [`FileService::get_all_ir_profiles`] and returned
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
8#[ts(export)]
9pub struct IrProfileDto {
10    /// `.wav` filename as stored on disk (e.g. `"vintage-4x12.wav"`).
11    /// This value is what gets stored inside [`CabinetDto::ir_file_path`] and
12    /// passed back to the backend when creating or restoring a Cabinet effect.
13    /// [`CabinetDto::ir_file_path`]: crate::domain::dto::effect::cabinet_dto::CabinetDto::ir_file_path
14    pub file_name: String,
15
16    /// Human-readable display name shown in the frontend dropdown.
17    /// Derived from `file_name` by stripping the `.wav` extension and replacing
18    /// hyphens and underscores with spaces (e.g. `"vintage-4x12.wav"` → `"vintage 4x12"`).
19    pub label: String,
20
21    /// `true` when this profile was uploaded by the user and lives in the custom IR
22    /// directory rather than the bundled `resources/default_ir` folder.
23    /// Only custom profiles may be removed; attempting to remove a default profile
24    /// returns an error from [`remove_ir_profile`].
25    /// [`remove_ir_profile`]: crate::commands::effect_commands::cabinet_ir::remove_ir_profile
26    pub is_custom: bool,
27
28    /// `true` when at least one Cabinet effect in any active channel currently
29    /// references this profile by `file_name`.
30    /// The frontend uses this to disable the remove-button and prevent deleting
31    /// an IR that is actively shaping the tone of a running effect chain.
32    pub is_in_use: bool,
33}