]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/mmedia/cdbase.cpp
fixed LastRead() after Read(wxOutputStream&) (patch 1658301)
[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
11 #include "wx/wxprec.h"
12
13 #ifndef WX_PRECOMP
14 #include "wx/defs.h"
15 #endif
16
17 #ifdef __BORLANDC__
18 #pragma hdrstop
19 #endif
20
21 // ---------------------------------------------------------------------------
22 // MMedia headers
23 // ---------------------------------------------------------------------------
24
25 #include "wx/mmedia/cdbase.h"
26
27 // ---------------------------------------------------------------------------
28 // Implementation
29 // ---------------------------------------------------------------------------
30
31 IMPLEMENT_ABSTRACT_CLASS(wxCDAudio, wxObject)
32
33 wxCDtime wxCDAudio::CDtoc::GetTrackTime(wxUint8 track) const
34 {
35 if (track > total_time.track) {
36 wxCDtime dummy_time = {0, 0, 0, 0};
37 return dummy_time;
38 }
39 return tracks_time[track];
40 }
41
42 wxCDtime wxCDAudio::CDtoc::GetTrackPos(wxUint8 track) const
43 {
44 if (track > total_time.track) {
45 wxCDtime dummy_time = {0, 0, 0, 0};
46 return dummy_time;
47 }
48 return tracks_pos[track];
49 }
50
51 bool wxCDAudio::Play(const wxCDtime& beg_play)
52 {
53 return Play(beg_play, GetToc().GetTotalTime());
54 }
55
56 bool wxCDAudio::Play(wxUint8 beg_track, wxUint8 end_track)
57 {
58 wxCDtime beg_play = GetToc().GetTrackPos(beg_track);
59 wxCDtime end_play;
60
61 if (end_track)
62 end_play = GetToc().GetTrackPos(end_track);
63 else
64 end_play = GetToc().GetTotalTime();
65 return Play(beg_play, end_play);
66 }