]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/mmedia/cdbase.cpp
corrected version number extraction
[wxWidgets.git] / contrib / src / mmedia / cdbase.cpp
1 // ---------------------------------------------------------------------------
2 // Name: cdbase.cpp
3 // Purpose: wxMMedia
4 // Author: Guilhem Lavaux
5 // Created: 1997
6 // Updated: 1999
7 // Copyright: (C) 1997, 1998, 1999 Guilhem Lavaux
8 // License: wxWindows license
9 // ---------------------------------------------------------------------------
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13 #include "wx/wxprec.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/defs.h"
17 #endif
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 // ---------------------------------------------------------------------------
24 // MMedia headers
25 // ---------------------------------------------------------------------------
26
27 #include "wx/mmedia/cdbase.h"
28
29 // ---------------------------------------------------------------------------
30 // Implementation
31 // ---------------------------------------------------------------------------
32
33 IMPLEMENT_ABSTRACT_CLASS(wxCDAudio, wxObject)
34
35 wxCDtime wxCDAudio::CDtoc::GetTrackTime(wxUint8 track) const
36 {
37 if (track > total_time.track) {
38 wxCDtime dummy_time = {0, 0, 0, 0};
39 return dummy_time;
40 }
41 return tracks_time[track];
42 }
43
44 wxCDtime wxCDAudio::CDtoc::GetTrackPos(wxUint8 track) const
45 {
46 if (track > total_time.track) {
47 wxCDtime dummy_time = {0, 0, 0, 0};
48 return dummy_time;
49 }
50 return tracks_pos[track];
51 }
52
53 bool wxCDAudio::Play(const wxCDtime& beg_play)
54 {
55 return Play(beg_play, GetToc().GetTotalTime());
56 }
57
58 bool wxCDAudio::Play(wxUint8 beg_track, wxUint8 end_track)
59 {
60 wxCDtime beg_play = GetToc().GetTrackPos(beg_track);
61 wxCDtime end_play;
62
63 if (end_track)
64 end_play = GetToc().GetTrackPos(end_track);
65 else
66 end_play = GetToc().GetTotalTime();
67 return Play(beg_play, end_play);
68 }