]>
Commit | Line | Data |
---|---|---|
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 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
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" | |
23 | #include "wx/cocoa/ObjcRef.h" | |
24 | ||
25 | class WXDLLEXPORT wxSound : public wxSoundBase | |
26 | { | |
27 | public: | |
28 | wxSound(); | |
29 | wxSound(const wxString& fileName, bool isResource = false); | |
30 | wxSound(int size, const wxByte* data); | |
31 | ~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 | inline WX_NSSound GetNSSound() | |
41 | { return m_cocoaNSSound; } | |
42 | protected: | |
43 | bool DoPlay(unsigned flags) const; | |
44 | ||
45 | private: | |
46 | WX_NSSound m_cocoaNSSound; //NSSound handle | |
47 | wxString m_sndname; //file path | |
48 | int m_waveLength; //size of file in memory mode | |
49 | static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate; | |
50 | }; | |
51 | ||
52 | #endif | |
53 | #endif | |
54 | // _WX_COCOA_SOUND_H_ |