]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/sound.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSound
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 This class represents a short sound (loaded from Windows WAV file), that
13 can be stored in memory and played. Currently this class is implemented
14 on Windows and Unix (and uses either
16 Simple DirectMedia Layer).
21 class wxSound
: public wxObject
26 Constructs a wave object from a file or, under Windows, from a Windows
27 resource. Call IsOk() to determine whether this
31 The filename or Windows resource.
33 @true if fileName is a resource, @false if it is a filename.
36 wxSound(const wxString
& fileName
, bool isResource
= false);
40 Destroys the wxSound object.
45 Constructs a wave object from a file or resource.
48 The filename or Windows resource.
50 @true if fileName is a resource, @false if it is a filename.
52 @return @true if the call was successful, @false otherwise.
54 bool Create(const wxString
& fileName
, bool isResource
= false);
57 Returns @true if the object contains a successfully loaded file or resource,
63 Returns @true if a sound is played at the moment.
64 This method is currently not implemented under Windows.
66 static bool IsPlaying() const;
70 Plays the sound file. If another sound is playing, it will be interrupted.
71 Returns @true on success, @false otherwise. Note that in general it is
73 to delete the object which is being asynchronously played any time after
74 calling this function and the sound would continue playing, however this
75 currently doesn't work under Windows for sound objects loaded from memory data.
76 The possible values for @a flags are:
80 @c Play will block and wait until the sound is
85 Sound is played asynchronously,
86 @c Play returns immediately
88 wxSOUND_ASYNC | wxSOUND_LOOP
90 Sound is played asynchronously
91 and loops until another sound is played,
92 Stop() is called or the program terminates.
94 The static form is shorthand for this code:
96 bool Play(unsigned flags
= wxSOUND_ASYNC
);
97 const static bool Play(const wxString
& filename
,
98 unsigned flags
= wxSOUND_ASYNC
);
102 If a sound is played, this function stops it.