From 765d2f21c1f9f08f922cbed25b2bb03ea0d4fbf5 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 4 Oct 2021 22:46:46 -0700 Subject: [PATCH] Add unused disc changing methods to Player --- RedBookPlayer.Models/Hardware/Player.cs | 50 +++++++++++++++++++ .../Hardware/Windows/AudioBackend.cs | 1 - 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/RedBookPlayer.Models/Hardware/Player.cs b/RedBookPlayer.Models/Hardware/Player.cs index 6a17b44..ca89e8b 100644 --- a/RedBookPlayer.Models/Hardware/Player.cs +++ b/RedBookPlayer.Models/Hardware/Player.cs @@ -386,6 +386,56 @@ namespace RedBookPlayer.Models.Hardware Initialized = false; } + /// + /// Move to the next loaded disc + /// + public void NextDisc() + { + PlayerState wasPlaying = PlayerState; + if (wasPlaying == PlayerState.Playing) + Stop(); + + int lastdisc = CurrentDisc++; + while (CurrentDisc != lastdisc) + { + if (_opticalDiscs[CurrentDisc] != null && _opticalDiscs[CurrentDisc].Initialized) + break; + + CurrentDisc++; + } + + OpticalDiscStateChanged(this, null); + SoundOutputStateChanged(this, null); + + if(wasPlaying == PlayerState.Playing) + Play(); + } + + /// + /// Move to the previous loaded disc + /// + public void PreviousDisc() + { + PlayerState wasPlaying = PlayerState; + if (wasPlaying == PlayerState.Playing) + Stop(); + + int lastdisc = CurrentDisc--; + while (CurrentDisc != lastdisc) + { + if (_opticalDiscs[CurrentDisc] != null && _opticalDiscs[CurrentDisc].Initialized) + break; + + CurrentDisc--; + } + + OpticalDiscStateChanged(this, null); + SoundOutputStateChanged(this, null); + + if(wasPlaying == PlayerState.Playing) + Play(); + } + /// /// Move to the next playable track /// diff --git a/RedBookPlayer.Models/Hardware/Windows/AudioBackend.cs b/RedBookPlayer.Models/Hardware/Windows/AudioBackend.cs index da3cc6c..d378429 100644 --- a/RedBookPlayer.Models/Hardware/Windows/AudioBackend.cs +++ b/RedBookPlayer.Models/Hardware/Windows/AudioBackend.cs @@ -1,5 +1,4 @@ using CSCore.SoundOut; -using PortAudioSharp; namespace RedBookPlayer.Models.Hardware.Windows {