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
}
19 \helpref{wxAdv
}{librarieslist
}
21 \latexignore{\rtfignore{\wxheading{Members
}}}
24 \membersection{wxSound::wxSound
}\label{wxsoundctor
}
26 \func{}{wxSound
}{\void}
30 \func{}{wxSound
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource = false
}}
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
36 \wxheading{Parameters
}
38 \docparam{fileName
}{The filename or Windows resource.
}
40 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
43 \membersection{wxSound::
\destruct{wxSound
}}\label{wxsounddtor
}
45 \func{}{\destruct{wxSound
}}{\void}
47 Destroys the wxSound object.
50 \membersection{wxSound::Create
}\label{wxsoundcreate
}
52 \func{bool
}{Create
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource =
\false}}
54 Constructs a wave object from a file or resource.
56 \wxheading{Parameters
}
58 \docparam{fileName
}{The filename or Windows resource.
}
60 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
62 \wxheading{Return value
}
64 \true if the call was successful,
\false otherwise.
67 \membersection{wxSound::IsOk
}\label{wxsoundisok
}
69 \constfunc{bool
}{IsOk
}{\void}
71 Returns
\true if the object contains a successfully loaded file or resource,
\false otherwise.
74 \membersection{wxSound::IsPlaying
}\label{wxsoundisplaying
}
76 \constfunc{static bool
}{IsPlaying
}{\void}
78 Returns
\true if a sound is played at the moment.
80 This method is currently not implemented under Windows.
83 \membersection{wxSound::Play
}\label{wxsoundplay
}
85 \constfunc{bool
}{Play
}{\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
87 \func{static bool
}{Play
}{\param{const wxString\&
}{filename
},
\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
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.
95 The possible values for
\arg{flags
} are:
98 \twocolitem{wxSOUND
\_SYNC}{{\tt Play
} will block and wait until the sound is
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.
}
107 The static form is shorthand for this code:
110 wxSound(filename).Play(flags);
114 \membersection{wxSound::Stop
}\label{wxsoundstop
}
116 \func{static void
}{Stop
}{\void}
118 If a sound is played, this function stops it.