Copyright | (c) 2019-2021 Sam May |
---|---|
License | GPL-3.0-or-later |
Maintainer | ag@eitilt.life |
Stability | stable |
Portability | non-portable (requires libcdio) |
Safe Haskell | None |
Language | Haskell2010 |
Sound.Libcdio.Track
Description
What many people would think of as the most important division on a CD isn't quite as an integral a part of the physical data layout: they are described in a table of contents before the first track of any recording session, and may have lower-resolution "echoes" in the subchannels alongside the data, but it would be hard to otherwise recover the track boundaries from the data itself. This module, then, provides the functions to retrieve that metadata from the table of contents and from the subchannels.
Synopsis
- data Track
- minTrack :: Track
- maxTrack :: Track
- data TrackNum
- data TrackFormat
- firstDiscTrack :: Cdio (Maybe Track)
- lastDiscTrack :: Cdio (Maybe Track)
- tracks :: Cdio (Maybe Track)
- trackAt :: Lsn -> Cdio (Maybe Track)
- pregap :: Track -> Cdio (Maybe Lsn)
- offset :: Track -> Cdio (Maybe Lsn)
- offsetEnd :: Track -> Cdio (Maybe Lsn)
- totalLength :: Track -> Cdio (Maybe Word)
- format :: Track -> Cdio (Maybe TrackFormat)
- isGreen :: Track -> Cdio (Maybe Bool)
- hasPreemphasis :: Track -> Cdio (Maybe Bool)
- copyPermit :: Track -> Cdio (Maybe Bool)
- quadAudio :: Track -> Cdio (Maybe Bool)
Types
An index into the segmentation within a write session on a disc.
Constructors
DiscPregap | The (usually buffer) data located before the first track on a disc. |
Track TrackNum | The common understanding of a CD track: a segment of the data on the disc containing (usually) a single song. |
DiscLeadout | Any (usually buffer) data located after the end of the last track on a disc. |
Instances
Bounded Track # | |
Enum Track # | Note that |
Defined in Foreign.Libcdio.Types.Internal | |
Eq Track # | |
Num Track # | |
Ord Track # | |
Read Track # | |
Show Track # | |
Ix Track # | |
PrintfArg Track # | |
Defined in Foreign.Libcdio.Types.Internal | |
Storable Track # | Note that |
Opaque newtype representing the numeric index of a Track
, while
enforcing the invariants inherant to the specification. Of very limited
utility outside that context.
data TrackFormat #
The structure in which data is stored on a segment of a disc. The exact representation of these values is discussed in Foreign.Libcdio.Sector.
Constructors
FormatAudio | |
FormatCdI | |
FormatXa | |
FormatData | |
FormatPlaystation |
Instances
Location
firstDiscTrack :: Cdio (Maybe Track) #
The number of the first track on the disc. This will almost always be 1, but that is not strictly guaranteed; the (perhaps theoretical) example is of a multi-disc set, where later discs pick the numbering back up where the previous one left off.
Returns Nothing
if the disc table of contents can't be read.
lastDiscTrack :: Cdio (Maybe Track) #
The number of the last track on the disc.
Returns Nothing
if the disc table of contents can't be read.
tracks :: Cdio (Maybe Track) #
Get the number of tracks on a CD.
Returns Nothing
if the disc table of contents can't be read.
Address
trackAt :: Lsn -> Cdio (Maybe Track) #
The track which contains the given address.
Returns Nothing
if the address is beyond the written data on the disc.
Note that DiscLeadout
is treated as if it were a single sector
long:
>>>
Just endTrack <- lastDiscTrack
>>>
Just endAddr <- offsetEnd endTrack
>>>
trackAt $ endAddr + 1
Just DiscLeadout>>>
trackAt $ endAddr + 2
Nothing
totalLength :: Track -> Cdio (Maybe Word) #
The number of sectors "assigned" to the specified track, including any in the pregap between it and the following one.
Data
isGreen :: Track -> Cdio (Maybe Bool) #
Whether the track data was stored using the Green Book (CD-i) standard.