]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sound.h
renamed wxWave to wxSound
[wxWidgets.git] / include / wx / sound.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/sound.h
3 // Purpose: wxSoundBase class
4 // Author: Vaclav Slavik
5 // Modified by:
6 // Created: 2004/02/01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2004, Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SOUND_H_BASE_
13 #define _WX_SOUND_H_BASE_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "soundbase.h"
17 #endif
18
19 #include "wx/object.h"
20
21 // ----------------------------------------------------------------------------
22 // wxSoundBase: common wxSound code and interface
23 // ----------------------------------------------------------------------------
24
25 // Flags for wxSound::Play
26 enum wxSoundFlags
27 {
28 wxSOUND_SYNC = 0,
29 wxSOUND_ASYNC = 1,
30 wxSOUND_LOOP = 2 | wxSOUND_ASYNC
31 };
32
33 class wxSoundBase : public wxObject
34 {
35 public:
36 // Play the sound:
37 bool Play(unsigned flags = wxSOUND_ASYNC)
38 {
39 return DoPlay(flags);
40 }
41 #if WXWIN_COMPATIBILITY_2_4
42 wxDEPRECATED( bool Play(bool async = true, bool looped = false) );
43 #endif
44
45 protected:
46 virtual bool DoPlay(unsigned flags) = 0;
47 };
48
49 #if WXWIN_COMPATIBILITY_2_4
50 inline bool wxSoundBase::Play(bool async, bool looped)
51 {
52 unsigned flags = 0;
53 if (async) flags |= wxSOUND_ASYNC;
54 if (looped) flags |= wxSOUND_LOOP;
55 return DoPlay(flags);
56 }
57 #endif
58
59 // ----------------------------------------------------------------------------
60 // wxSound class implementation
61 // ----------------------------------------------------------------------------
62
63 #if defined(__WXMSW__)
64 #include "wx/msw/wave.h"
65 #elif defined(__UNIX__)
66 #include "wx/unix/sound.h"
67 #elif defined(__WXMAC__)
68 #include "wx/mac/wave.h"
69 #elif defined(__WXPM__)
70 #include "wx/os2/wave.h"
71 #endif
72
73 // wxSound used to be called wxWave before wxWindows 2.5.1:
74 #ifdef __UNIX__ // FIXME: on all platforms when everything is renamed
75 #if WXWIN_COMPATIBILITY_2_4
76 typedef wxSound wxWave;
77 #endif
78 #else
79 typedef wxWave wxSound;
80 #endif
81
82 #endif // _WX_SOUND_H_BASE_