]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/sound.h
adding defaults as wxDC did
[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();
27
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();
33
34 // does the true work of stopping and cleaning up
35 virtual void DoStop() = 0;
36protected :
37 void CreateAndStartTimer();
38
39 unsigned int m_flags;
40 wxSoundTimer* m_pTimer;
41} ;
42
6762286d
SC
43class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
44{
45public:
deb0a11e
SC
46 wxSound();
47 wxSound(const wxString& fileName, bool isResource = FALSE);
48 wxSound(int size, const wxByte* data);
49 virtual ~wxSound();
6762286d 50
deb0a11e
SC
51 // Create from resource or file
52 bool Create(const wxString& fileName, bool isResource = FALSE);
53 // Create from data
54 bool Create(int size, const wxByte* data);
6762286d 55
deb0a11e
SC
56 bool IsOk() const { return m_data != NULL; }
57
58 // Stop playing any sound
59 static void Stop();
60
61 // Returns true if a sound is being played
62 static bool IsPlaying();
63
64 // Notification when a sound has stopped
65 static void SoundStopped(const wxSoundData* data);
66
03647350 67protected:
deb0a11e
SC
68 bool DoPlay(unsigned flags) const;
69 void Init();
6762286d
SC
70
71private:
deb0a11e
SC
72 // data of this object
73 class wxSoundData *m_data;
74
75 wxDECLARE_NO_COPY_CLASS(wxSound);
6762286d
SC
76};
77
5c6eb3a8 78#endif
6762286d
SC
79#endif
80 // _WX_SOUND_H_