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