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