Safer track switching

This commit is contained in:
Matt Nadareski
2021-07-05 22:39:08 -07:00
parent 4c712677e0
commit 8cca9203da

View File

@@ -62,9 +62,6 @@ namespace RedBookPlayer.Common.Discs
// Set track flags from subchannel data, if possible
SetTrackFlags(track);
TotalIndexes = track.Indexes.Keys.Max();
CurrentTrackIndex = track.Indexes.Keys.Min();
// If the track is playable, just return
if(TrackType == TrackType.Audio || _loadDataTracks)
break;
@@ -78,6 +75,9 @@ namespace RedBookPlayer.Common.Discs
while(cachedValue != _currentTrackNumber);
this.RaiseAndSetIfChanged(ref _currentTrackNumber, cachedTrackNumber);
TotalIndexes = GetTrack(_currentTrackNumber).Indexes.Keys.Max();
CurrentTrackIndex = GetTrack(_currentTrackNumber).Indexes.Keys.Min();
}
}