]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/cocoa/sound.h | |
3 | // Purpose: wxSound class (loads and plays short Windows .wav files). | |
4 | // Optional on non-Windows platforms. | |
5 | // Authors: David Elliott, Ryan Norton | |
6 | // Modified by: | |
7 | // Created: 2004-10-02 | |
8 | // Copyright: (c) 2004 David Elliott, Ryan Norton | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COCOA_SOUND_H_ | |
13 | #define _WX_COCOA_SOUND_H_ | |
14 | ||
15 | #include "wx/object.h" | |
16 | #include "wx/cocoa/ObjcRef.h" | |
17 | ||
18 | class WXDLLIMPEXP_ADV wxSound : public wxSoundBase | |
19 | { | |
20 | public: | |
21 | wxSound() | |
22 | : m_cocoaNSSound(NULL) | |
23 | {} | |
24 | wxSound(const wxString& fileName, bool isResource = false) | |
25 | : m_cocoaNSSound(NULL) | |
26 | { Create(fileName, isResource); } | |
27 | wxSound(size_t size, const void* data) | |
28 | : m_cocoaNSSound(NULL) | |
29 | { LoadWAV(data,size,true); } | |
30 | wxSound(const wxSound& sound); // why not? | |
31 | virtual ~wxSound(); | |
32 | ||
33 | public: | |
34 | bool Create(const wxString& fileName, bool isResource = false); | |
35 | bool IsOk() const | |
36 | { return m_cocoaNSSound; } | |
37 | static void Stop(); | |
38 | static bool IsPlaying(); | |
39 | ||
40 | void SetNSSound(WX_NSSound cocoaNSSound); | |
41 | inline WX_NSSound GetNSSound() | |
42 | { return m_cocoaNSSound; } | |
43 | protected: | |
44 | bool DoPlay(unsigned flags) const; | |
45 | bool LoadWAV(const void* data, size_t length, bool copyData); | |
46 | private: | |
47 | WX_NSSound m_cocoaNSSound; | |
48 | static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate; | |
49 | }; | |
50 | ||
51 | #endif //ndef _WX_COCOA_SOUND_H_ |