home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_CDStatus.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  2.2 KB  |  80 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_CDStatus"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_CDStatus- Returns the current status of the given drive. 
  13. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  14. <p>
  15. <b>#include
  16. "SDL.h" <p>
  17. </b><b>CDstatus <b>SDL_CDStatus</b></b>(<b>SDL_CD *cdrom</b>); <b>/* Given a status, returns
  18. true if there's a disk in the drive */ #define CD_INDRIVE(status)      ((int)status
  19. > 0) 
  20. <h2><a name='sect2' href='#toc2'></b>Description</a></h2>
  21. <p>
  22. This function returns the current status of the given drive.
  23. Status is described like so:  <p>
  24. <br>
  25. <pre>CWtypedef enum {
  26.   CD_TRAYEMPTY,
  27.   CD_STOPPED,
  28.   CD_PLAYING,
  29.   CD_PAUSED,
  30.   CD_ERROR = -1
  31. } CDstatus;
  32. </pre><p>
  33. <p>
  34. If the drive has a CD in it, the table of contents of the CD and current
  35. play position of the CD will be stored in the SDL_CD structure. <p>
  36. The macro
  37. <b>CD_INDRIVE</b> is provided for convenience, and given a status returns true
  38. if there's a disk in the drive. <p>
  39. <blockquote><b>Note:   <p>
  40. <b>SDL_CDStatus</b></b> also updates the <i><b>SDL_CD</b></i>
  41. structure passed to it. </blockquote>
  42.  
  43. <h2><a name='sect3' href='#toc3'>Example</a></h2>
  44. <p>
  45. <br>
  46. <pre>CWint playTrack(int track)
  47. {
  48.   int playing = 0;
  49.   if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
  50.   /* clamp to the actual number of tracks on the CD */
  51.     if (track >= cdrom->numtracks) {
  52.       track = cdrom->numtracks-1;
  53.     }
  54.     if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
  55.       playing = 1;
  56.     }
  57.   }
  58.   return playing;
  59. }
  60. </pre><p>
  61.  
  62. <h2><a name='sect4' href='#toc4'>See Also</a></h2>
  63. <p>
  64. <i><b>SDL_CD</b></i> 
  65. <!--
  66.   
  67.  <p>
  68.  
  69. <hr><p>
  70. <a name='toc'><b>Table of Contents</b></a><p>
  71. <ul>
  72. <li><a name='toc0' href='#sect0'>Name</a></li>
  73. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  74. <li><a name='toc2' href='#sect2'>Description</a></li>
  75. <li><a name='toc3' href='#sect3'>Example</a></li>
  76. <li><a name='toc4' href='#sect4'>See Also</a></li>
  77. </ul>
  78. </body>
  79. </html>
  80.