1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSound class (loads and plays short Windows .wav files).
4 // Optional on non-Windows platforms.
5 // Author: Ryan Norton, Stefan Csomor
9 // Copyright: (c) Ryan Norton, Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/object.h"
20 class WXDLLIMPEXP_ADV wxSoundTimer
;
22 class WXDLLIMPEXP_ADV wxSoundData
26 virtual ~wxSoundData();
28 virtual bool Play(unsigned int flags
) = 0;
29 // stops the sound and deletes the optional timer
31 // can be called by a timer for repeated tasks during playback
32 virtual void SoundTask();
34 // does the true work of stopping and cleaning up
35 virtual void DoStop() = 0;
37 void CreateAndStartTimer();
40 wxSoundTimer
* m_pTimer
;
43 class WXDLLIMPEXP_ADV wxSound
: public wxSoundBase
47 wxSound(const wxString
& fileName
, bool isResource
= FALSE
);
48 wxSound(int size
, const wxByte
* data
);
51 // Create from resource or file
52 bool Create(const wxString
& fileName
, bool isResource
= FALSE
);
54 bool Create(int size
, const wxByte
* data
);
56 bool IsOk() const { return m_data
!= NULL
; }
58 // Stop playing any sound
61 // Returns true if a sound is being played
62 static bool IsPlaying();
64 // Notification when a sound has stopped
65 static void SoundStopped(const wxSoundData
* data
);
68 bool DoPlay(unsigned flags
) const;
72 // data of this object
73 class wxSoundData
*m_data
;
75 wxDECLARE_NO_COPY_CLASS(wxSound
);