Skip to content

feat: save and load ir_gain and last selected preset#152

Merged
OpenSauce merged 3 commits intomainfrom
add-settings-and-presets
Dec 15, 2025
Merged

feat: save and load ir_gain and last selected preset#152
OpenSauce merged 3 commits intomainfrom
add-settings-and-presets

Conversation

@OpenSauce
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 15, 2025 21:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds persistence for IR gain values in presets and remembers the last selected preset across application restarts. The changes enable users to save their IR cabinet gain settings as part of presets and automatically load their most recently used preset when the application starts.

  • Added ir_gain field to the Preset structure with serde default support for backward compatibility
  • Added selected_preset field to Settings to persist the last opened preset
  • Updated preset loading/saving flow to handle IR gain values throughout the application

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/settings/mod.rs Added selected_preset field to persist the last selected preset name
src/preset/mod.rs Added ir_gain field with default value of 0.1 and updated constructor signature
src/gui/handlers/preset.rs Updated preset handler to propagate ir_gain through save/load operations and made load_preset_by_name public
src/gui/components/ir_cabinet_control.rs Updated constructor to accept gain parameter instead of hardcoding the default value
src/gui/app.rs Added logic to load last selected preset on startup, save selected preset to settings, and pass ir_gain to preset operations
presets/Sabbath.json Added ir_name and ir_gain fields to the preset
presets/Petrucci.json Added ir_gain field to the preset
Comments suppressed due to low confidence (1)

src/gui/app.rs:67

  • The IR gain from the loaded preset is set on the UI component but is never applied to the audio engine during initialization. After setting up the IR cabinet control with the preset's ir_gain on line 54, you should also call audio_manager.engine().set_ir_gain(preset.ir_gain) to ensure the audio engine uses the correct gain value when the app starts.
        let mut ir_cabinet_control = IrCabinetControl::new(settings.ir_bypassed, preset.ir_gain);
        ir_cabinet_control.set_available_irs(audio_manager.get_available_irs());

        if settings.ir_bypassed {
            audio_manager.engine().set_ir_bypass(true);
        }

        if let Some(ir_name) = preset.ir_name {
            ir_cabinet_control.set_selected_ir(Some(ir_name.clone()));
            audio_manager.engine().set_ir_cabinet(Some(ir_name));
        } else if let Some(first_ir) = ir_cabinet_control.get_selected_ir() {
            ir_cabinet_control.set_selected_ir(Some(first_ir.clone()));
            audio_manager.engine().set_ir_cabinet(Some(first_ir));
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OpenSauce OpenSauce enabled auto-merge (squash) December 15, 2025 22:09
@OpenSauce OpenSauce merged commit fe414e2 into main Dec 15, 2025
7 checks passed
@OpenSauce OpenSauce deleted the add-settings-and-presets branch December 15, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants