]>
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 |
dcb206ad VS |
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/}). | |
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 | ||
315ebf68 | 19 | \membersection{wxSound::wxSound}\label{wxsoundconstr} |
eaaa6a06 | 20 | |
315ebf68 | 21 | \func{}{wxSound}{\void} |
eaaa6a06 JS |
22 | |
23 | Default constructor. | |
24 | ||
315ebf68 | 25 | \func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}} |
eaaa6a06 | 26 | |
315ebf68 | 27 | Constructs a wave object from a file or resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to |
eaaa6a06 JS |
28 | determine 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 | |
315ebf68 | 36 | \membersection{wxSound::\destruct{wxSound}} |
eaaa6a06 | 37 | |
315ebf68 | 38 | \func{}{\destruct{wxSound}}{\void} |
eaaa6a06 | 39 | |
315ebf68 | 40 | Destroys 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 | |
46 | Constructs 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 |
62 | Returns \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 | ||
68 | Returns \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 | ||
76 | Plays the sound file. If another sound is playing, it will be interrupted. | |
77 | Returns \true on success, \false otherwise. | |
78 | ||
79 | The possible values for \arg{flags} are: | |
80 | ||
81 | \begin{twocollist} | |
82 | \twocolitem{wxSOUND\_SYNC}{{\tt Play} will block and wait until the sound is | |
83 | replayed.} | |
84 | \twocolitem{wxSOUND\_ASYNC}{Sound is played asynchronously, | |
85 | {\tt Play} returns immediately} | |
86 | \twocolitem{wxSOUND\_ASYNC | wxSOUND\_LOOP}{Sound is played asynchronously | |
87 | and loops until another sound is played, | |
88 | \helpref{wxSound::Stop}{wxsoundstop} is called or the program terminates.} | |
89 | \end{twocollist} | |
90 | ||
91 | The static form is shorthand for this code: | |
92 | \begin{verbatim} | |
93 | wxSound(filename).Play(flags); | |
94 | \end{verbatim} | |
eaaa6a06 | 95 | |
dcb206ad | 96 | \membersection{wxSound::Stop}\label{wxsoundstop} |
eaaa6a06 | 97 | |
dcb206ad | 98 | \func{static void}{Stop}{\void} |
eaaa6a06 | 99 | |
dcb206ad | 100 | If a sound is played, this function stops it. |