⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classpsound.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>PSound class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><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="hierarchy.html">Class Hierarchy</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="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>PSound Class Reference</h1><code>#include &lt;<a class="el" href="sound_8h-source.html">sound.h</a>&gt;</code><p><p>Inheritance diagram for PSound:<p><center><img src="classPSound.png" usemap="#PSound_map" border="0" alt=""></center><map name="PSound_map"><area href="classPBYTEArray.html" alt="PBYTEArray" shape="rect" coords="0,0,85,24"></map><a href="classPSound-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Construction</div></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z379_0">PSound</a> (unsigned <a class="el" href="classPSound.html#n1">numChannels</a>=1, unsigned <a class="el" href="classPSound.html#n2">sampleRate</a>=8000, unsigned bitsPerSample=16, PINDEX bufferSize=0, const BYTE *data=NULL)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z379_1">PSound</a> (const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;filename)</td></tr><tr><td nowrap align=right valign=top>PSound &amp;&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z379_2">operator=</a> (const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &amp;data)</td></tr><tr><td colspan="2"><div class="groupHeader">File functions</div></td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z381_0">Load</a> (const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;filename)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z381_1">Save</a> (const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;filename)</td></tr><tr><td colspan="2"><div class="groupHeader">Access functions</div></td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_0">Play</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Play the sound on the default sound device.</em> <a href="#z383_0"></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="classPSound.html#z383_1">SetFormat</a> (unsigned <a class="el" href="classPSound.html#n1">numChannels</a>, unsigned <a class="el" href="classPSound.html#n2">sampleRate</a>, unsigned bitsPerSample)</td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_2">GetEncoding</a> () const</td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_3">GetChannels</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the number of channels (mono/stereo) in the sound.</em> <a href="#z383_3"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_4">GetSampleRate</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the sample rate in samples per second.</em> <a href="#z383_4"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_5">GetSampleSize</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the sample size in bits per sample.</em> <a href="#z383_5"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>DWORD&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_6">GetErrorCode</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the platform dependent error code from the last file load.</em> <a href="#z383_6"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>PINDEX&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_7">GetFormatInfoSize</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the size of the platform dependent format info.</em> <a href="#z383_7"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>const void *&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z383_8">GetFormatInfoData</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get pointer to the platform dependent format info.</em> <a href="#z383_8"></a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Static Public Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Miscellaneous functions</div></td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z385_0">PlayFile</a> (const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;file, BOOL wait=TRUE)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#z385_1">Beep</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Play the "standard" warning beep for the platform.</em> <a href="#z385_1"></a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n0">encoding</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Format code.</em> <a href="#n0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n1">numChannels</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Number of channels eg mono/stereo.</em> <a href="#n1"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n2">sampleRate</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Samples per second.</em> <a href="#n2"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>unsigned&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n3">sampleSize</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Number of bits per sample.</em> <a href="#n3"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>DWORD&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n4">dwLastError</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Last error code for <a class="el" href="classPSound.html#z381_0">Load()</a>/<a class="el" href="classPSound.html#z381_1">Save()</a> functions.</em> <a href="#n4"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPBYTEArray.html">PBYTEArray</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSound.html#n5">formatInfo</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Full info on the format (platform dependent).</em> <a href="#n5"></a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>A class representing a sound. A sound is a highly platform dependent entity that is abstracted for use here. Very little manipulation of the sounds are possible.<p>The most common sound to use is the static function <a class="el" href="classPSound.html#z385_1">Beep()</a># which emits the system standard "warning" or "attention" sound. <p><hr><h2>Constructor &amp; Destructor Documentation</h2><a name="z379_0" doxytag="PSound::PSound"></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"> PSound::PSound </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">unsigned&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>numChannels</em> = 1, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>unsigned&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>sampleRate</em> = 8000, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>unsigned&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>bitsPerSample</em> = 16, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>bufferSize</em> = 0, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>const BYTE *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>data</em> = NULL</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>Create a new sound, using the parameters provided. It is expected that the "lowest common denominator" encoding, linear PCM, is used.<p>All other values for the encoding are platform dependent. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sampleRate</em>&nbsp;</td><td>Number of channels eg mono/stereo </td></tr><tr><td valign=top><em>bitsPerSample</em>&nbsp;</td><td>Samples per second </td></tr><tr><td valign=top><em>bufferSize</em>&nbsp;</td><td>Number of bits per sample </td></tr><tr><td valign=top><em>data</em>&nbsp;</td><td>Size of data Pointer to initial data </td></tr></table></dl>    </td>  </tr></table><a name="z379_1" doxytag="PSound::PSound"></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"> PSound::PSound </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;&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>Create a new sound, reading from a platform dependent file. <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 file to load. </td></tr></table></dl>    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="z385_1" doxytag="PSound::Beep"></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 PSound::Beep </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> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Play the "standard" warning beep for the platform.<p>    </td>  </tr></table><a name="z383_3" doxytag="PSound::GetChannels"></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"> unsigned PSound::GetChannels </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the number of channels (mono/stereo) in the sound.<p>    </td>  </tr></table><a name="z383_2" doxytag="PSound::GetEncoding"></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"> unsigned PSound::GetEncoding </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the current encoding. A value of 0 indicates linear PCM, any other value is platform dependent.     </td>  </tr></table><a name="z383_6" doxytag="PSound::GetErrorCode"></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"> DWORD PSound::GetErrorCode </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the platform dependent error code from the last file load.<p>    </td>  </tr></table><a name="z383_8" doxytag="PSound::GetFormatInfoData"></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"> const void* PSound::GetFormatInfoData </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get pointer to the platform dependent format info.<p>    </td>  </tr></table><a name="z383_7" doxytag="PSound::GetFormatInfoSize"></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"> PINDEX PSound::GetFormatInfoSize </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the size of the platform dependent format info.<p>    </td>  </tr></table><a name="z383_4" doxytag="PSound::GetSampleRate"></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"> unsigned PSound::GetSampleRate </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<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the sample rate in samples per second.<p>    </td>  </tr></table><a name="z383_5" doxytag="PSound::GetSampleSize"></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"> unsigned PSound::GetSampleSize </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<code> [inline]</code></td>        </tr>      </table>    </td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -