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
8 // Copyright: (c) Ryan Norton, Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/object.h"
19 class WXDLLIMPEXP_FWD_ADV wxSoundTimer
;
21 class WXDLLIMPEXP_ADV wxSoundData
25 virtual ~wxSoundData();
27 virtual bool Play(unsigned int flags
) = 0;
28 // stops the sound and deletes the optional timer
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
; }
36 // does the true work of stopping and cleaning up
37 virtual void DoStop() = 0;
39 void CreateAndStartTimer();
42 wxSoundTimer
* m_pTimer
;
43 bool m_markedForDeletion
;
46 class WXDLLIMPEXP_ADV wxSound
: public wxSoundBase
50 wxSound(const wxString
& fileName
, bool isResource
= false);
51 wxSound(size_t size
, const void* data
);
54 // Create from resource or file
55 bool Create(const wxString
& fileName
, bool isResource
= false);
57 bool Create(size_t size
, const void* data
);
59 bool IsOk() const { return m_data
!= NULL
; }
61 // Stop playing any sound
64 // Returns true if a sound is being played
65 static bool IsPlaying();
67 // Notification when a sound has stopped
68 static void SoundStopped(const wxSoundData
* data
);
71 bool DoPlay(unsigned flags
) const;
75 // data of this object
76 class wxSoundData
*m_data
;
78 wxDECLARE_NO_COPY_CLASS(wxSound
);