zengine/doc/html/classZE_1_1ZSound.html

506 lines
20 KiB
HTML
Raw Normal View History

2003-04-27 22:15:26 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ZE::ZSound class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3-rc2 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>ZE::ZSound Class Reference</h1><code>#include &lt;<a class="el" href="ZE__ZSound_8h-source.html">ZE_ZSound.h</a>&gt;</code>
<p>
<a href="classZE_1_1ZSound-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="classZE_1_1ZSound.html">ZSound</a> music class, class wraps common features for SDL_Mixer's Mix_Chunk. Inherited from ZObject.
<p>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a0">ZSound</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Default Constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a1">ZSound</a> (string filename)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Constructor that opens a sound effect file.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a2">~ZSound</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Destructor, frees memory.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a3">Open</a> (string filename)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Opens a sound effect file.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a4">Release</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Release sound effect.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a5">Play</a> (int loopNum=0, int fadeTime=0)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Play currently loaded sound effect.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a6">Pause</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Pause sound.</em> <a href="#a6"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a7">Unpause</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Unpause sound.</em> <a href="#a7"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a8">Stop</a> (int fadeTime=0) const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Stop sound.</em> <a href="#a8"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a9">SetVolume</a> (int volume)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Change Volume.</em> <a href="#a9"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a10">IsLoaded</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check if file is loaded.</em> <a href="#a10"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a11">IsPlaying</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check if sound is Playing.</em> <a href="#a11"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a12">IsPaused</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check if sound is Paused.</em> <a href="#a12"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#a13">Volume</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Find Current Volume of Sound Channel.</em> <a href="#a13"></a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Public Attributes</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="p0" doxytag="ZE::ZSound::LoopInfinite"></a>
const int&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#p0">LoopInfinite</a></td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Static Variable For Infinite loop of sound. (Defined as -1).</em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="n0" doxytag="ZE::ZSound::rEngine"></a>
<a class="el" href="classZE_1_1ZEngine.html">ZEngine</a> *&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#n0">rEngine</a></td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Pointer to <a class="el" href="classZE_1_1ZEngine.html">ZEngine</a> Object.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="n1" doxytag="ZE::ZSound::rSound"></a>
Mix_Chunk *&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#n1">rSound</a></td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Pointer to music data.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="n2" doxytag="ZE::ZSound::rChannelID"></a>
int&nbsp;</td><td valign=bottom><a class="el" href="classZE_1_1ZSound.html#n2">rChannelID</a></td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Channel ID Number from SDL_Mixer.</em></font><br><br></td></tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="ZE::ZSound::ZSound"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> ZE::ZSound::ZSound </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Default Constructor, does nothing. </td>
</tr>
</table>
<a name="a1" doxytag="ZE::ZSound::ZSound"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> ZE::ZSound::ZSound </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">string&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em> </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Constructor simply calls <a class="el" href="classZE_1_1ZSound.html#a3">ZSound::Open()</a> with same filename. (WAV,MOD,MID,OGG) <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>filename</em>&nbsp;</td><td>Sound effect to open. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a name="a2" doxytag="ZE::ZSound::~ZSound"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> virtual ZE::ZSound::~ZSound </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Destructor calls <a class="el" href="classZE_1_1ZSound.html#a4">ZSound::Release()</a>. </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a3" doxytag="ZE::ZSound::Open"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Open </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">string&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em> </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Open a music file to be used. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>filename</em>&nbsp;</td><td>Music to open. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a name="a4" doxytag="ZE::ZSound::Release"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Release </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Release memory held by sample data. </td>
</tr>
</table>
<a name="a5" doxytag="ZE::ZSound::Play"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Play </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">int&nbsp;</td>
<td class="mdname" nowrap>&nbsp; <em>loopNum</em> = 0, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>int&nbsp;</td>
<td class="mdname" nowrap>&nbsp; <em>fadeTime</em> = 0</td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Play sound effect, looping loopNum times. (use <a class="el" href="classZE_1_1ZSound.html#p0">ZSound::LoopInfinite</a> to loop forever.) If fade is not zero (which it defaults to) music will fade in over specified number of milliseconds. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>loopNum</em>&nbsp;</td><td>Number of times to loop song, defaults to zero. </td></tr>
<tr><td valign=top><em>fadeTime</em>&nbsp;</td><td>Milliseconds to fade to full volume, defaults to zero for no fade. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a name="a6" doxytag="ZE::ZSound::Pause"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Pause </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Pause currently playing sound. </td>
</tr>
</table>
<a name="a7" doxytag="ZE::ZSound::Unpause"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Unpause </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Unpause currently playing sound. </td>
</tr>
</table>
<a name="a8" doxytag="ZE::ZSound::Stop"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::Stop </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">int&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; <em>fadeTime</em> = 0 </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Stop currently playing sound, if fadeTime is not zero, fade out over specified time. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>fadeTime</em>&nbsp;</td><td>Milliseconds to fade out over, defaults to zero for immediate stop. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a name="a9" doxytag="ZE::ZSound::SetVolume"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void ZE::ZSound::SetVolume </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">int&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; <em>volume</em> </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Change volume of currently playing sample. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>volume</em>&nbsp;</td><td>Volume to change to, can be in a range from 0 to 128. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a name="a10" doxytag="ZE::ZSound::IsLoaded"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool ZE::ZSound::IsLoaded </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if file is loaded and pointer to data is non-NULL. <dl compact><dt><b>Returns:</b></dt><dd>Loaded or Unloaded state of data. </dd></dl>
</td>
</tr>
</table>
<a name="a11" doxytag="ZE::ZSound::IsPlaying"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool ZE::ZSound::IsPlaying </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if sound is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused) <dl compact><dt><b>Returns:</b></dt><dd>Playing / Not Playing State of sound. </dd></dl>
</td>
</tr>
</table>
<a name="a12" doxytag="ZE::ZSound::IsPaused"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool ZE::ZSound::IsPaused </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if sound is "playing" but currently paused. <dl compact><dt><b>Returns:</b></dt><dd>Paused / Not Paused State of Sound. </dd></dl>
</td>
</tr>
</table>
<a name="a13" doxytag="ZE::ZSound::Volume"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int ZE::ZSound::Volume </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap>&nbsp; </td>
<td class="md" valign="top">)&nbsp;</td>
<td class="md" nowrap> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get current volume of sound channel represented as a value from 0-128. <dl compact><dt><b>Returns:</b></dt><dd>Volume of sound channel, 0-128. </dd></dl>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li>/include/<a class="el" href="ZE__ZSound_8h-source.html">ZE_ZSound.h</a></ul>
2003-04-28 02:36:07 +00:00
<hr><address style="align: right;"><small>Generated on Sun Apr 27 22:34:35 2003 for ZEngine by
2003-04-27 22:15:26 +00:00
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.3-rc2 </small></address>
</body>
</html>