|
|
@@ -35,6 +35,7 @@ namespace Ryujinx.Ui
|
|
|
private const int SwitchPanelHeight = 720;
|
|
|
private const int TargetFps = 60;
|
|
|
private const float MaxResolutionScale = 4.0f; // Max resolution hotkeys can scale to before wrapping.
|
|
|
+ private const float VolumeDelta = 0.05f;
|
|
|
|
|
|
public ManualResetEvent WaitEvent { get; set; }
|
|
|
public NpadManager NpadManager { get; }
|
|
|
@@ -57,6 +58,7 @@ namespace Ryujinx.Ui
|
|
|
private readonly long _ticksPerFrame;
|
|
|
|
|
|
private long _ticks = 0;
|
|
|
+ private float _newVolume;
|
|
|
|
|
|
private readonly Stopwatch _chrono;
|
|
|
|
|
|
@@ -643,6 +645,20 @@ namespace Ryujinx.Ui
|
|
|
(MaxResolutionScale + GraphicsConfig.ResScale - 2) % MaxResolutionScale + 1;
|
|
|
}
|
|
|
|
|
|
+ if (currentHotkeyState.HasFlag(KeyboardHotkeyState.VolumeUp) &&
|
|
|
+ !_prevHotkeyState.HasFlag(KeyboardHotkeyState.VolumeUp))
|
|
|
+ {
|
|
|
+ _newVolume = MathF.Round((Device.GetVolume() + VolumeDelta), 2);
|
|
|
+ Device.SetVolume(_newVolume);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (currentHotkeyState.HasFlag(KeyboardHotkeyState.VolumeDown) &&
|
|
|
+ !_prevHotkeyState.HasFlag(KeyboardHotkeyState.VolumeDown))
|
|
|
+ {
|
|
|
+ _newVolume = MathF.Round((Device.GetVolume() - VolumeDelta), 2);
|
|
|
+ Device.SetVolume(_newVolume);
|
|
|
+ }
|
|
|
+
|
|
|
_prevHotkeyState = currentHotkeyState;
|
|
|
}
|
|
|
|
|
|
@@ -675,7 +691,9 @@ namespace Ryujinx.Ui
|
|
|
Pause = 1 << 3,
|
|
|
ToggleMute = 1 << 4,
|
|
|
ResScaleUp = 1 << 5,
|
|
|
- ResScaleDown = 1 << 6
|
|
|
+ ResScaleDown = 1 << 6,
|
|
|
+ VolumeUp = 1 << 7,
|
|
|
+ VolumeDown = 1 << 8
|
|
|
}
|
|
|
|
|
|
private KeyboardHotkeyState GetHotkeyState()
|
|
|
@@ -717,6 +735,16 @@ namespace Ryujinx.Ui
|
|
|
state |= KeyboardHotkeyState.ResScaleDown;
|
|
|
}
|
|
|
|
|
|
+ if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.VolumeUp))
|
|
|
+ {
|
|
|
+ state |= KeyboardHotkeyState.VolumeUp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.VolumeDown))
|
|
|
+ {
|
|
|
+ state |= KeyboardHotkeyState.VolumeDown;
|
|
|
+ }
|
|
|
+
|
|
|
return state;
|
|
|
}
|
|
|
}
|