]>
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. | |
5 | // Author: Ryan Norton | |
6 | // Modified by: | |
7 | // Created: 2004-10-02 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Ryan Norton | |
10 | // Licence: wxWindows licence | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
dcb68102 | 12 | |
0c0be4a3 RN |
13 | #ifndef _WX_COCOA_SOUND_H_ |
14 | #define _WX_COCOA_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" | |
a2c1097b | 23 | #include "wx/cocoa/ObjcRef.h" |
0c0be4a3 RN |
24 | |
25 | class WXDLLEXPORT wxSound : public wxSoundBase | |
26 | { | |
27 | public: | |
4fca6ee1 DE |
28 | wxSound(); |
29 | wxSound(const wxString& fileName, bool isResource = false); | |
30 | wxSound(int size, const wxByte* data); | |
31 | ~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 | |
4fca6ee1 | 40 | inline WX_NSSound GetNSSound() |
a2c1097b | 41 | { return m_cocoaNSSound; } |
0c0be4a3 | 42 | protected: |
4fca6ee1 | 43 | bool DoPlay(unsigned flags) const; |
0c0be4a3 RN |
44 | |
45 | private: | |
a2c1097b | 46 | WX_NSSound m_cocoaNSSound; //NSSound handle |
0c0be4a3 RN |
47 | wxString m_sndname; //file path |
48 | int m_waveLength; //size of file in memory mode | |
a2c1097b | 49 | static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate; |
0c0be4a3 RN |
50 | }; |
51 | ||
52 | #endif | |
53 | #endif | |
54 | // _WX_COCOA_SOUND_H_ |