| 1 | // --------------------------------------------------------------------------- |
| 2 | // Name: cdbase.h |
| 3 | // Purpose: wxMMedia |
| 4 | // Author: Guilhem Lavaux |
| 5 | // Created: 1997 |
| 6 | // Updated: 1998, 1999, 2000 |
| 7 | // Copyright: (C) 1997, 1998, 1999, 2000 Guilhem Lavaux |
| 8 | // License: wxWindows license |
| 9 | // --------------------------------------------------------------------------- |
| 10 | #ifndef __CDA_base_H__ |
| 11 | #define __CDA_base_H__ |
| 12 | |
| 13 | #if defined(__GNUG__) && !defined(__APPLE__) |
| 14 | #pragma interface "cdbase.h" |
| 15 | #endif |
| 16 | |
| 17 | #include "wx/defs.h" |
| 18 | #include "wx/object.h" |
| 19 | #include "wx/mmedia/defs.h" |
| 20 | |
| 21 | typedef struct wxCDtime { |
| 22 | wxUint8 track; |
| 23 | wxUint8 hour, min, sec; |
| 24 | } wxCDtime; |
| 25 | |
| 26 | class WXDLLIMPEXP_MMEDIA wxCDAudio : public wxObject { |
| 27 | DECLARE_ABSTRACT_CLASS(wxCDAudio) |
| 28 | public: |
| 29 | typedef enum { PLAYING, PAUSED, STOPPED } CDstatus; |
| 30 | // Table of contents manager |
| 31 | class WXDLLIMPEXP_MMEDIA CDtoc { |
| 32 | protected: |
| 33 | wxCDtime *tracks_time, *tracks_pos; |
| 34 | wxCDtime total_time; |
| 35 | public: |
| 36 | // |
| 37 | CDtoc(wxCDtime& tot_tm, wxCDtime *trks_tm, wxCDtime *trks_pos) |
| 38 | { tracks_time = trks_tm; total_time = tot_tm; tracks_pos = trks_pos; } |
| 39 | |
| 40 | // Returns the length of the specified track |
| 41 | // track: track to get length |
| 42 | wxCDtime GetTrackTime(wxUint8 track) const; |
| 43 | // Returns the position of the specified track |
| 44 | // track: track to get position |
| 45 | wxCDtime GetTrackPos(wxUint8 track) const; |
| 46 | // Returns the total time |
| 47 | inline wxCDtime GetTotalTime() const { return total_time; } |
| 48 | }; |
| 49 | public: |
| 50 | // |
| 51 | wxCDAudio() : wxObject() {} |
| 52 | // |
| 53 | virtual ~wxCDAudio() {} |
| 54 | |
| 55 | // Play audio at the specified position |
| 56 | virtual bool Play(const wxCDtime& beg_play, const wxCDtime& end_play) = 0; |
| 57 | // Play audio from the specified to the end of the CD audio |
| 58 | bool Play(const wxCDtime& beg_play); |
| 59 | // |
| 60 | bool Play(wxUint8 beg_track, wxUint8 end_track = 0); |
| 61 | // Pause the audio playing |
| 62 | virtual bool Pause() = 0; |
| 63 | // Resume a paused audio playing |
| 64 | virtual bool Resume() = 0; |
| 65 | // Get the current CD status |
| 66 | virtual CDstatus GetStatus() = 0; |
| 67 | // Get the current playing time |
| 68 | virtual wxCDtime GetTime() = 0; |
| 69 | // Returns the table of contents |
| 70 | virtual const CDtoc& GetToc() = 0; |
| 71 | // CD ok |
| 72 | virtual bool Ok() const = 0; |
| 73 | }; |
| 74 | |
| 75 | #endif |