From 72c268647fe802ec244cc5b901b884d6680def4e Mon Sep 17 00:00:00 2001 From: Awesomegamer6566 <50709579+Awesomegamer6566@users.noreply.github.com> Date: Fri, 16 Sep 2022 12:08:19 -0700 Subject: [PATCH] Fix changing BGM Interpolation setting with left and right keys (#161) * Fix changing BGM Interpolation setting with left and right keys * Actually fix changing BGM Interpolation Setting with left and right keys --- src/menu/settings_menu.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/menu/settings_menu.rs b/src/menu/settings_menu.rs index 21aede1..046f335 100644 --- a/src/menu/settings_menu.rs +++ b/src/menu/settings_menu.rs @@ -670,7 +670,8 @@ impl SettingsMenu { let _ = state.settings.save(ctx); } } - MenuSelectionResult::Selected(SoundMenuEntry::BGMInterpolation, toggle) => { + MenuSelectionResult::Selected(SoundMenuEntry::BGMInterpolation, toggle) + | MenuSelectionResult::Right(SoundMenuEntry::BGMInterpolation, toggle, _) => { if let MenuEntry::DescriptiveOptions(_, value, _, _) = toggle { let (new_mode, new_value) = match *value { 0 => (InterpolationMode::Linear, 1), @@ -679,11 +680,26 @@ impl SettingsMenu { 3 => (InterpolationMode::Polyphase, 4), _ => (InterpolationMode::Nearest, 0), }; + + *value = new_value; + state.settings.organya_interpolation = new_mode; + state.sound_manager.set_org_interpolation(new_mode); + let _ = state.settings.save(ctx); + } + } + MenuSelectionResult::Left(SoundMenuEntry::BGMInterpolation, toggle, _) => { + if let MenuEntry::DescriptiveOptions(_, value, _, _) = toggle { + let (new_mode, new_value) = match *value { + 0 => (InterpolationMode::Polyphase, 4), + 1 => (InterpolationMode::Nearest, 0), + 2 => (InterpolationMode::Linear, 1), + 3 => (InterpolationMode::Cosine, 2), + _ => (InterpolationMode::Cubic, 3), + }; *value = new_value; state.settings.organya_interpolation = new_mode; state.sound_manager.set_org_interpolation(new_mode); - let _ = state.settings.save(ctx); } }