]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/cdbase.cpp
Added wxSound for Windows support (successful WAV playback on VC++ 5)
[wxWidgets.git] / utils / wxMMedia2 / lib / cdbase.cpp
1 // ---------------------------------------------------------------------------
2 // Name: sndsnd.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 #include "cdbase.h"
15
16 #ifdef __BORLANDC__
17 #pragma hdrstop
18 #endif
19
20 #if !USE_SHARED_LIBRARY
21 IMPLEMENT_ABSTRACT_CLASS(wxCDAudio, wxObject)
22 #endif
23
24 wxCDtime wxCDAudio::CDtoc::GetTrackTime(wxUint8 track) const
25 {
26 if (track > total_time.track) {
27 wxCDtime dummy_time = {0, 0, 0, 0};
28 return dummy_time;
29 }
30 return tracks_time[track];
31 }
32
33 wxCDtime wxCDAudio::CDtoc::GetTrackPos(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_pos[track];
40 }
41
42 bool wxCDAudio::Play(const wxCDtime& beg_play)
43 {
44 return Play(beg_play, GetToc().GetTotalTime());
45 }
46
47 bool wxCDAudio::Play(wxUint8 beg_track, wxUint8 end_track)
48 {
49 wxCDtime beg_play = GetToc().GetTrackPos(beg_track);
50 wxCDtime end_play;
51
52 if (end_track)
53 end_play = GetToc().GetTrackPos(end_track);
54 else
55 end_play = GetToc().GetTotalTime();
56 return Play(beg_play, end_play);
57 }