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
8 // Copyright: (c) 2004 David Elliott, Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COCOA_SOUND_H_
13 #define _WX_COCOA_SOUND_H_
15 #include "wx/object.h"
16 #include "wx/cocoa/ObjcRef.h"
18 class WXDLLIMPEXP_ADV wxSound
: public wxSoundBase
22 : m_cocoaNSSound(NULL
)
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?
34 bool Create(const wxString
& fileName
, bool isResource
= false);
36 { return m_cocoaNSSound
; }
38 static bool IsPlaying();
40 void SetNSSound(WX_NSSound cocoaNSSound
);
41 inline WX_NSSound
GetNSSound()
42 { return m_cocoaNSSound
; }
44 bool DoPlay(unsigned flags
) const;
45 bool LoadWAV(const void* data
, size_t length
, bool copyData
);
47 WX_NSSound m_cocoaNSSound
;
48 static const wxObjcAutoRefFromAlloc
<struct objc_object
*> sm_cocoaDelegate
;
51 #endif //ndef _WX_COCOA_SOUND_H_