From 67eea2d1ea85cd7703f38f631e79505c09e2ad8d Mon Sep 17 00:00:00 2001 From: Matt Razza <504088+mrazza@users.noreply.github.com> Date: Fri, 3 Jul 2026 23:17:55 -0400 Subject: [PATCH] feat: increase maximum volume limit to 200 --- smoc.Tests/Ui/NowPlayingBarTest.cs | 14 ++++++++++++++ smoc/Services/Audio/IAudioService.cs | 2 +- smoc/Services/IPlaybackQueueService.cs | 2 +- smoc/Ui/NowPlayingBar.cs | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/smoc.Tests/Ui/NowPlayingBarTest.cs b/smoc.Tests/Ui/NowPlayingBarTest.cs index 8fc361b..b15e933 100644 --- a/smoc.Tests/Ui/NowPlayingBarTest.cs +++ b/smoc.Tests/Ui/NowPlayingBarTest.cs @@ -121,9 +121,23 @@ public void Volume_VolumeCommand_NoArguments_DoesNothing() { _mockPlaybackQueue.Verify(); } + /// + /// Tests that setting a volume beyond 200% does nothing. + /// [Fact] public void Volume_VolumeCommand_TooLarge_DoesNothing() { _mockPlaybackQueue.SetupSet((ps) => ps.Volume = It.IsAny()).Verifiable(Times.Never()); + using var context = NewNowPlayingContext() + .Then((_) => _commandService.ExecuteCommand("v/201")); + _mockPlaybackQueue.Verify(); + } + + /// + /// Tests that the volume command sets the volume correctly to 200%. + /// + [Fact] + public void Volume_VolumeCommand_SetsVolumeToMax() { + _mockPlaybackQueue.SetupSet((ps) => ps.Volume = 2.0f).Verifiable(Times.Once()); using var context = NewNowPlayingContext() .Then((_) => _commandService.ExecuteCommand("v/200")); _mockPlaybackQueue.Verify(); diff --git a/smoc/Services/Audio/IAudioService.cs b/smoc/Services/Audio/IAudioService.cs index 733ebd2..5bd5c23 100644 --- a/smoc/Services/Audio/IAudioService.cs +++ b/smoc/Services/Audio/IAudioService.cs @@ -8,7 +8,7 @@ namespace Smoc.Services.Audio; public interface IAudioService : IDisposable { /// - /// Gets or sets the master volume (0.0 to 1.0). + /// Gets or sets the master volume (0.0 to 2.0). /// float Volume { get; set; } diff --git a/smoc/Services/IPlaybackQueueService.cs b/smoc/Services/IPlaybackQueueService.cs index 379aefc..9ecdbd3 100644 --- a/smoc/Services/IPlaybackQueueService.cs +++ b/smoc/Services/IPlaybackQueueService.cs @@ -72,7 +72,7 @@ public interface IPlaybackQueueService : IDisposable { int CurrentPlaybackIndex { get; } /// - /// Gets or sets the master volume (0.0 to 1.0). + /// Gets or sets the master volume (0.0 to 2.0). /// float Volume { get; set; } diff --git a/smoc/Ui/NowPlayingBar.cs b/smoc/Ui/NowPlayingBar.cs index c1658e7..07ea863 100644 --- a/smoc/Ui/NowPlayingBar.cs +++ b/smoc/Ui/NowPlayingBar.cs @@ -167,9 +167,9 @@ private void OnSetVolumeCommand(string command, string args) { return; } - if (!int.TryParse(splitArgs[0], out int volume) || volume < 0 || volume > 100) { + if (!int.TryParse(splitArgs[0], out int volume) || volume < 0 || volume > 200) { Logging.Warning($"Invalid volume: {splitArgs[0]}"); - _mainWindow.DisplayError($"invalid volume: {splitArgs[0]} ([0-100] expected)"); + _mainWindow.DisplayError($"invalid volume: {splitArgs[0]} ([0-200] expected)"); return; }