/lib/pods/SDL/CD.pod

http://github.com/PerlGameDev/SDL · Unknown · 193 lines · 103 code · 90 blank · 0 comment · 0 complexity · 2203729c4206e1e3b59ae24a6476af03 MD5 · raw file

  1. =pod
  2. =head1 NAME
  3. SDL::CD -- SDL Bindings for structure SDL_CD
  4. =head1 CATEGORY
  5. Core, CDROM, Structure
  6. =head1 SYNOPSIS
  7. use SDL;
  8. use SDL::CDROM;
  9. use SDL::CD;
  10. SDL::init(SDL_INIT_CDROM);
  11. my $drives = SDL::CDROM::num_drives;
  12. if( $drives > 0 )
  13. {
  14. my $CD = SDL::CD->new( 0 );
  15. if($CD)
  16. {
  17. ...
  18. }
  19. }
  20. =head1 CONSTANTS
  21. The constants are exported by default. You can avoid this by doing:
  22. use SDL::CD ();
  23. and access them directly:
  24. SDL::CD::CD_TRAYEMPTY;
  25. or by choosing the export tags below:
  26. Export tag: ':status'
  27. CD_TRAYEMPTY
  28. CD_STOPPED
  29. CD_PLAYING
  30. CD_PAUSED
  31. CD_ERROR
  32. Export tag: ':defaults'
  33. CD_FPS
  34. SDL_MAX_TRACKS
  35. =head1 METHOD
  36. =head2 new
  37. my $CD = SDL::CD->new($drive)
  38. Makes a new SDL::CD object. Returns C<undef> if the drive is busy or inaccessible.
  39. =head2 status
  40. my $status = $CD->status();
  41. Returns the current status of the CD tray
  42. Returns on of the following constants:
  43. =over
  44. =item *
  45. CD_TRAYEMPTY
  46. =item *
  47. CD_STOPPED
  48. =item *
  49. CD_PLAYING
  50. =item *
  51. CD_PAUSED
  52. =item *
  53. CD_ERROR
  54. =back
  55. =head2 play_tracks
  56. $CD->play_tracks($start_track, $start_frame, $ntracks, $nframes)
  57. Plays the given SDL::CD starting at track $start_track, for $ntracks tracks.
  58. $start_frame is the frame offset, from the beginning of the $start_track, at which to start. $nframes is the frame offset, from the
  59. beginning of the last track ($start_track+$ntracks), at which to end playing.
  60. play_tracks() should only be called after calling L</status> to get information about the CD.
  61. B<Note: Data tracks are ignored.>
  62. Returns C<0>, or C<-1> if there was an error.
  63. =head2 play
  64. $CD->play($start, $length);
  65. Plays the given SDL::CD , starting a frame $start for $length frames.
  66. Returns C<0> on success, C<-1> on error
  67. =head2 pause
  68. $CD->pause();
  69. Pauses play on CD
  70. Returns C<0> on success, or C<-1> on an error.
  71. =head2 resume
  72. $CD->resume();
  73. Returns C<0> on success, or C<-1> on an error.
  74. =head2 stop
  75. $CD->stop();
  76. Stops play on the CD.
  77. Returns C<0> on success, or C<-1> on an error.
  78. =head2 eject
  79. $CD->eject();
  80. Ejects the CD.
  81. Returns C<0> on success, or C<-1> on an error.
  82. =head2 id
  83. $CD->id();
  84. Private drive identifier
  85. =head2 num_tracks
  86. $CD->num_tracks();
  87. Number of tracks on the CD
  88. =head2 cur_track
  89. $CD->cur_track();
  90. Current track on the CD;
  91. =head2 track
  92. my $track = $CD->track($number);
  93. Retrieves track description of track $number in CD. See L<SDL::CDTrack>.
  94. =head2 FRAMES_TO_MSF
  95. my ($min, $sec, $fra) = FRAMES_TO_MSF($frames);
  96. Conversion functions from frames to Minute/Second/Frames
  97. =head2 MSF_TO_FRAMES
  98. my $frames = MSF_TO_FRAMES($min, $sec, $fra);
  99. =head1 SEE ALSO
  100. L<SDL::CDROM>, L<SDL::CDTrack>
  101. =head1 AUTHORS
  102. See L<SDL/AUTHORS>.
  103. =cut