Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

cdaudio_win32.h

Go to the documentation of this file.
00001 #ifndef header_cdaudio_win32
00002 #define header_cdaudio_win32
00003 
00004 #include "API/Sound/cd_audio.h"
00005 
00006 /* Conversion functions from frames to Minute/Second/Frames and vice versa */
00007 #define CD_FPS  75
00008 #define FRAMES_TO_MSF(f, M,S,F) {                                       \
00009         int value = f;                                                  \
00010         *(F) = value%CD_FPS;                                            \
00011         value /= CD_FPS;                                                \
00012         *(S) = value%60;                                                \
00013         value /= 60;                                                    \
00014         *(M) = value;                                                   \
00015 }
00016 #define MSF_TO_FRAMES(M, S, F)  ((M)*60*CD_FPS+(S)*CD_FPS+(F))
00017 
00018 class CL_CDDrive_Win32 : public CL_CDDrive
00019 {
00020 public:
00021         static void init_cdaudio();
00022 
00023         CL_CDDrive_Win32(std::string path, std::string name);
00024         virtual ~CL_CDDrive_Win32();
00025 
00026         virtual bool init();
00027 
00028         virtual std::string get_drive_path();
00029         virtual std::string get_cd_name();
00030 
00031         virtual int get_num_tracks();
00032 
00033         virtual bool is_playing();
00034         virtual int get_cur_track();
00035         virtual int get_cur_frame();
00036 
00037         virtual bool play_tracks(int track, int end_track=0);
00038         virtual bool play_frames(int frame, int end_frame=0);
00039         virtual bool play_track(int track);
00040 
00041         virtual void stop();
00042         virtual void pause();
00043         virtual void resume();
00044 private:
00045         std::string path, name;
00046         MCIDEVICEID id;
00047         
00048         struct STrack
00049         {
00050                 unsigned int id;
00051                 unsigned int start_frame;
00052                 unsigned int length_frames;
00053                 bool is_audio;
00054         };
00055         std::vector<STrack> tracks;
00056         unsigned int num_tracks;
00057 
00058         int cur_track;
00059         int cur_frame;
00060         bool cd_playing;
00061 
00062         bool send_command(unsigned int msg, unsigned int flags, void *arg);
00063         bool read_toc();
00064         void update_status();
00065 };
00066 
00067 #endif

Generated at Wed Apr 4 19:53:59 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001