1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxSound class (loads and plays short Windows .wav files). 
   4 //              Optional on non-Windows platforms. 
   5 // Authors:     David Elliott, Ryan Norton 
   9 // Copyright:   (c) 2004 David Elliott, Ryan Norton 
  10 // Licence:     wxWindows licence 
  11 ///////////////////////////////////////////////////////////////////////////// 
  13 #ifndef _WX_COCOA_SOUND_H_ 
  14 #define _WX_COCOA_SOUND_H_ 
  16 #include "wx/object.h" 
  17 #include "wx/cocoa/ObjcRef.h" 
  19 class WXDLLEXPORT wxSound 
: public wxSoundBase
 
  23     :   m_cocoaNSSound(NULL
) 
  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? 
  35     bool Create(const wxString
& fileName
, bool isResource 
= false); 
  37     {   return m_cocoaNSSound
; } 
  39     static bool IsPlaying(); 
  41     void SetNSSound(WX_NSSound cocoaNSSound
); 
  42     inline WX_NSSound 
GetNSSound() 
  43     {   return m_cocoaNSSound
; } 
  45     bool DoPlay(unsigned flags
) const; 
  46     bool LoadWAV(const wxUint8 
*data
, size_t length
, bool copyData
); 
  48     WX_NSSound m_cocoaNSSound
; 
  49     static const wxObjcAutoRefFromAlloc
<struct objc_object 
*> sm_cocoaDelegate
; 
  52 #endif //ndef _WX_COCOA_SOUND_H_