sdljava.cdrom
Class SDLCdrom

java.lang.Object
  extended by sdljava.cdrom.SDLCdrom

public class SDLCdrom
extends java.lang.Object

Binding to the SDL Cdrom routines.

Version:
$Id: SDLCdrom.java,v 1.5 2005/01/19 03:09:11 ivan_ganza Exp $

Field Summary
(package private)  int driveIndex
           
(package private)  SDL_CD swigCdrom
           
 
Constructor Summary
private SDLCdrom(SDL_CD swigCdrom, int driveIndex)
           
 
Method Summary
 void cdClose()
          Close the cdrom
static void cdClose(SDLCdrom cdrom)
          Closes a cdrom
 void cdEject()
          Ejects a CDROM
static void cdEject(SDLCdrom cdrom)
          Ejects a CDROM
static java.lang.String cdName(int drive)
          Returns a human-readable, system-dependent identifier for the CD-ROM.
static SDLCdrom cdOpen(int drive)
          Describe cdOpen method here.
 void cdPause()
          Pauses a CDROM
static void cdPause(SDLCdrom cdrom)
          Pauses a CDROM
 void cdPlay(int start, int length)
          Play a CD
static void cdPlay(SDLCdrom cdrom, int start, int length)
          Play a CD
 void cdPlayTracks(int start_track, int start_frame, int ntracks, int nframes)
          Play the given CD track(s)
static void cdPlayTracks(SDLCdrom cdrom, int start_track, int start_frame, int ntracks, int nframes)
          Play the given CD track(s)
 void cdResume()
          Resumes a CDROM
static void cdResume(SDLCdrom cdrom)
          Resumes a CDROM
 CDstatus cdStatus()
          Returns the current status of this drive.
static CDstatus cdStatus(SDLCdrom cdrom)
          Returns the current status of the given drive.
 void cdStop()
          Stops a CDROM
static void cdStop(SDLCdrom cdrom)
          Stops a CDROM
protected  void finalize()
           
 int getCurrentFrame()
          Get the current frame offset within the track
 FrameInfo getCurrentFrameInfo()
           
 int getCurrentTrack()
          Get the current track
 int getDriveIndex()
           
 int getId()
          Get the private drive identifier
 int getNumTracks()
          Get the number of tracks on the CD
 SDL_CD getSwigCdrom()
           
 java.util.List getTracks()
          Get the list of tracks
static int numDrives()
          Returns the number of CD-ROM drives on the system.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

swigCdrom

SDL_CD swigCdrom

driveIndex

int driveIndex
Constructor Detail

SDLCdrom

private SDLCdrom(SDL_CD swigCdrom,
                 int driveIndex)
Method Detail

getSwigCdrom

public SDL_CD getSwigCdrom()

numDrives

public static int numDrives()
Returns the number of CD-ROM drives on the system.

Returns:
Returns the number of CD-ROM drives on the system.

cdName

public static java.lang.String cdName(int drive)
Returns a human-readable, system-dependent identifier for the CD-ROM.

Parameters:
drive - drive is the index of the drive
Returns:
a human-readable, system-dependent identifier for the CD-ROM

cdOpen

public static SDLCdrom cdOpen(int drive)
                       throws SDLException
Describe cdOpen method here.

Opens a CD-ROM drive for access. It returns a SDL_CD structure 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.

Parameters:
drive - an int value
Returns:
a SDLCdrom value
Throws:
SDLException - if an error occurs

cdStatus

public static CDstatus cdStatus(SDLCdrom cdrom)
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 cdrom object.

Parameters:
cdrom - a SDLCdrom value
Returns:
a CDstatus value

cdPlay

public static void cdPlay(SDLCdrom cdrom,
                          int start,
                          int length)
                   throws SDLException
Play a CD

Plays the given cdrom, starting a frame start for length frames.

Parameters:
cdrom - a SDLCdrom value
start - an int value
length - an int value
Throws:
SDLException - if an error occurs

cdPlayTracks

public static void cdPlayTracks(SDLCdrom cdrom,
                                int start_track,
                                int start_frame,
                                int ntracks,
                                int nframes)
                         throws SDLException
Play the given CD track(s)

SDL_CDPlayTracks plays the given CD starting at track start_track, for ntracks tracks.

start_frame is the frame offset, from the beginning of the start_track, at which to start. nframes is the frame offset, from the beginning of the last track (start_track+ntracks), at which to end playing.

SDL_CDPlayTracks should only be called after calling SDL_CDStatus to get track information about the CD.

Parameters:
cdrom - a SDLCdrom value
start_track - an int value
start_frame - an int value
ntrakcs - an int value
nframes - an int value
Throws:
SDLException - if an error occurs

cdPause

public static void cdPause(SDLCdrom cdrom)
                    throws SDLException
Pauses a CDROM

Pauses play on the given cdrom.

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdResume

public static void cdResume(SDLCdrom cdrom)
                     throws SDLException
Resumes a CDROM

Resumes play on the given cdrom.

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdStop

public static void cdStop(SDLCdrom cdrom)
                   throws SDLException
Stops a CDROM

Stops play on the given cdrom.

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdEject

public static void cdEject(SDLCdrom cdrom)
                    throws SDLException
Ejects a CDROM

Ejects the given cdrom.

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdClose

public static void cdClose(SDLCdrom cdrom)
Closes a cdrom

Parameters:
cdrom - a SDLCdrom value

cdStatus

public CDstatus cdStatus()
Returns the current status of this 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 cdrom object.

Parameters:
cdrom - a SDLCdrom value
Returns:
a CDstatus value

cdPlay

public void cdPlay(int start,
                   int length)
            throws SDLException
Play a CD

Plays starting a frame start for length frames.

Parameters:
start - an int value
length - an int value
Throws:
SDLException - if an error occurs

cdPlayTracks

public void cdPlayTracks(int start_track,
                         int start_frame,
                         int ntracks,
                         int nframes)
                  throws SDLException
Play the given CD track(s)

SDL_CDPlayTracks plays the given CD starting at track start_track, for ntracks tracks.

start_frame is the frame offset, from the beginning of the start_track, at which to start. nframes is the frame offset, from the beginning of the last track (start_track+ntracks), at which to end playing.

SDL_CDPlayTracks should only be called after calling SDL_CDStatus to get track information about the CD.

Parameters:
cdrom - a SDLCdrom value
start_track - an int value
start_frame - an int value
ntrakcs - an int value
nframes - an int value
Throws:
SDLException - if an error occurs

cdPause

public void cdPause()
             throws SDLException
Pauses a CDROM

Pauses play

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdResume

public void cdResume()
              throws SDLException
Resumes a CDROM

Resumes play

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdStop

public void cdStop()
            throws SDLException
Stops a CDROM

Stops play

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdEject

public void cdEject()
             throws SDLException
Ejects a CDROM

Ejects the cdrom.

Parameters:
cdrom - a SDLCdrom value
Throws:
SDLException - if an error occurs

cdClose

public void cdClose()
Close the cdrom


getId

public int getId()
Get the private drive identifier

Returns:
the private drive identifier

getNumTracks

public int getNumTracks()
Get the number of tracks on the CD

Returns:
the number of tracks on the CD

getCurrentTrack

public int getCurrentTrack()
Get the current track

Returns:
the current track

getCurrentFrame

public int getCurrentFrame()
Get the current frame offset within the track

Returns:
the current frame offset within the track

getTracks

public java.util.List getTracks()
Get the list of tracks

Returns:
the list of tracks

getDriveIndex

public int getDriveIndex()

getCurrentFrameInfo

public FrameInfo getCurrentFrameInfo()

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object