]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/sound.tex
[ 1573138 ] small docs corrections
[wxWidgets.git] / docs / latex / wx / sound.tex
... / ...
CommitLineData
1\section{\class{wxSound}}\label{wxsound}
2
3This class represents a short sound (loaded from Windows WAV file), that
4can be stored in memory and played. Currently this class is implemented
5on 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
20\membersection{wxSound::wxSound}\label{wxsoundctor}
21
22\func{}{wxSound}{\void}
23
24Default constructor.
25
26\func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}}
27
28Constructs a wave object from a file or, under Windows, from a Windows
29resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to determine whether this
30succeeded.
31
32\wxheading{Parameters}
33
34\docparam{fileName}{The filename or Windows resource.}
35
36\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
37
38
39\membersection{wxSound::\destruct{wxSound}}\label{wxsounddtor}
40
41\func{}{\destruct{wxSound}}{\void}
42
43Destroys the wxSound object.
44
45
46\membersection{wxSound::Create}\label{wxsoundcreate}
47
48\func{bool}{Create}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = \false}}
49
50Constructs a wave object from a file or resource.
51
52\wxheading{Parameters}
53
54\docparam{fileName}{The filename or Windows resource.}
55
56\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
57
58\wxheading{Return value}
59
60\true if the call was successful, \false otherwise.
61
62
63\membersection{wxSound::IsOk}\label{wxsoundisok}
64
65\constfunc{bool}{IsOk}{\void}
66
67Returns \true if the object contains a successfully loaded file or resource, \false otherwise.
68
69
70\membersection{wxSound::IsPlaying}\label{wxsoundisplaying}
71
72\constfunc{static bool}{IsPlaying}{\void}
73
74Returns \true if a sound is played at the moment.
75
76This method is currently not implemented under Windows.
77
78
79\membersection{wxSound::Play}\label{wxsoundplay}
80
81\constfunc{bool}{Play}{\param{unsigned }{ flags = wxSOUND\_ASYNC}}
82
83\func{static bool}{Play}{\param{const wxString\& }{filename}, \param{unsigned}{ flags = wxSOUND\_ASYNC}}
84
85Plays the sound file. If another sound is playing, it will be interrupted.
86Returns \true on success, \false otherwise. Note that in general it is possible
87to delete the object which is being asynchronously played any time after
88calling this function and the sound would continue playing, however this
89currently doesn't work under Windows for sound objects loaded from memory data.
90
91The possible values for \arg{flags} are:
92
93\begin{twocollist}
94\twocolitem{wxSOUND\_SYNC}{{\tt Play} will block and wait until the sound is
95replayed.}
96\twocolitem{wxSOUND\_ASYNC}{Sound is played asynchronously,
97{\tt Play} returns immediately}
98\twocolitem{wxSOUND\_ASYNC | wxSOUND\_LOOP}{Sound is played asynchronously
99and loops until another sound is played,
100\helpref{wxSound::Stop}{wxsoundstop} is called or the program terminates.}
101\end{twocollist}
102
103The static form is shorthand for this code:
104
105\begin{verbatim}
106wxSound(filename).Play(flags);
107\end{verbatim}
108
109
110\membersection{wxSound::Stop}\label{wxsoundstop}
111
112\func{static void}{Stop}{\void}
113
114If a sound is played, this function stops it.
115