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

Foreign.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.

track.h

Defines

  • CDIO_CDROM_CDI_TRACK (removed; only has utility in library code)
  • CDIO_CDROM_DATA_TRACK (removed; only has utility in library code)
  • CDIO_INVALID_TRACK (removed; handled via Nothing)
  • CDIO_CDROM_LBA (removed; only has utility in library code)
  • CDIO_CDROM_LEADOUT_TRACK -> DiscLeadout
  • CDIO_CDROM_MSF (removed; only has utility in library code)
  • CDIO_CDROM_XA_TRACK (removed; only has utility in library code)
  • CDIO_CD_MAX_TRACKS -> maxTrack
  • CDIO_CD_MIN_TRACK_NO -> minTrack

Types

  • track_flag_t -> Maybe Bool (CDIO_TRACK_FLAG_ERROR is never used in library code)
  • track_flags_t (removed; never used in the public interface)
  • track_format_t -> TrackFormat

  • trackmode_t (removed; never used in the public API)

Symbols

Sound.Libcdio.Track

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

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.

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

trackFormatString :: TrackFormat -> String Source #

Describe the data layout of a Track in a human-readable manner, as opposed to the machine representation returned by the Show instance.

Location

firstTrackNum :: Cdio -> IO (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 Cdio object has already been closed, or if the disc table of contents can't be read.

lastTrackNum :: Cdio -> IO (Maybe Track) Source #

The number of the last track on the disc.

Returns Nothing if the Cdio object has already been closed, or if the disc table of contents can't be read.

trackAt :: Cdio -> Lsn -> IO (Maybe Track) Source #

The track which contains the given address.

Returns Nothing if the Cdio object has already been closed, or 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 <- lastTrackNum cdio
>>> Just endAddr <- trackLastLsn cdio endTrack
>>> trackAt cdio $ endAddr + 1
Just DiscLeadout
>>> trackAt cdio $ endAddr + 2
Nothing

trackLba :: Cdio -> Track -> IO (Maybe Lba) Source #

The address of the start of the given track.

trackLsn :: Cdio -> Track -> IO (Maybe Lsn) Source #

The address of the start of the given track.

trackMsf :: Cdio -> Track -> IO (Maybe Msf) Source #

The timestamp at which the given track begins.

trackLastLsn :: Cdio -> Track -> IO (Maybe Lsn) Source #

The address of the end of the given track.

pregapLba :: Cdio -> Track -> IO (Maybe Lba) Source #

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

pregapLsn :: Cdio -> Track -> IO (Maybe Lsn) Source #

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

sectorCount :: Cdio -> Track -> IO (Maybe Word) Source #

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

Data

trackFormat :: Cdio -> Track -> IO (Maybe TrackFormat) Source #

The raw data structure of a track.

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

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

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

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

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

Whether the track may be legally copied.

numChannels :: Cdio -> Track -> IO (Maybe Word) Source #

The number of channels in the given track; either 2 or 4 per the standard.

trackIsrc :: Cdio -> Track -> IO (Maybe String) Source #

The International Standard Recording Code the given track. This may also be retrieved by getField Isrc $ Just t, though that references a different source and thus may not have the same return value.

isrcLength :: Word Source #

Number of ASCII characters in an International Standard Recording Code.