]>
Commit | Line | Data |
---|---|---|
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 wxSound : public wxSoundBase | |
21 | { | |
22 | public: | |
23 | wxSound(); | |
24 | wxSound(const wxString& fileName, bool isResource = FALSE); | |
25 | wxSound(int size, const wxByte* data); | |
26 | virtual ~wxSound(); | |
27 | ||
28 | public: | |
29 | bool Create(const wxString& fileName, bool isResource = FALSE); | |
30 | bool IsOk() const { return !m_sndname.IsEmpty(); } | |
31 | static void Stop(); | |
32 | static bool IsPlaying(); | |
33 | ||
34 | void* GetHandle(); | |
35 | protected: | |
36 | bool DoPlay(unsigned flags) const; | |
37 | ||
38 | private: | |
39 | wxString m_sndname; //file path | |
40 | char* m_hSnd; //pointer to resource or memory location | |
41 | int m_waveLength; //size of file in memory mode | |
42 | void* m_pTimer; //timer | |
43 | ||
44 | enum wxSoundType | |
45 | { | |
46 | wxSound_MEMORY, | |
47 | wxSound_FILE, | |
48 | wxSound_RESOURCE, | |
49 | wxSound_NONE | |
50 | } m_type; //mode | |
51 | }; | |
52 | ||
53 | #endif | |
54 | #endif | |
55 | // _WX_SOUND_H_ |