]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/sound.tex
[ 1573138 ] small docs corrections
[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
b1e0f4ed 19
39275175 20\membersection{wxSound::wxSound}\label{wxsoundctor}
eaaa6a06 21
315ebf68 22\func{}{wxSound}{\void}
eaaa6a06
JS
23
24Default constructor.
25
315ebf68 26\func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}}
eaaa6a06 27
b1e0f4ed
VZ
28Constructs a wave object from a file or, under Windows, from a Windows
29resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to determine whether this
30succeeded.
eaaa6a06
JS
31
32\wxheading{Parameters}
33
34\docparam{fileName}{The filename or Windows resource.}
35
dcb206ad 36\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
eaaa6a06 37
b1e0f4ed 38
39275175 39\membersection{wxSound::\destruct{wxSound}}\label{wxsounddtor}
eaaa6a06 40
315ebf68 41\func{}{\destruct{wxSound}}{\void}
eaaa6a06 42
315ebf68 43Destroys the wxSound object.
eaaa6a06 44
b1e0f4ed 45
315ebf68 46\membersection{wxSound::Create}\label{wxsoundcreate}
eaaa6a06 47
dcb206ad 48\func{bool}{Create}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = \false}}
eaaa6a06
JS
49
50Constructs a wave object from a file or resource.
51
52\wxheading{Parameters}
53
54\docparam{fileName}{The filename or Windows resource.}
55
dcb206ad 56\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
eaaa6a06
JS
57
58\wxheading{Return value}
59
dcb206ad 60\true if the call was successful, \false otherwise.
eaaa6a06 61
b1e0f4ed 62
315ebf68 63\membersection{wxSound::IsOk}\label{wxsoundisok}
eaaa6a06
JS
64
65\constfunc{bool}{IsOk}{\void}
66
dcb206ad
VS
67Returns \true if the object contains a successfully loaded file or resource, \false otherwise.
68
b1e0f4ed 69
dcb206ad
VS
70\membersection{wxSound::IsPlaying}\label{wxsoundisplaying}
71
72\constfunc{static bool}{IsPlaying}{\void}
73
74Returns \true if a sound is played at the moment.
eaaa6a06 75
b1e0f4ed
VZ
76This method is currently not implemented under Windows.
77
78
315ebf68 79\membersection{wxSound::Play}\label{wxsoundplay}
eaaa6a06 80
dcb206ad
VS
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.
b1e0f4ed
VZ
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.
dcb206ad
VS
90
91The possible values for \arg{flags} are:
92
93\begin{twocollist}
5a30d450
JS
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.}
dcb206ad
VS
101\end{twocollist}
102
103The static form is shorthand for this code:
d2c2afc9 104
dcb206ad
VS
105\begin{verbatim}
106wxSound(filename).Play(flags);
107\end{verbatim}
eaaa6a06 108
b1e0f4ed 109
dcb206ad 110\membersection{wxSound::Stop}\label{wxsoundstop}
eaaa6a06 111
dcb206ad 112\func{static void}{Stop}{\void}
eaaa6a06 113
dcb206ad 114If a sound is played, this function stops it.
5a30d450 115