docs/man3/SDL_CDStatus.3
author Aaron Wishnick <schnarf@gmail.com>
Wed, 18 Jun 2008 04:51:10 +0000
branchgsoc2008_audio_resampling
changeset 2655 b8e736c8a5a8
parent 2283 546f7c1eb755
child 4311 1238da4a7112
permissions -rw-r--r--
Added beginnings of resampling code.
slouken@181
     1
.TH "SDL_CDStatus" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" 
slouken@0
     2
.SH "NAME"
slouken@2283
     3
SDL_CDStatus \- Returns the current status of the given drive\&.
slouken@0
     4
.SH "SYNOPSIS"
slouken@0
     5
.PP
slouken@0
     6
\fB#include "SDL\&.h"
slouken@0
     7
.sp
slouken@0
     8
\fBCDstatus \fBSDL_CDStatus\fP\fR(\fBSDL_CD *cdrom\fR);
slouken@0
     9
\fB/* Given a status, returns true if there\&'s a disk in the drive */
slouken@0
    10
#define CD_INDRIVE(status)      ((int)status > 0)
slouken@0
    11
.SH "DESCRIPTION"
slouken@0
    12
.PP
slouken@0
    13
This function returns the current status of the given drive\&. Status is described like so: 
slouken@0
    14
.PP
slouken@0
    15
.nf
slouken@0
    16
\f(CWtypedef enum {
slouken@0
    17
  CD_TRAYEMPTY,
slouken@0
    18
  CD_STOPPED,
slouken@0
    19
  CD_PLAYING,
slouken@0
    20
  CD_PAUSED,
slouken@0
    21
  CD_ERROR = -1
slouken@0
    22
} CDstatus;\fR
slouken@0
    23
.fi
slouken@0
    24
.PP
slouken@0
    25
.PP
slouken@0
    26
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\&.
slouken@0
    27
.PP
slouken@0
    28
The macro \fBCD_INDRIVE\fP is provided for convenience, and given a status returns true if there\&'s a disk in the drive\&.
slouken@0
    29
.PP
slouken@0
    30
.RS
slouken@0
    31
\fBNote:  
slouken@0
    32
.PP
slouken@0
    33
\fBSDL_CDStatus\fP also updates the \fI\fBSDL_CD\fR\fR structure passed to it\&.
slouken@0
    34
.RE
slouken@0
    35
.SH "EXAMPLE"
slouken@0
    36
.PP
slouken@0
    37
.nf
slouken@0
    38
\f(CWint playTrack(int track)
slouken@0
    39
{
slouken@0
    40
  int playing = 0;
slouken@0
    41
slouken@0
    42
  if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
slouken@0
    43
  /* clamp to the actual number of tracks on the CD */
slouken@0
    44
    if (track >= cdrom->numtracks) {
slouken@0
    45
      track = cdrom->numtracks-1;
slouken@0
    46
    }
slouken@0
    47
slouken@0
    48
    if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
slouken@0
    49
      playing = 1;
slouken@0
    50
    }
slouken@0
    51
  }
slouken@0
    52
  return playing;
slouken@0
    53
}\fR
slouken@0
    54
.fi
slouken@0
    55
.PP
slouken@0
    56
.SH "SEE ALSO"
slouken@0
    57
.PP
slouken@0
    58
\fI\fBSDL_CD\fP\fR
slouken@181
    59
...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58