diff --git a/RedBookPlayer.Common/Discs/CompactDisc.cs b/RedBookPlayer.Common/Discs/CompactDisc.cs
index 9078929..eb51c0c 100644
--- a/RedBookPlayer.Common/Discs/CompactDisc.cs
+++ b/RedBookPlayer.Common/Discs/CompactDisc.cs
@@ -99,7 +99,7 @@ namespace RedBookPlayer.Common.Discs
public override ulong CurrentSector
{
get => _currentSector;
- set
+ protected set
{
// Unset image means we can't do anything
if(_image == null)
diff --git a/RedBookPlayer.Common/Discs/OpticalDisc.cs b/RedBookPlayer.Common/Discs/OpticalDisc.cs
index 555c630..985b741 100644
--- a/RedBookPlayer.Common/Discs/OpticalDisc.cs
+++ b/RedBookPlayer.Common/Discs/OpticalDisc.cs
@@ -26,8 +26,7 @@ namespace RedBookPlayer.Common.Discs
///
/// Current sector number
///
- /// TODO: Maske this `protected set`
- public abstract ulong CurrentSector { get; set; }
+ public abstract ulong CurrentSector { get; protected set; }
///
/// Represents the sector starting the section
@@ -165,6 +164,12 @@ namespace RedBookPlayer.Common.Discs
///
public abstract void SetTotalIndexes();
+ ///
+ /// Set the current sector
+ ///
+ /// New sector number to use
+ public void SetCurrentSector(ulong sector) => CurrentSector = sector;
+
///
/// Load the desired track, if possible
///
diff --git a/RedBookPlayer.Common/Hardware/Player.cs b/RedBookPlayer.Common/Hardware/Player.cs
index 03acf26..6a4d20e 100644
--- a/RedBookPlayer.Common/Hardware/Player.cs
+++ b/RedBookPlayer.Common/Hardware/Player.cs
@@ -358,7 +358,7 @@ namespace RedBookPlayer.Common.Hardware
if(_opticalDisc == null || !_opticalDisc.Initialized)
return;
- _opticalDisc.CurrentSector = Math.Min(_opticalDisc.TotalSectors, _opticalDisc.CurrentSector + 75);
+ _opticalDisc.SetCurrentSector(Math.Min(_opticalDisc.TotalSectors, _opticalDisc.CurrentSector + 75));
}
///
@@ -370,7 +370,7 @@ namespace RedBookPlayer.Common.Hardware
return;
if(_opticalDisc.CurrentSector >= 75)
- _opticalDisc.CurrentSector -= 75;
+ _opticalDisc.SetCurrentSector(_opticalDisc.CurrentSector - 75);
}
#endregion
diff --git a/RedBookPlayer.Common/Hardware/SoundOutput.cs b/RedBookPlayer.Common/Hardware/SoundOutput.cs
index cdb0def..4207801 100644
--- a/RedBookPlayer.Common/Hardware/SoundOutput.cs
+++ b/RedBookPlayer.Common/Hardware/SoundOutput.cs
@@ -251,7 +251,7 @@ namespace RedBookPlayer.Common.Hardware
_currentSectorReadPosition += count;
if(_currentSectorReadPosition >= _opticalDisc.BytesPerSector)
{
- _opticalDisc.CurrentSector += (ulong)(_currentSectorReadPosition / _opticalDisc.BytesPerSector);
+ _opticalDisc.SetCurrentSector(_opticalDisc.CurrentSector + (ulong)(_currentSectorReadPosition / _opticalDisc.BytesPerSector));
_currentSectorReadPosition %= _opticalDisc.BytesPerSector;
}