Crate cdg [] [src]

A CD+G parser

This documentation is probably best read alongside CD+G Revealed

The CD+G format is very closely tied to the details of how compact discs store audio; it's intended to be stored in the subchannel data alongside normal Red Book audio. For the purposes of consuming this data from a .cdg file using this library, all that it is important to know is that the file is divided into sectors of 96 bytes, each of which represents 1/75th of a second.

The CD+G display model is a 300x216-pixel indexed color framebuffer divided into 6x12-pixel tiles, with a 16-color palette. The outermost cell on each side (i.e., the top and bottom 12 rows and the left and right 6 columns) are drawn a solid "border color" rather than drawn from the framebuffer.

Structs

RgbColor

A 12-bit RGB color

SectorIter

Iterator over the blocks within a sector. This produces a stream of Command objects, skipping over invalid commands and only returning None when there are no more valid commands.

SubchannelStreamIter

A streaming iterator over the sectors read in from a reader. The interface is the same as Iterator, but the trait isn't implemented because Rust doesn't have higher-kinded types yet.

Tile

A 6x12 tile, to be blitted to the display

Enums

Command

One drawing command

ScrollCommand

A scroll command

Functions

decode_subchannel_cmd

Decode a single subchannel command. The input block must be exactly 24 bytes long. If the command is invalid for any reason, return None. Otherwise, returns the command.