]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/cocoa/sound.h
don't deprecate the entire wxDrawObject class, this results in warnings when we just...
[wxWidgets.git] / include / wx / cocoa / sound.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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
6// Modified by:
7// Created: 2004-10-02
8// RCS-ID: $Id$
9// Copyright: (c) 2004 David Elliott, Ryan Norton
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_COCOA_SOUND_H_
14#define _WX_COCOA_SOUND_H_
15
16#include "wx/object.h"
17#include "wx/cocoa/ObjcRef.h"
18
19class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
20{
21public:
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?
32 virtual ~wxSound();
33
34public:
35 bool Create(const wxString& fileName, bool isResource = false);
36 bool IsOk() const
37 { return m_cocoaNSSound; }
38 static void Stop();
39 static bool IsPlaying();
40
41 void SetNSSound(WX_NSSound cocoaNSSound);
42 inline WX_NSSound GetNSSound()
43 { return m_cocoaNSSound; }
44protected:
45 bool DoPlay(unsigned flags) const;
46 bool LoadWAV(const wxUint8 *data, size_t length, bool copyData);
47private:
48 WX_NSSound m_cocoaNSSound;
49 static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate;
50};
51
52#endif //ndef _WX_COCOA_SOUND_H_