]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/sound.h
When wxPGProperty is un-attached from wxPropertyGrid, keep its 'default' cell referen...
[wxWidgets.git] / include / wx / osx / sound.h
CommitLineData
6762286d
SC
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, Stefan Csomor
6// Modified by:
7// Created: 1998-01-01
8// RCS-ID: $Id$
9// Copyright: (c) Ryan Norton, Stefan Csomor
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_SOUND_H_
14#define _WX_SOUND_H_
15
16#if wxUSE_SOUND
17
18#include "wx/object.h"
19
6f0740be 20class WXDLLIMPEXP_FWD_ADV wxSoundTimer;
deb0a11e
SC
21
22class WXDLLIMPEXP_ADV wxSoundData
23{
24public :
25 wxSoundData();
26 virtual ~wxSoundData();
ce00f59b 27
deb0a11e
SC
28 virtual bool Play(unsigned int flags) = 0;
29 // stops the sound and deletes the optional timer
30 virtual void Stop();
31 // can be called by a timer for repeated tasks during playback
32 virtual void SoundTask();
509da835
KO
33 // mark this to be deleted
34 virtual void MarkForDeletion();
35 virtual bool IsMarkedForDeletion() const { return m_markedForDeletion; }
ce00f59b 36
deb0a11e
SC
37 // does the true work of stopping and cleaning up
38 virtual void DoStop() = 0;
39protected :
40 void CreateAndStartTimer();
ce00f59b 41
deb0a11e
SC
42 unsigned int m_flags;
43 wxSoundTimer* m_pTimer;
509da835 44 bool m_markedForDeletion;
deb0a11e
SC
45} ;
46
6762286d
SC
47class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
48{
49public:
deb0a11e 50 wxSound();
8e6efd1f 51 wxSound(const wxString& fileName, bool isResource = false);
deb0a11e
SC
52 wxSound(int size, const wxByte* data);
53 virtual ~wxSound();
6762286d 54
deb0a11e 55 // Create from resource or file
8e6efd1f 56 bool Create(const wxString& fileName, bool isResource = false);
deb0a11e
SC
57 // Create from data
58 bool Create(int size, const wxByte* data);
6762286d 59
deb0a11e 60 bool IsOk() const { return m_data != NULL; }
ce00f59b 61
deb0a11e
SC
62 // Stop playing any sound
63 static void Stop();
ce00f59b 64
deb0a11e
SC
65 // Returns true if a sound is being played
66 static bool IsPlaying();
ce00f59b 67
deb0a11e
SC
68 // Notification when a sound has stopped
69 static void SoundStopped(const wxSoundData* data);
ce00f59b 70
03647350 71protected:
deb0a11e
SC
72 bool DoPlay(unsigned flags) const;
73 void Init();
6762286d
SC
74
75private:
deb0a11e
SC
76 // data of this object
77 class wxSoundData *m_data;
ce00f59b 78
deb0a11e 79 wxDECLARE_NO_COPY_CLASS(wxSound);
6762286d
SC
80};
81
5c6eb3a8 82#endif
6762286d
SC
83#endif
84 // _WX_SOUND_H_