Copyright | (c) 2018-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 |
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 viaNothing
)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
TRACK_FORMAT_PSX
->FormatPlaystation
TRACK_FORMAT_ERROR
(removed; handled viaNothing
)
trackmode_t
(removed; never used in the public API)
Symbols
cdio_get_first_track_num
->firstTrackNum
cdio_get_last_track_num
->lastTrackNum
cdio_get_track
->trackAt
cdio_get_track_channels
->numChannels
cdio_get_track_copy_permit
->copyPermit
cdio_get_track_format
->trackFormat
cdio_get_track_green
->isGreen
cdio_get_track_isrc
->trackIsrc
cdio_get_track_last_lsn
->trackLastLsn
cdio_get_track_lba
->trackLba
cdio_get_track_lsn
->trackLsn
cdio_get_track_msf
->trackMsf
cdio_get_track_preemphasis
->hasPreemphasis
cdio_get_track_pregap_lba
->pregapLba
cdio_get_track_pregap_lsn
->pregapLsn
cdio_get_track_sec_count
->sectorCount
track_format2str
->trackFormatString
Sound.Libcdio.Track
firstTrackNum
->firstDiscTrack
isrcLength
(removed; unnecessary low-level detail)lastTrackNum
->lastDiscTrack
numChannels
->quadAudio
pregapLba
(removed; onlyLsn
is used inSound
)pregapLsn
->pregap
sectorCount
->totalLength
trackFormat
->format
trackIsrc
->Sound.Libcdio.Read.Data.
isrc
trackLastLsn
->offsetEnd
trackLba
(removed; onlyLsn
is used inSound
)trackLsn
->offset
trackMsf
(removed; onlyLsn
is used inSound
)
Synopsis
- data Track
- data TrackNum
- minTrack :: Track
- maxTrack :: Track
- data TrackFormat
- trackFormatString :: TrackFormat -> String
- firstTrackNum :: Cdio -> IO (Maybe Track)
- lastTrackNum :: Cdio -> IO (Maybe Track)
- trackAt :: Cdio -> Lsn -> IO (Maybe Track)
- trackLba :: Cdio -> Track -> IO (Maybe Lba)
- trackLsn :: Cdio -> Track -> IO (Maybe Lsn)
- trackMsf :: Cdio -> Track -> IO (Maybe Msf)
- trackLastLsn :: Cdio -> Track -> IO (Maybe Lsn)
- pregapLba :: Cdio -> Track -> IO (Maybe Lba)
- pregapLsn :: Cdio -> Track -> IO (Maybe Lsn)
- sectorCount :: Cdio -> Track -> IO (Maybe Word)
- trackFormat :: Cdio -> Track -> IO (Maybe TrackFormat)
- isGreen :: Cdio -> Track -> IO (Maybe Bool)
- hasPreemphasis :: Cdio -> Track -> IO (Maybe Bool)
- copyPermit :: Cdio -> Track -> IO (Maybe Bool)
- numChannels :: Cdio -> Track -> IO (Maybe Word)
- trackIsrc :: Cdio -> Track -> IO (Maybe String)
- isrcLength :: Word
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
trackFormatString :: TrackFormat -> String #
Location
firstTrackNum :: Cdio -> IO (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 Cdio
object has already been closed, or if the
disc table of contents can't be read.
trackAt :: Cdio -> Lsn -> IO (Maybe Track) #
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
pregapLba :: Cdio -> Track -> IO (Maybe Lba) #
The address of the start of any pregap before the given track.
pregapLsn :: Cdio -> Track -> IO (Maybe Lsn) #
The address of the start of any pregap before the given track.
sectorCount :: Cdio -> Track -> IO (Maybe Word) #
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) #
The raw data structure of a track.
isGreen :: Cdio -> Track -> IO (Maybe Bool) #
Whether the track data was stored using the Green Book (CD-i) standard.
hasPreemphasis :: Cdio -> Track -> IO (Maybe Bool) #
Whether preemphasis has been applied to the track for noise reduction.
numChannels :: Cdio -> Track -> IO (Maybe Word) #
The number of channels in the given track; either 2 or 4 per the standard.
isrcLength :: Word #
Number of ASCII characters in an International Standard Recording Code.