]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/sound.h
Add wxUSE_RIBBON to wx/setup_inc.h and wx/chkconf.h.
[wxWidgets.git] / include / wx / osx / sound.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sound.h
3 // Purpose: wxSound class (loads and plays short Windows .wav files).
4 // Optional on non-Windows platforms.
5 // Author: Ryan Norton, Stefan Csomor
6 // Modified by:
7 // Created: 1998-01-01
8 // RCS-ID: $Id$
9 // Copyright: (c) Ryan Norton, Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_SOUND_H_
14 #define _WX_SOUND_H_
15
16 #if wxUSE_SOUND
17
18 #include "wx/object.h"
19
20 class WXDLLIMPEXP_ADV wxSoundTimer;
21
22 class WXDLLIMPEXP_ADV wxSoundData
23 {
24 public :
25 wxSoundData();
26 virtual ~wxSoundData();
27
28 virtual bool Play(unsigned int flags) = 0;
29 // stops the sound and deletes the optional timer
30 virtual void Stop();
31 // can be called by a timer for repeated tasks during playback
32 virtual void SoundTask();
33
34 // does the true work of stopping and cleaning up
35 virtual void DoStop() = 0;
36 protected :
37 void CreateAndStartTimer();
38
39 unsigned int m_flags;
40 wxSoundTimer* m_pTimer;
41 } ;
42
43 class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
44 {
45 public:
46 wxSound();
47 wxSound(const wxString& fileName, bool isResource = FALSE);
48 wxSound(int size, const wxByte* data);
49 virtual ~wxSound();
50
51 // Create from resource or file
52 bool Create(const wxString& fileName, bool isResource = FALSE);
53 // Create from data
54 bool Create(int size, const wxByte* data);
55
56 bool IsOk() const { return m_data != NULL; }
57
58 // Stop playing any sound
59 static void Stop();
60
61 // Returns true if a sound is being played
62 static bool IsPlaying();
63
64 // Notification when a sound has stopped
65 static void SoundStopped(const wxSoundData* data);
66
67 protected:
68 bool DoPlay(unsigned flags) const;
69 void Init();
70
71 private:
72 // data of this object
73 class wxSoundData *m_data;
74
75 wxDECLARE_NO_COPY_CLASS(wxSound);
76 };
77
78 #endif
79 #endif
80 // _WX_SOUND_H_