]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sound.h | |
3 | // Purpose: wxSound class (loads and plays short Windows .wav files). | |
4 | // Optional on non-Windows platforms. | |
5 | // Author: Stefan Csomor | |
6 | // Modified by: | |
7 | // Created: 1998-01-01 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Stefan Csomor | |
65571936 | 10 | // Licence: wxWindows licence |
8cf73271 SC |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_SOUND_H_ | |
14 | #define _WX_SOUND_H_ | |
15 | ||
16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
17 | #pragma interface "sound.h" | |
18 | #endif | |
19 | ||
20 | #if wxUSE_SOUND | |
21 | ||
22 | #include "wx/object.h" | |
23 | ||
24 | class WXDLLEXPORT wxSound : public wxSoundBase | |
25 | { | |
26 | public: | |
27 | wxSound(); | |
28 | wxSound(const wxString& fileName, bool isResource = FALSE); | |
29 | wxSound(int size, const wxByte* data); | |
30 | ~wxSound(); | |
31 | ||
32 | public: | |
33 | bool Create(const wxString& fileName, bool isResource = FALSE); | |
34 | bool IsOk() const { return !m_sndname.IsEmpty(); } | |
35 | ||
625d14ab | 36 | void* GetHandle(); |
8cf73271 SC |
37 | protected: |
38 | // prevent collision with some BSD definitions of macro Free() | |
39 | bool FreeData(); | |
40 | ||
41 | bool DoPlay(unsigned flags) const; | |
42 | ||
43 | private: | |
625d14ab SC |
44 | wxString m_sndname; //file path |
45 | char* m_hSnd; //pointer to resource or memory location | |
46 | int m_waveLength; //size of file in memory mode | |
47 | void* m_pTimer; //timer | |
48 | ||
49 | enum wxSoundType | |
50 | { | |
51 | wxSound_MEMORY, | |
52 | wxSound_FILE, | |
53 | wxSound_RESOURCE, | |
54 | wxSound_NONE | |
55 | } m_type; //mode | |
8cf73271 SC |
56 | }; |
57 | ||
58 | #endif | |
59 | #endif | |
60 | // _WX_SOUND_H_ |