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
}}}
20 \membersection{wxSound::wxSound
}\label{wxsoundctor
}
22 \func{}{wxSound
}{\void}
26 \func{}{wxSound
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource = false
}}
28 Constructs a wave object from a file or, under Windows, from a Windows
29 resource. Call
\helpref{wxSound::IsOk
}{wxsoundisok
} to determine whether this
32 \wxheading{Parameters
}
34 \docparam{fileName
}{The filename or Windows resource.
}
36 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
39 \membersection{wxSound::
\destruct{wxSound
}}\label{wxsounddtor
}
41 \func{}{\destruct{wxSound
}}{\void}
43 Destroys the wxSound object.
46 \membersection{wxSound::Create
}\label{wxsoundcreate
}
48 \func{bool
}{Create
}{\param{const wxString\&
}{ fileName
},
\param{bool
}{ isResource =
\false}}
50 Constructs a wave object from a file or resource.
52 \wxheading{Parameters
}
54 \docparam{fileName
}{The filename or Windows resource.
}
56 \docparam{isResource
}{\true if
{\it fileName
} is a resource,
\false if it is a filename.
}
58 \wxheading{Return value
}
60 \true if the call was successful,
\false otherwise.
63 \membersection{wxSound::IsOk
}\label{wxsoundisok
}
65 \constfunc{bool
}{IsOk
}{\void}
67 Returns
\true if the object contains a successfully loaded file or resource,
\false otherwise.
70 \membersection{wxSound::IsPlaying
}\label{wxsoundisplaying
}
72 \constfunc{static bool
}{IsPlaying
}{\void}
74 Returns
\true if a sound is played at the moment.
76 This method is currently not implemented under Windows.
79 \membersection{wxSound::Play
}\label{wxsoundplay
}
81 \constfunc{bool
}{Play
}{\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
83 \func{static bool
}{Play
}{\param{const wxString\&
}{filename
},
\param{unsigned
}{ flags = wxSOUND
\_ASYNC}}
85 Plays the sound file. If another sound is playing, it will be interrupted.
86 Returns
\true on success,
\false otherwise. Note that in general it is possible
87 to delete the object which is being asynchronously played any time after
88 calling this function and the sound would continue playing, however this
89 currently doesn't work under Windows for sound objects loaded from memory data.
91 The possible values for
\arg{flags
} are:
94 \twocolitem{wxSOUND
\_SYNC}{{\tt Play
} will block and wait until the sound is
96 \twocolitem{wxSOUND
\_ASYNC}{Sound is played asynchronously,
97 {\tt Play
} returns immediately
}
98 \twocolitem{wxSOUND
\_ASYNC | wxSOUND
\_LOOP}{Sound is played asynchronously
99 and loops until another sound is played,
100 \helpref{wxSound::Stop
}{wxsoundstop
} is called or the program terminates.
}
103 The static form is shorthand for this code:
106 wxSound(filename).Play(flags);
110 \membersection{wxSound::Stop
}\label{wxsoundstop
}
112 \func{static void
}{Stop
}{\void}
114 If a sound is played, this function stops it.