2004-02-02 08:42:04 -05:00
|
|
|
\section{\class{wxSound}}\label{wxsound}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
This class represents a short sound (loaded from Windows WAV file), that
|
2000-03-17 12:59:56 -05:00
|
|
|
can be stored in memory and played. Currently this class is implemented
|
2004-02-08 17:01:36 -05:00
|
|
|
on Windows and Unix (and uses either
|
|
|
|
\urlref{Open Sound System}{http://www.opensound.com/oss.html} or
|
2004-02-02 09:35:56 -05:00
|
|
|
\urlref{Simple DirectMedia Layer}{http://www.libsdl.org/}).
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
<wx/sound.h>
|
1999-02-15 15:41:29 -05:00
|
|
|
|
1998-06-14 08:11:50 -04:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-09-24 06:57:56 -04:00
|
|
|
\membersection{wxSound::wxSound}\label{wxsoundctor}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\func{}{wxSound}{\void}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
Constructs a wave object from a file or, under Windows, from a Windows
|
|
|
|
resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to determine whether this
|
|
|
|
succeeded.
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{fileName}{The filename or Windows resource.}
|
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-09-24 06:57:56 -04:00
|
|
|
\membersection{wxSound::\destruct{wxSound}}\label{wxsounddtor}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\func{}{\destruct{wxSound}}{\void}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
Destroys the wxSound object.
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\membersection{wxSound::Create}\label{wxsoundcreate}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\func{bool}{Create}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = \false}}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
Constructs a wave object from a file or resource.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{fileName}{The filename or Windows resource.}
|
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\docparam{isResource}{\true if {\it fileName} is a resource, \false if it is a filename.}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\true if the call was successful, \false otherwise.
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\membersection{wxSound::IsOk}\label{wxsoundisok}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
\constfunc{bool}{IsOk}{\void}
|
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
Returns \true if the object contains a successfully loaded file or resource, \false otherwise.
|
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\membersection{wxSound::IsPlaying}\label{wxsoundisplaying}
|
|
|
|
|
|
|
|
\constfunc{static bool}{IsPlaying}{\void}
|
|
|
|
|
|
|
|
Returns \true if a sound is played at the moment.
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
This method is currently not implemented under Windows.
|
|
|
|
|
|
|
|
|
2004-02-02 08:42:04 -05:00
|
|
|
\membersection{wxSound::Play}\label{wxsoundplay}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\constfunc{bool}{Play}{\param{unsigned }{ flags = wxSOUND\_ASYNC}}
|
|
|
|
|
|
|
|
\func{static bool}{Play}{\param{const wxString\& }{filename}, \param{unsigned}{ flags = wxSOUND\_ASYNC}}
|
|
|
|
|
|
|
|
Plays the sound file. If another sound is playing, it will be interrupted.
|
2005-07-29 10:06:27 -04:00
|
|
|
Returns \true on success, \false otherwise. Note that in general it is possible
|
|
|
|
to delete the object which is being asynchronously played any time after
|
|
|
|
calling this function and the sound would continue playing, however this
|
|
|
|
currently doesn't work under Windows for sound objects loaded from memory data.
|
2004-02-02 09:35:56 -05:00
|
|
|
|
|
|
|
The possible values for \arg{flags} are:
|
|
|
|
|
|
|
|
\begin{twocollist}
|
2004-02-08 17:01:36 -05:00
|
|
|
\twocolitem{wxSOUND\_SYNC}{{\tt Play} will block and wait until the sound is
|
|
|
|
replayed.}
|
|
|
|
\twocolitem{wxSOUND\_ASYNC}{Sound is played asynchronously,
|
|
|
|
{\tt Play} returns immediately}
|
|
|
|
\twocolitem{wxSOUND\_ASYNC | wxSOUND\_LOOP}{Sound is played asynchronously
|
|
|
|
and loops until another sound is played,
|
|
|
|
\helpref{wxSound::Stop}{wxsoundstop} is called or the program terminates.}
|
2004-02-02 09:35:56 -05:00
|
|
|
\end{twocollist}
|
|
|
|
|
|
|
|
The static form is shorthand for this code:
|
2004-02-21 20:16:32 -05:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\begin{verbatim}
|
|
|
|
wxSound(filename).Play(flags);
|
|
|
|
\end{verbatim}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2005-07-29 10:06:27 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\membersection{wxSound::Stop}\label{wxsoundstop}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
\func{static void}{Stop}{\void}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2004-02-02 09:35:56 -05:00
|
|
|
If a sound is played, this function stops it.
|
2004-02-08 17:01:36 -05:00
|
|
|
|