]>
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. | |
4b430ee1 | 5 | // Author: Ryan Norton, Stefan Csomor |
8cf73271 SC |
6 | // Modified by: |
7 | // Created: 1998-01-01 | |
8 | // RCS-ID: $Id$ | |
4b430ee1 | 9 | // Copyright: (c) Ryan Norton, 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(); } | |
4b430ee1 DS |
35 | static void Stop(); |
36 | static bool IsPlaying(); | |
8cf73271 | 37 | |
625d14ab | 38 | void* GetHandle(); |
4b430ee1 | 39 | protected: |
8cf73271 SC |
40 | bool DoPlay(unsigned flags) const; |
41 | ||
42 | private: | |
625d14ab SC |
43 | wxString m_sndname; //file path |
44 | char* m_hSnd; //pointer to resource or memory location | |
45 | int m_waveLength; //size of file in memory mode | |
46 | void* m_pTimer; //timer | |
47 | ||
48 | enum wxSoundType | |
49 | { | |
50 | wxSound_MEMORY, | |
51 | wxSound_FILE, | |
52 | wxSound_RESOURCE, | |
53 | wxSound_NONE | |
54 | } m_type; //mode | |
8cf73271 SC |
55 | }; |
56 | ||
57 | #endif | |
58 | #endif | |
59 | // _WX_SOUND_H_ |