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