Wayne Keenan > SDL-sdlpl-1.08 > SDL::Cdrom

Download:
SDL-sdlpl-1.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

SDL::Cdrom - a SDL perl extension

SYNOPSIS ^

  $cdrom = new SDL::Cdrom 0;

DESCRIPTION ^

        Cdrom.pm provides software control for CD music.  To open a
CD for playing, ejecting, etc. create a new instance of the Cdrom object,
passing it the number of the drive starting with 0 .. CD_NUM_DRIVES - 1:

        $cdrom = new SDL::Cdrom 0;

The function CD_NUM_DRIVES will return the number of accessible drives your system currently has. Once open, you can get the device name of the drive using the method name:

        $name = $cdrom->name();

Polling Status

        The method $cdrom->status() differs from the SDL function SDL_CDStatus
in that it returns a string describing the status.  This method returns
the following values:

                        playing
                        stopped
                        paused
                        empty
                        error

This was done simply to make it easier to present this information to the end user, in particular programmers debugging their scripts, with little loss of speed.

Using the CD

        $cdrom->play(track,number_of_tracks,[frame],[number_of_frames]);
        $cdrom->pause();
        $cdrom->resume();
        $cdrom->stop();
        $cdrom->eject();

The only tricky thing here is that those familiar with the function SDL_CDPlayTracks should be aware that ntracks and start_frame have been swapped to make it easier to use, with the frame oriented parameters being optional.

Track Data

        To get information on a particular track the method:

        $cdrom->track(index);

will return a hash containing: -id, the track number as one would see on their cd player, -type, the type of data, -length, size of track in frames, -offset, the posistion on the CD.

        $cdrom->current();

returns the hash for the current track, and $cdrom->current_frame will give you the current frame within that track.

        $cdrom->num_tracks();

logically, returns the number of tracks on the cd, and

        $cdrom->id();

returns the id of the cdrom.

AUTHOR ^

David J. Goehrig

SEE ALSO ^

perl(1) SDL::Mixer(3) SDL::App(3).

syntax highlighting: