hscdio-0.1.0.0: Haskell bindings to the libcdio disc-reading library.
Copyright(c) 2019-2021 Sam May
LicenseGPL-3.0-or-later
Maintainerag@eitilt.life
Stabilitystable
Portabilitynon-portable (requires libcdio)
Safe HaskellNone
LanguageHaskell2010

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

Types

data Track Source #

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

Instances details
Bounded Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Enum Track Source #

Note that fromEnum DiscLeadout uses a value (== 100) chosen to be contiguous to the rest of the datatype rather than that used internally (== 0xAA). toEnum accepts both values.

Instance details

Defined in Foreign.Libcdio.Types.Internal

Eq Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Methods

(==) :: Track -> Track -> Bool #

(/=) :: Track -> Track -> Bool #

Num Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Ord Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Methods

compare :: Track -> Track -> Ordering #

(<) :: Track -> Track -> Bool #

(<=) :: Track -> Track -> Bool #

(>) :: Track -> Track -> Bool #

(>=) :: Track -> Track -> Bool #

max :: Track -> Track -> Track #

min :: Track -> Track -> Track #

Read Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Show Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Methods

showsPrec :: Int -> Track -> ShowS #

show :: Track -> String #

showList :: [Track] -> ShowS #

Ix Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

PrintfArg Track Source # 
Instance details

Defined in Foreign.Libcdio.Types.Internal

Storable Track Source #

Note that poke uses the official representation of DiscLeadout (CDIO_CDROM_LEADOUT_TRACK == 0xAA, as used by libcdio) rather than the hscdio fromEnum DiscLeadout (== 100), as the latter was chosen for proximity to the other constructors.

Instance details

Defined in Foreign.Libcdio.Types.Internal

Methods

sizeOf :: Track -> Int #

alignment :: Track -> Int #

peekElemOff :: Ptr Track -> Int -> IO Track #

pokeElemOff :: Ptr Track -> Int -> Track -> IO () #

peekByteOff :: Ptr b -> Int -> IO Track #

pokeByteOff :: Ptr b -> Int -> Track -> IO () #

peek :: Ptr Track -> IO Track #

poke :: Ptr Track -> Track -> IO () #

minTrack :: Track Source #

The first data track on a disc (i.e. Track 1).

maxTrack :: Track Source #

The highest data track allowed by the specifications (i.e. Track 99).

data TrackNum Source #

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 Source #

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.

Instances

Instances details
Bounded TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show TrackFormat Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Location

firstDiscTrack :: Cdio (Maybe Track) Source #

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) Source #

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) Source #

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) Source #

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

pregap :: Track -> Cdio (Maybe Lsn) Source #

The address of the start of any pregap before the given track.

offset :: Track -> Cdio (Maybe Lsn) Source #

The address of the start of the given track.

offsetEnd :: Track -> Cdio (Maybe Lsn) Source #

The address of the end of the given track.

totalLength :: Track -> Cdio (Maybe Word) Source #

The number of sectors "assigned" to the specified track, including any in the pregap between it and the following one.

Data

format :: Track -> Cdio (Maybe TrackFormat) Source #

The raw data structure of a track.

isGreen :: Track -> Cdio (Maybe Bool) Source #

Whether the track data was stored using the Green Book (CD-i) standard.

hasPreemphasis :: Track -> Cdio (Maybe Bool) Source #

Whether preemphasis has been applied to the track for noise reduction.

copyPermit :: Track -> Cdio (Maybe Bool) Source #

Whether the track may be legally copied.

quadAudio :: Track -> Cdio (Maybe Bool) Source #

Whether the track was encoded with a richer 4-channel structure, or whether it just includes the standard stereo (2-channel) layout.