1 \section{\class{wxSound
}}\label{wxsound
}
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/
}).
9 \wxheading{Derived from
}
11 \helpref{wxObject
}{wxobject
}
13 \wxheading{Include files
}
17 \latexignore{\rtfignore{\wxheading{Members
}}}
19 \membersection{wxSound::wxSound
}\label{wxsoundctor
}
21 \func{}{wxSound
}{\void}
25 \func{}{wxSound
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource = false
}}
27 Constructs a wave object from a file or resource. Call
\helpref{wxSound::IsOk
}{wxsoundisok
} to
28 determine whether this succeeded.
30 \wxheading{Parameters
}
32 \docparam{fileName
}{The filename or Windows resource.
}
34 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
36 \membersection{wxSound::
\destruct{wxSound
}}\label{wxsounddtor
}
38 \func{}{\destruct{wxSound
}}{\void}
40 Destroys the wxSound object.
42 \membersection{wxSound::Create
}\label{wxsoundcreate
}
44 \func{bool
}{Create
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource =
\false}}
46 Constructs a wave object from a file or resource.
48 \wxheading{Parameters
}
50 \docparam{fileName
}{The filename or Windows resource.
}
52 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
54 \wxheading{Return value
}
56 \true if the call was successful,
\false otherwise.
58 \membersection{wxSound::IsOk
}\label{wxsoundisok
}
60 \constfunc{bool
}{IsOk
}{\void}
62 Returns
\true if the object contains a successfully loaded file or resource,
\false otherwise.
64 \membersection{wxSound::IsPlaying
}\label{wxsoundisplaying
}
66 \constfunc{static bool
}{IsPlaying
}{\void}
68 Returns
\true if a sound is played at the moment.
70 \membersection{wxSound::Play
}\label{wxsoundplay
}
72 \constfunc{bool
}{Play
}{\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
74 \func{static bool
}{Play
}{\param{const wxString\&
}{filename
},
\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
76 Plays the sound file. If another sound is playing, it will be interrupted.
77 Returns
\true on success,
\false otherwise.
79 The possible values for
\arg{flags
} are:
82 \twocolitem{wxSOUND
\_SYNC}{{\tt Play
} will block and wait until the sound is
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.
}
91 The static form is shorthand for this code:
94 wxSound(filename).Play(flags);
97 \membersection{wxSound::Stop
}\label{wxsoundstop
}
99 \func{static void
}{Stop
}{\void}
101 If a sound is played, this function stops it.