diff --git a/README.md b/README.md
index 76e4ced..dc011b5 100644
--- a/README.md
+++ b/README.md
@@ -8,14 +8,17 @@
| Key | Action |
| --- | ------ |
-| `F1` | Open Settings Window |
-| `F2` | Load New Image |
-| `Space` | Toggle Play / Pause |
-| `Esc` | Stop Playback |
-| `→` | Next Track |
-| `←` | Previous Track |
-| `]` | Next Index |
-| `[` | Previous Index |
-| `.` | Fast Forward |
-| `,` | Rewind |
-| `E` | Toggle Emphasis |
\ No newline at end of file
+| **F1** | Open Settings Window |
+| **F2** | Load New Image |
+| **Space** | Toggle Play / Pause |
+| **Esc** | Stop Playback |
+| **→** | Next Track |
+| **←** | Previous Track |
+| **]** | Next Index |
+| **[** | Previous Index |
+| **.** | Fast Forward |
+| **,** | Rewind |
+| **+** | Volume Up |
+| **-** | Volume Down |
+| **M** | Mute |
+| **E** | Toggle Emphasis |
\ No newline at end of file
diff --git a/RedBookPlayer/GUI/MainWindow.xaml.cs b/RedBookPlayer/GUI/MainWindow.xaml.cs
index 235ff12..67e4583 100644
--- a/RedBookPlayer/GUI/MainWindow.xaml.cs
+++ b/RedBookPlayer/GUI/MainWindow.xaml.cs
@@ -178,6 +178,24 @@ namespace RedBookPlayer.GUI
playerView?.RewindButton_Click(this, null);
}
+ // Volume Up
+ else if(e.Key == App.Settings.VolumeUpKey || e.Key == Key.VolumeUp)
+ {
+ playerView?.VolumeUpButton_Click(this, null);
+ }
+
+ // Volume Down
+ else if(e.Key == App.Settings.VolumeDownKey || e.Key == Key.VolumeDown)
+ {
+ playerView?.VolumeDownButton_Click(this, null);
+ }
+
+ // Mute Toggle
+ else if(e.Key == App.Settings.ToggleMuteKey || e.Key == Key.VolumeMute)
+ {
+ playerView?.MuteToggleButton_Click(this, null);
+ }
+
// Emphasis Toggle
else if(e.Key == App.Settings.ToggleDeEmphasisKey)
{
diff --git a/RedBookPlayer/GUI/PlayerView.xaml.cs b/RedBookPlayer/GUI/PlayerView.xaml.cs
index dbf1a55..b36a556 100644
--- a/RedBookPlayer/GUI/PlayerView.xaml.cs
+++ b/RedBookPlayer/GUI/PlayerView.xaml.cs
@@ -35,6 +35,11 @@ namespace RedBookPlayer.GUI
///
private Timer _updateTimer;
+ ///
+ /// Last volume for mute toggling
+ ///
+ private int? _lastVolume = null;
+
public PlayerView() => InitializeComponent(null);
public PlayerView(string xaml) => InitializeComponent(xaml);
@@ -235,6 +240,32 @@ namespace RedBookPlayer.GUI
public void RewindButton_Click(object sender, RoutedEventArgs e) => Player.Rewind();
+ public void VolumeUpButton_Click(object sender, RoutedEventArgs e)
+ {
+ if(App.Settings.Volume < 100)
+ App.Settings.Volume++;
+ }
+
+ public void VolumeDownButton_Click(object sender, RoutedEventArgs e)
+ {
+ if(App.Settings.Volume > 0)
+ App.Settings.Volume--;
+ }
+
+ public void MuteToggleButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (_lastVolume == null)
+ {
+ _lastVolume = App.Settings.Volume;
+ App.Settings.Volume = 0;
+ }
+ else
+ {
+ App.Settings.Volume = _lastVolume.Value;
+ _lastVolume = null;
+ }
+ }
+
public void EnableDeEmphasisButton_Click(object sender, RoutedEventArgs e) => Player.ToggleDeEmphasis(true);
public void DisableDeEmphasisButton_Click(object sender, RoutedEventArgs e) => Player.ToggleDeEmphasis(false);
diff --git a/RedBookPlayer/GUI/SettingsWindow.xaml b/RedBookPlayer/GUI/SettingsWindow.xaml
index e846afe..ba416ba 100644
--- a/RedBookPlayer/GUI/SettingsWindow.xaml
+++ b/RedBookPlayer/GUI/SettingsWindow.xaml
@@ -29,7 +29,7 @@
Generate a TOC if the disc is missing one
- Volume
+ Default Volume
@@ -41,98 +41,80 @@
-
-
-
-
-
-
-
- Load Image
-
-
-
-
-
-
-
+
+
+
+
+
- Toggle Play/Pause
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Stop Playback
-
-
-
-
-
-
-
+
+ Load Image
+
- Next Track
-
-
-
-
-
-
-
+
+ Toggle Play/Pause
+
- Previous Track
-
-
-
-
-
-
-
+
+ Stop Playback
+
- Next Index
-
-
-
-
-
-
-
+
+ Next Track
+
- Previous Index
-
-
-
-
-
-
-
+
+ Previous Track
+
- Fast-Forward
-
-
-
-
-
-
-
+
+ Next Index
+
- Rewind
-
-
-
-
-
-
-
+
+ Previous Index
+
- Toggle De-Emphasis
-
-
-
+
+ Fast-Forward
+
+
+
+ Rewind
+
+
+
+ Volume Up
+
+
+
+ Volume Down
+
+
+
+ Toggle Mute
+
+
+
+ Toggle De-Emphasis
+
+
diff --git a/RedBookPlayer/GUI/SettingsWindow.xaml.cs b/RedBookPlayer/GUI/SettingsWindow.xaml.cs
index a4424a0..3f1d226 100644
--- a/RedBookPlayer/GUI/SettingsWindow.xaml.cs
+++ b/RedBookPlayer/GUI/SettingsWindow.xaml.cs
@@ -92,41 +92,50 @@ namespace RedBookPlayer.GUI
private void PopulateKeyboardList()
{
// Access all of the combo boxes
- ComboBox LoadImageKeyBind = this.FindControl("LoadImageKeyBind");
- ComboBox TogglePlaybackKeyBind = this.FindControl("TogglePlaybackKeyBind");
- ComboBox StopPlaybackKeyBind = this.FindControl("StopPlaybackKeyBind");
- ComboBox NextTrackKeyBind = this.FindControl("NextTrackKeyBind");
- ComboBox PreviousTrackKeyBind = this.FindControl("PreviousTrackKeyBind");
- ComboBox NextIndexKeyBind = this.FindControl("NextIndexKeyBind");
- ComboBox PreviousIndexKeyBind = this.FindControl("PreviousIndexKeyBind");
- ComboBox FastForwardPlaybackKeyBind = this.FindControl("FastForwardPlaybackKeyBind");
- ComboBox RewindPlaybackKeyBind = this.FindControl("RewindPlaybackKeyBind");
- ComboBox ToggleDeEmphasisKeyBind = this.FindControl("ToggleDeEmphasisKeyBind");
+ ComboBox loadImageKeyBind = this.FindControl("LoadImageKeyBind");
+ ComboBox togglePlaybackKeyBind = this.FindControl("TogglePlaybackKeyBind");
+ ComboBox stopPlaybackKeyBind = this.FindControl("StopPlaybackKeyBind");
+ ComboBox nextTrackKeyBind = this.FindControl("NextTrackKeyBind");
+ ComboBox previousTrackKeyBind = this.FindControl("PreviousTrackKeyBind");
+ ComboBox nextIndexKeyBind = this.FindControl("NextIndexKeyBind");
+ ComboBox previousIndexKeyBind = this.FindControl("PreviousIndexKeyBind");
+ ComboBox fastForwardPlaybackKeyBind = this.FindControl("FastForwardPlaybackKeyBind");
+ ComboBox rewindPlaybackKeyBind = this.FindControl("RewindPlaybackKeyBind");
+ ComboBox volumeUpKeyBind = this.FindControl("VolumeUpKeyBind");
+ ComboBox volumeDownKeyBind = this.FindControl("VolumeDownKeyBind");
+ ComboBox toggleMuteKeyBind = this.FindControl("ToggleMuteKeyBind");
+ ComboBox toggleDeEmphasisKeyBind = this.FindControl("ToggleDeEmphasisKeyBind");
// Assign the list of values to all of them
Array keyboardList = GenerateKeyboardList();
- LoadImageKeyBind.Items = keyboardList;
- TogglePlaybackKeyBind.Items = keyboardList;
- StopPlaybackKeyBind.Items = keyboardList;
- NextTrackKeyBind.Items = keyboardList;
- PreviousTrackKeyBind.Items = keyboardList;
- NextIndexKeyBind.Items = keyboardList;
- PreviousIndexKeyBind.Items = keyboardList;
- FastForwardPlaybackKeyBind.Items = keyboardList;
- RewindPlaybackKeyBind.Items = keyboardList;
- ToggleDeEmphasisKeyBind.Items = keyboardList;
+ loadImageKeyBind.Items = keyboardList;
+ togglePlaybackKeyBind.Items = keyboardList;
+ stopPlaybackKeyBind.Items = keyboardList;
+ nextTrackKeyBind.Items = keyboardList;
+ previousTrackKeyBind.Items = keyboardList;
+ nextIndexKeyBind.Items = keyboardList;
+ previousIndexKeyBind.Items = keyboardList;
+ fastForwardPlaybackKeyBind.Items = keyboardList;
+ rewindPlaybackKeyBind.Items = keyboardList;
+ volumeUpKeyBind.Items = keyboardList;
+ volumeDownKeyBind.Items = keyboardList;
+ toggleMuteKeyBind.Items = keyboardList;
+ toggleDeEmphasisKeyBind.Items = keyboardList;
// Set all of the currently selected items
- LoadImageKeyBind.SelectedItem = _settings.LoadImageKey;
- TogglePlaybackKeyBind.SelectedItem = _settings.TogglePlaybackKey;
- StopPlaybackKeyBind.SelectedItem = _settings.StopPlaybackKey;
- NextTrackKeyBind.SelectedItem = _settings.NextTrackKey;
- PreviousTrackKeyBind.SelectedItem = _settings.PreviousTrackKey;
- NextIndexKeyBind.SelectedItem = _settings.NextIndexKey;
- PreviousIndexKeyBind.SelectedItem = _settings.PreviousIndexKey;
- FastForwardPlaybackKeyBind.SelectedItem = _settings.FastForwardPlaybackKey;
- RewindPlaybackKeyBind.SelectedItem = _settings.RewindPlaybackKey;
- ToggleDeEmphasisKeyBind.SelectedItem = _settings.ToggleDeEmphasisKey;
+ loadImageKeyBind.SelectedItem = _settings.LoadImageKey;
+ togglePlaybackKeyBind.SelectedItem = _settings.TogglePlaybackKey;
+ stopPlaybackKeyBind.SelectedItem = _settings.StopPlaybackKey;
+ nextTrackKeyBind.SelectedItem = _settings.NextTrackKey;
+ previousTrackKeyBind.SelectedItem = _settings.PreviousTrackKey;
+ nextIndexKeyBind.SelectedItem = _settings.NextIndexKey;
+ previousIndexKeyBind.SelectedItem = _settings.PreviousIndexKey;
+ fastForwardPlaybackKeyBind.SelectedItem = _settings.FastForwardPlaybackKey;
+ rewindPlaybackKeyBind.SelectedItem = _settings.RewindPlaybackKey;
+ volumeUpKeyBind.SelectedItem = _settings.VolumeUpKey;
+ volumeDownKeyBind.SelectedItem = _settings.VolumeDownKey;
+ toggleMuteKeyBind.SelectedItem = _settings.ToggleMuteKey;
+ toggleDeEmphasisKeyBind.SelectedItem = _settings.ToggleDeEmphasisKey;
}
///
@@ -135,28 +144,34 @@ namespace RedBookPlayer.GUI
private void SaveKeyboardList()
{
// Access all of the combo boxes
- ComboBox LoadImageKeyBind = this.FindControl("LoadImageKeyBind");
- ComboBox TogglePlaybackKeyBind = this.FindControl("TogglePlaybackKeyBind");
- ComboBox StopPlaybackKeyBind = this.FindControl("StopPlaybackKeyBind");
- ComboBox NextTrackKeyBind = this.FindControl("NextTrackKeyBind");
- ComboBox PreviousTrackKeyBind = this.FindControl("PreviousTrackKeyBind");
- ComboBox NextIndexKeyBind = this.FindControl("NextIndexKeyBind");
- ComboBox PreviousIndexKeyBind = this.FindControl("PreviousIndexKeyBind");
- ComboBox FastForwardPlaybackKeyBind = this.FindControl("FastForwardPlaybackKeyBind");
- ComboBox RewindPlaybackKeyBind = this.FindControl("RewindPlaybackKeyBind");
- ComboBox ToggleDeEmphasisKeyBind = this.FindControl("ToggleDeEmphasisKeyBind");
+ ComboBox loadImageKeyBind = this.FindControl("LoadImageKeyBind");
+ ComboBox togglePlaybackKeyBind = this.FindControl("TogglePlaybackKeyBind");
+ ComboBox stopPlaybackKeyBind = this.FindControl("StopPlaybackKeyBind");
+ ComboBox nextTrackKeyBind = this.FindControl("NextTrackKeyBind");
+ ComboBox previousTrackKeyBind = this.FindControl("PreviousTrackKeyBind");
+ ComboBox nextIndexKeyBind = this.FindControl("NextIndexKeyBind");
+ ComboBox previousIndexKeyBind = this.FindControl("PreviousIndexKeyBind");
+ ComboBox fastForwardPlaybackKeyBind = this.FindControl("FastForwardPlaybackKeyBind");
+ ComboBox rewindPlaybackKeyBind = this.FindControl("RewindPlaybackKeyBind");
+ ComboBox volumeUpKeyBind = this.FindControl("VolumeUpKeyBind");
+ ComboBox volumeDownKeyBind = this.FindControl("VolumeDownKeyBind");
+ ComboBox toggleMuteKeyBind = this.FindControl("ToggleMuteKeyBind");
+ ComboBox toggleDeEmphasisKeyBind = this.FindControl("ToggleDeEmphasisKeyBind");
// Set all of the currently selected items
- _settings.LoadImageKey = (Key)LoadImageKeyBind.SelectedItem;
- _settings.TogglePlaybackKey = (Key)TogglePlaybackKeyBind.SelectedItem;
- _settings.StopPlaybackKey = (Key)StopPlaybackKeyBind.SelectedItem;
- _settings.NextTrackKey = (Key)NextTrackKeyBind.SelectedItem;
- _settings.PreviousTrackKey = (Key)PreviousTrackKeyBind.SelectedItem;
- _settings.NextIndexKey = (Key)NextIndexKeyBind.SelectedItem;
- _settings.PreviousIndexKey = (Key)PreviousIndexKeyBind.SelectedItem;
- _settings.FastForwardPlaybackKey = (Key)FastForwardPlaybackKeyBind.SelectedItem;
- _settings.RewindPlaybackKey = (Key)RewindPlaybackKeyBind.SelectedItem;
- _settings.ToggleDeEmphasisKey = (Key)ToggleDeEmphasisKeyBind.SelectedItem;
+ _settings.LoadImageKey = (Key)loadImageKeyBind.SelectedItem;
+ _settings.TogglePlaybackKey = (Key)togglePlaybackKeyBind.SelectedItem;
+ _settings.StopPlaybackKey = (Key)stopPlaybackKeyBind.SelectedItem;
+ _settings.NextTrackKey = (Key)nextTrackKeyBind.SelectedItem;
+ _settings.PreviousTrackKey = (Key)previousTrackKeyBind.SelectedItem;
+ _settings.NextIndexKey = (Key)nextIndexKeyBind.SelectedItem;
+ _settings.PreviousIndexKey = (Key)previousIndexKeyBind.SelectedItem;
+ _settings.FastForwardPlaybackKey = (Key)fastForwardPlaybackKeyBind.SelectedItem;
+ _settings.RewindPlaybackKey = (Key)rewindPlaybackKeyBind.SelectedItem;
+ _settings.VolumeUpKey = (Key)volumeUpKeyBind.SelectedItem;
+ _settings.VolumeDownKey = (Key)volumeDownKeyBind.SelectedItem;
+ _settings.ToggleMuteKey = (Key)toggleMuteKeyBind.SelectedItem;
+ _settings.ToggleDeEmphasisKey = (Key)toggleDeEmphasisKeyBind.SelectedItem;
}
///
diff --git a/RedBookPlayer/Settings.cs b/RedBookPlayer/Settings.cs
index 2e2e607..44889d9 100644
--- a/RedBookPlayer/Settings.cs
+++ b/RedBookPlayer/Settings.cs
@@ -99,6 +99,21 @@ namespace RedBookPlayer
///
public Key RewindPlaybackKey { get; set; } = Key.OemComma;
+ ///
+ /// Key assigned to raise volume
+ ///
+ public Key VolumeUpKey { get; set; } = Key.OemPlus;
+
+ ///
+ /// Key assigned to lower volume
+ ///
+ public Key VolumeDownKey { get; set; } = Key.OemMinus;
+
+ ///
+ /// Key assigned to toggle mute
+ ///
+ public Key ToggleMuteKey { get; set; } = Key.M;
+
///
/// Key assigned to toggle de-emphasis
///