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