mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Load track list (not hooked up)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -292,10 +293,15 @@ namespace RedBookPlayer.Models.Hardware
|
|||||||
private readonly SoundOutput _soundOutput;
|
private readonly SoundOutput _soundOutput;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OpticalDisc object
|
/// OpticalDisc objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private OpticalDiscBase[] _opticalDiscs;
|
private OpticalDiscBase[] _opticalDiscs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of available tracks
|
||||||
|
/// </summary>
|
||||||
|
private Dictionary<int, List<int>> _trackList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Last volume for mute toggling
|
/// Last volume for mute toggling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -337,6 +343,12 @@ namespace RedBookPlayer.Models.Hardware
|
|||||||
_filterStage = new FilterStage();
|
_filterStage = new FilterStage();
|
||||||
_soundOutput = new SoundOutput(defaultVolume);
|
_soundOutput = new SoundOutput(defaultVolume);
|
||||||
|
|
||||||
|
_trackList = new Dictionary<int, List<int>>();
|
||||||
|
for(int i = 0; i < _numberOfDiscs; i++)
|
||||||
|
{
|
||||||
|
_trackList.Add(i, new List<int>());
|
||||||
|
}
|
||||||
|
|
||||||
PropertyChanged += HandlePlaybackModes;
|
PropertyChanged += HandlePlaybackModes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,6 +390,9 @@ namespace RedBookPlayer.Models.Hardware
|
|||||||
// Add event handling for the sound output
|
// Add event handling for the sound output
|
||||||
_soundOutput.PropertyChanged += SoundOutputStateChanged;
|
_soundOutput.PropertyChanged += SoundOutputStateChanged;
|
||||||
|
|
||||||
|
// Load in the track list for the current disc
|
||||||
|
LoadTrackList();
|
||||||
|
|
||||||
// Mark the player as ready
|
// Mark the player as ready
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
|
|
||||||
@@ -386,6 +401,18 @@ namespace RedBookPlayer.Models.Hardware
|
|||||||
SoundOutputStateChanged(this, null);
|
SoundOutputStateChanged(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load the track list into the track dictionary for the current disc
|
||||||
|
/// </summary>
|
||||||
|
private void LoadTrackList()
|
||||||
|
{
|
||||||
|
OpticalDiscBase opticalDisc = _opticalDiscs[CurrentDisc];
|
||||||
|
if (opticalDisc is CompactDisc compactDisc)
|
||||||
|
_trackList[CurrentDisc] = compactDisc.Tracks.Select(t => (int)t.TrackSequence).OrderBy(s => s).ToList();
|
||||||
|
else
|
||||||
|
_trackList[CurrentDisc] = Enumerable.Range(1, opticalDisc.TotalTracks).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
#region Playback (UI)
|
#region Playback (UI)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user