diff --git a/RedBookPlayer/Player.cs b/RedBookPlayer/Player.cs
index 4ac1c65..0196d4d 100644
--- a/RedBookPlayer/Player.cs
+++ b/RedBookPlayer/Player.cs
@@ -10,11 +10,18 @@ using CSCore;
using NWaves.Audio;
using NWaves.Filters.BiQuad;
using static Aaru.Decoders.CD.FullTOC;
+using Aaru.CommonTypes.Structs;
namespace RedBookPlayer
{
public class Player
{
+ public enum TrackType
+ {
+ Audio,
+ Data
+ }
+
public bool Initialized = false;
private int currentTrack = 0;
public int CurrentTrack
@@ -44,16 +51,19 @@ namespace RedBookPlayer
byte[] flagsData = Image.ReadSectorTag(Image.Tracks[CurrentTrack].TrackSequence, SectorTagType.CdTrackFlags);
ApplyDeEmphasis = ((CdFlags)flagsData[0]).HasFlag(CdFlags.PreEmphasis);
+ byte[] subchannel = Image.ReadSectorTag(
+ Image.Tracks[CurrentTrack].TrackStartSector,
+ SectorTagType.CdSectorSubchannel
+ );
+
if (!ApplyDeEmphasis)
{
- byte[] subchannel = Image.ReadSectorTag(
- Image.Tracks[CurrentTrack].TrackStartSector,
- SectorTagType.CdSectorSubchannel
- );
-
ApplyDeEmphasis = (subchannel[3] & 0b01000000) != 0;
}
+ CopyAllowed = (subchannel[2] & 0b01000000) != 0;
+ TrackType_ = (subchannel[1] & 0b01000000) != 0 ? TrackType.Data : TrackType.Audio;
+
TrackHasEmphasis = ApplyDeEmphasis;
TotalIndexes = Image.Tracks[CurrentTrack].Indexes.Keys.Max();
@@ -104,6 +114,8 @@ namespace RedBookPlayer
}
public bool TrackHasEmphasis { get; private set; } = false;
public bool ApplyDeEmphasis { get; private set; } = false;
+ public bool CopyAllowed { get; private set; } = false;
+ public TrackType? TrackType_ { get; private set; }
public int TotalTracks { get; private set; } = 0;
public int TotalIndexes { get; private set; } = 0;
public ulong TimeOffset { get; private set; } = 0;
diff --git a/RedBookPlayer/PlayerView.xaml b/RedBookPlayer/PlayerView.xaml
index f384956..6ea4820 100644
--- a/RedBookPlayer/PlayerView.xaml
+++ b/RedBookPlayer/PlayerView.xaml
@@ -83,10 +83,16 @@
- HIDDEN
- HIDDEN
+ AUDIO
+ AUDIO
+ DATA
+ DATA
EMPHASIS
EMPHASIS
+ COPY
+ COPY
+ HIDDEN
+ HIDDEN
diff --git a/RedBookPlayer/PlayerView.xaml.cs b/RedBookPlayer/PlayerView.xaml.cs
index b091fee..941e279 100644
--- a/RedBookPlayer/PlayerView.xaml.cs
+++ b/RedBookPlayer/PlayerView.xaml.cs
@@ -161,9 +161,13 @@ namespace RedBookPlayer
}
}
- ((PlayerViewModel)DataContext).HiddenTrack = Player.TimeOffset > 150;
- ((PlayerViewModel)DataContext).ApplyDeEmphasis = Player.ApplyDeEmphasis;
- ((PlayerViewModel)DataContext).TrackHasEmphasis = Player.TrackHasEmphasis;
+ PlayerViewModel dataContext = (PlayerViewModel)DataContext;
+ dataContext.HiddenTrack = Player.TimeOffset > 150;
+ dataContext.ApplyDeEmphasis = Player.ApplyDeEmphasis;
+ dataContext.TrackHasEmphasis = Player.TrackHasEmphasis;
+ dataContext.CopyAllowed = Player.CopyAllowed;
+ dataContext.IsAudioTrack = Player.TrackType_ == Player.TrackType.Audio;
+ dataContext.IsDataTrack = Player.TrackType_ == Player.TrackType.Data;
});
}
else
@@ -285,5 +289,23 @@ namespace RedBookPlayer
get => hiddenTrack;
set => this.RaiseAndSetIfChanged(ref hiddenTrack, value);
}
+ private bool copyAllowed;
+ public bool CopyAllowed
+ {
+ get => copyAllowed;
+ set => this.RaiseAndSetIfChanged(ref copyAllowed, value);
+ }
+ private bool isAudioTrack;
+ public bool IsAudioTrack
+ {
+ get => isAudioTrack;
+ set => this.RaiseAndSetIfChanged(ref isAudioTrack, value);
+ }
+ private bool isDataTrack;
+ public bool IsDataTrack
+ {
+ get => isDataTrack;
+ set => this.RaiseAndSetIfChanged(ref isDataTrack, value);
+ }
}
}
\ No newline at end of file