diff --git a/RedBookPlayer/Hardware/Player.cs b/RedBookPlayer/Hardware/Player.cs index 85c2263..b592834 100644 --- a/RedBookPlayer/Hardware/Player.cs +++ b/RedBookPlayer/Hardware/Player.cs @@ -216,7 +216,9 @@ namespace RedBookPlayer.Hardware // Mark the player as ready Initialized = true; - SetDiscInformation(); + + // Force a refresh of the disc information + OpticalDiscStateChanged(this, null); } #region Playback @@ -286,8 +288,6 @@ namespace RedBookPlayer.Hardware if(_opticalDisc is CompactDisc compactDisc) _soundOutput.SetDeEmphasis(compactDisc.TrackHasEmphasis); - SetDiscInformation(); - if(wasPlaying == true) Play(); } @@ -307,8 +307,6 @@ namespace RedBookPlayer.Hardware if(_opticalDisc is CompactDisc compactDisc) _soundOutput.SetDeEmphasis(compactDisc.TrackHasEmphasis); - SetDiscInformation(); - if(wasPlaying == true) Play(); } @@ -328,8 +326,6 @@ namespace RedBookPlayer.Hardware if(_opticalDisc is CompactDisc compactDisc) _soundOutput.SetDeEmphasis(compactDisc.TrackHasEmphasis); - SetDiscInformation(); - if(wasPlaying == true) Play(); } @@ -350,8 +346,6 @@ namespace RedBookPlayer.Hardware if(_opticalDisc is CompactDisc compactDisc) _soundOutput.SetDeEmphasis(compactDisc.TrackHasEmphasis); - SetDiscInformation(); - if(wasPlaying == true) Play(); } @@ -364,7 +358,6 @@ namespace RedBookPlayer.Hardware return; _opticalDisc.CurrentSector = Math.Min(_opticalDisc.TotalSectors, _opticalDisc.CurrentSector + 75); - SetDiscInformation(); } /// @@ -377,8 +370,6 @@ namespace RedBookPlayer.Hardware if(_opticalDisc.CurrentSector >= 75) _opticalDisc.CurrentSector -= 75; - - SetDiscInformation(); } #endregion @@ -400,22 +391,7 @@ namespace RedBookPlayer.Hardware /// /// Update the player from the current OpticalDisc /// - private void OpticalDiscStateChanged(object sender, PropertyChangedEventArgs e) => SetDiscInformation(); - - /// - /// Update the player from the current SoundOutput - /// - private void SoundOutputStateChanged(object sender, PropertyChangedEventArgs e) - { - Playing = _soundOutput.Playing; - ApplyDeEmphasis = _soundOutput.ApplyDeEmphasis; - //Volume = _soundOutput.Volume; - } - - /// - /// Set all current disc information - /// - private void SetDiscInformation() + private void OpticalDiscStateChanged(object sender, PropertyChangedEventArgs e) { CurrentTrackNumber = _opticalDisc.CurrentTrackNumber; CurrentTrackIndex = _opticalDisc.CurrentTrackIndex; @@ -440,6 +416,16 @@ namespace RedBookPlayer.Hardware } } + /// + /// Update the player from the current SoundOutput + /// + private void SoundOutputStateChanged(object sender, PropertyChangedEventArgs e) + { + Playing = _soundOutput.Playing; + ApplyDeEmphasis = _soundOutput.ApplyDeEmphasis; + Volume = _soundOutput.Volume; + } + #endregion } } \ No newline at end of file