]>
Commit | Line | Data |
---|---|---|
315ebf68 | 1 | \section{\class{wxSound}}\label{wxsound} |
eaaa6a06 | 2 | |
dcb206ad | 3 | This class represents a short sound (loaded from Windows WAV file), that |
b2cf617c | 4 | can be stored in memory and played. Currently this class is implemented |
5a30d450 JS |
5 | on 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 | |
28 | Default constructor. | |
29 | ||
315ebf68 | 30 | \func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}} |
eaaa6a06 | 31 | |
b1e0f4ed VZ |
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. | |
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 | 47 | Destroys 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 | |
54 | Constructs 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 |
71 | Returns \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 | ||
78 | Returns \true if a sound is played at the moment. | |
eaaa6a06 | 79 | |
b1e0f4ed VZ |
80 | This 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 | ||
89 | Plays the sound file. If another sound is playing, it will be interrupted. | |
b1e0f4ed VZ |
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. | |
dcb206ad VS |
94 | |
95 | The 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 |
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.} | |
dcb206ad VS |
105 | \end{twocollist} |
106 | ||
107 | The static form is shorthand for this code: | |
d2c2afc9 | 108 | |
dcb206ad VS |
109 | \begin{verbatim} |
110 | wxSound(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 | 118 | If a sound is played, this function stops it. |
5a30d450 | 119 |