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