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