]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/sound.tex
Documented new constructor and overloaded Create methods.
[wxWidgets.git] / docs / latex / wx / sound.tex
1 \section{\class{wxSound}}\label{wxsound}
2
3 This class represents a short sound (loaded from Windows WAV file), that
4 can be stored in memory and played. Currently this class is implemented
5 on Windows and Unix (and uses either
6 \urlref{Open Sound System}{http://www.opensound.com/oss.html} or
7 \urlref{Simple DirectMedia Layer}{http://www.libsdl.org/}).
8
9 \wxheading{Derived from}
10
11 \helpref{wxObject}{wxobject}
12
13 \wxheading{Include files}
14
15 <wx/sound.h>
16
17 \latexignore{\rtfignore{\wxheading{Members}}}
18
19 \membersection{wxSound::wxSound}\label{wxsoundconstr}
20
21 \func{}{wxSound}{\void}
22
23 Default constructor.
24
25 \func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}}
26
27 Constructs a wave object from a file or resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to
28 determine whether this succeeded.
29
30 \wxheading{Parameters}
31
32 \docparam{fileName}{The filename or Windows resource.}
33
34 \docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
35
36 \membersection{wxSound::\destruct{wxSound}}
37
38 \func{}{\destruct{wxSound}}{\void}
39
40 Destroys the wxSound object.
41
42 \membersection{wxSound::Create}\label{wxsoundcreate}
43
44 \func{bool}{Create}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = \false}}
45
46 Constructs a wave object from a file or resource.
47
48 \wxheading{Parameters}
49
50 \docparam{fileName}{The filename or Windows resource.}
51
52 \docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
53
54 \wxheading{Return value}
55
56 \true if the call was successful, \false otherwise.
57
58 \membersection{wxSound::IsOk}\label{wxsoundisok}
59
60 \constfunc{bool}{IsOk}{\void}
61
62 Returns \true if the object contains a successfully loaded file or resource, \false otherwise.
63
64 \membersection{wxSound::IsPlaying}\label{wxsoundisplaying}
65
66 \constfunc{static bool}{IsPlaying}{\void}
67
68 Returns \true if a sound is played at the moment.
69
70 \membersection{wxSound::Play}\label{wxsoundplay}
71
72 \constfunc{bool}{Play}{\param{unsigned }{ flags = wxSOUND\_ASYNC}}
73
74 \func{static bool}{Play}{\param{const wxString\& }{filename}, \param{unsigned}{ flags = wxSOUND\_ASYNC}}
75
76 Plays the sound file. If another sound is playing, it will be interrupted.
77 Returns \true on success, \false otherwise.
78
79 The possible values for \arg{flags} are:
80
81 \begin{twocollist}
82 \twocolitem{wxSOUND\_SYNC}{{\tt Play} will block and wait until the sound is
83 replayed.}
84 \twocolitem{wxSOUND\_ASYNC}{Sound is played asynchronously,
85 {\tt Play} returns immediately}
86 \twocolitem{wxSOUND\_ASYNC | wxSOUND\_LOOP}{Sound is played asynchronously
87 and loops until another sound is played,
88 \helpref{wxSound::Stop}{wxsoundstop} is called or the program terminates.}
89 \end{twocollist}
90
91 The static form is shorthand for this code:
92 \begin{verbatim}
93 wxSound(filename).Play(flags);
94 \end{verbatim}
95
96 \membersection{wxSound::Stop}\label{wxsoundstop}
97
98 \func{static void}{Stop}{\void}
99
100 If a sound is played, this function stops it.