]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sound.h
remove unused file
[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 #include "wx/defs.h"
16
17 #if wxUSE_SOUND
18
19 #include "wx/object.h"
20
21 // ----------------------------------------------------------------------------
22 // wxSoundBase: common wxSound code and interface
23 // ----------------------------------------------------------------------------
24
25 // Flags for wxSound::Play
26
27 // NB: We can't use enum with some compilers, because they keep reporting
28 // nonexistent ambiguities between Play(unsigned) and static Play(const
29 // wxString&, unsigned).
30 #define wxSOUND_SYNC ((unsigned)0)
31 #define wxSOUND_ASYNC ((unsigned)1)
32 #define wxSOUND_LOOP ((unsigned)2)
33
34 // Base class for wxSound implementations
35 class WXDLLIMPEXP_ADV wxSoundBase : public wxObject
36 {
37 public:
38 // Play the sound:
39 bool Play(unsigned flags = wxSOUND_ASYNC) const
40 {
41 wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 ||
42 (flags & wxSOUND_ASYNC) != 0,
43 _T("sound can only be looped asynchronously") );
44 return DoPlay(flags);
45 }
46
47 // Plays sound from filename:
48 static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC);
49
50 protected:
51 virtual bool DoPlay(unsigned flags) const = 0;
52 };
53
54 // ----------------------------------------------------------------------------
55 // wxSound class implementation
56 // ----------------------------------------------------------------------------
57
58 #if defined(__WXMSW__)
59 #include "wx/msw/sound.h"
60 #elif defined(__WXCOCOA__)
61 #include "wx/cocoa/sound.h"
62 #elif defined(__WXMAC__)
63 #include "wx/mac/sound.h"
64 #elif defined(__WXPM__)
65 #include "wx/os2/sound.h"
66 #elif defined(__UNIX__)
67 #include "wx/unix/sound.h"
68 #endif
69
70 // ----------------------------------------------------------------------------
71 // wxSoundBase methods
72 // ----------------------------------------------------------------------------
73
74 inline bool wxSoundBase::Play(const wxString& filename, unsigned flags)
75 {
76 wxSound snd(filename);
77 return snd.IsOk() ? snd.Play(flags) : false;
78 }
79
80 #endif // wxUSE_SOUND
81
82 #endif // _WX_SOUND_H_BASE_