/Users/hercules/trunk/SDL-1.2/include/SDL_cdrom.h File Reference

#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Data Structures

struct  SDL_CDtrack
struct  SDL_CD

Defines

#define SDL_MAX_TRACKS   99
#define CD_INDRIVE(status)   ((int)(status) > 0)
Track Types
The types of CD-ROM track possible

#define SDL_AUDIO_TRACK   0x00
#define SDL_DATA_TRACK   0x04
Frames / MSF Conversion Functions
Conversion functions from frames to Minute/Second/Frames and vice versa

#define CD_FPS   75
#define FRAMES_TO_MSF(f, M, S, F)
#define MSF_TO_FRAMES(M, S, F)   ((M)*60*CD_FPS+(S)*CD_FPS+(F))

Enumerations

enum  CDstatus {
  CD_TRAYEMPTY, CD_STOPPED, CD_PLAYING, CD_PAUSED,
  CD_ERROR = -1
}

Functions

DECLSPEC int SDLCALL SDL_CDNumDrives (void)
DECLSPEC const char *SDLCALL SDL_CDName (int drive)
DECLSPEC SDL_CD *SDLCALL SDL_CDOpen (int drive)
DECLSPEC CDstatus SDLCALL SDL_CDStatus (SDL_CD *cdrom)
DECLSPEC int SDLCALL SDL_CDPlayTracks (SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes)
DECLSPEC int SDLCALL SDL_CDPlay (SDL_CD *cdrom, int start, int length)
DECLSPEC int SDLCALL SDL_CDPause (SDL_CD *cdrom)
DECLSPEC int SDLCALL SDL_CDResume (SDL_CD *cdrom)
DECLSPEC int SDLCALL SDL_CDStop (SDL_CD *cdrom)
DECLSPEC int SDLCALL SDL_CDEject (SDL_CD *cdrom)
DECLSPEC void SDLCALL SDL_CDClose (SDL_CD *cdrom)


Detailed Description

This is the CD-audio control API for Simple DirectMedia Layer

In order to use these functions, SDL_Init() must have been called with the SDL_INIT_CDROM flag. This causes SDL to scan the system for CD-ROM drives, and load appropriate drivers.


Define Documentation

#define CD_INDRIVE ( status   )     ((int)(status) > 0)

Given a status, returns true if there's a disk in the drive

#define FRAMES_TO_MSF ( f,
M,
S,
 ) 

Value:

{                                       \
        int value = f;                                                  \
        *(F) = value%CD_FPS;                                            \
        value /= CD_FPS;                                                \
        *(S) = value%60;                                                \
        value /= 60;                                                    \
        *(M) = value;                                                   \
}

#define SDL_MAX_TRACKS   99

The maximum number of CD-ROM tracks on a disk


Enumeration Type Documentation

enum CDstatus

The possible states which a CD-ROM drive can be in.


Function Documentation

DECLSPEC void SDLCALL SDL_CDClose ( SDL_CD cdrom  ) 

Closes the handle for the CD-ROM drive

DECLSPEC int SDLCALL SDL_CDEject ( SDL_CD cdrom  ) 

Eject CD-ROM

Returns:
returns 0, or -1 on error

DECLSPEC const char* SDLCALL SDL_CDName ( int  drive  ) 

Returns a human-readable, system-dependent identifier for the CD-ROM. Example:

  • "/dev/cdrom"
  • "E:"
  • "/dev/disk/ide/1/master"

DECLSPEC int SDLCALL SDL_CDNumDrives ( void   ) 

Returns the number of CD-ROM drives on the system, or -1 if SDL_Init() has not been called with the SDL_INIT_CDROM flag.

DECLSPEC SDL_CD* SDLCALL SDL_CDOpen ( int  drive  ) 

Opens a CD-ROM drive for access. It returns a drive handle on success, or NULL if the drive was invalid or busy. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a NULL CD-ROM handle. Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.

DECLSPEC int SDLCALL SDL_CDPause ( SDL_CD cdrom  ) 

Pause play

Returns:
returns 0, or -1 on error

DECLSPEC int SDLCALL SDL_CDPlay ( SDL_CD cdrom,
int  start,
int  length 
)

Play the given CD starting at 'start' frame for 'length' frames.

Returns:
It returns 0, or -1 if there was an error.

DECLSPEC int SDLCALL SDL_CDPlayTracks ( SDL_CD cdrom,
int  start_track,
int  start_frame,
int  ntracks,
int  nframes 
)

Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play until the end of the CD. This function will skip data tracks. This function should only be called after calling SDL_CDStatus() to get track information about the CD. For example:

        // Play entire CD:
        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
                SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
        // Play last track:
        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
                SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
        }
        // Play first and second track and 10 seconds of third track:
        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
                SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);

Returns:
This function returns 0, or -1 if there was an error.

DECLSPEC int SDLCALL SDL_CDResume ( SDL_CD cdrom  ) 

Resume play

Returns:
returns 0, or -1 on error

DECLSPEC CDstatus SDLCALL SDL_CDStatus ( SDL_CD cdrom  ) 

This function returns the current status of the given drive. If the drive has a CD in it, the table of contents of the CD and current play position of the CD will be stored in the SDL_CD structure.

DECLSPEC int SDLCALL SDL_CDStop ( SDL_CD cdrom  ) 

Stop play

Returns:
returns 0, or -1 on error


Generated on Mon Sep 21 21:29:50 2009 for Simple DirectMedia Layer by  doxygen 1.5.8