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

📄 classpsoundchannel.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classPSoundChannel.html#z387_0">Directions</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>dir</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>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 class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Open the specified device for playing or recording. The device name is platform specific and is as returned in the GetDevices() function.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the sound device is valid for playing/recording. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>dir</em>&nbsp;</td><td>Name of sound driver/device </td></tr><tr><td valign=top><em>numChannels</em>&nbsp;</td><td>Sound I/O direction </td></tr><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 Number of bits per sample </td></tr></table></dl>    </td>  </tr></table><a name="z393_3" doxytag="PSoundChannel::PlayFile"></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 BOOL PSoundChannel::PlayFile </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="mdname" nowrap>&nbsp; <em>file</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>wait</em> = TRUE</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Play a sound file to the open device. If the wait# parameter is TRUE then the function does not return until the file has been played. If FALSE then the sound play is begun asynchronously and the function returns immediately.<p>Note if the driver is closed of the object destroyed then the sound play is aborted.<p>Also note that not all possible sounds and sound files are playable by this library. No format conversions between sound object and driver are performed.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the sound is playing or has played. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>wait</em>&nbsp;</td><td>Sound file to play. Flag to play sound synchronously. </td></tr></table></dl>    </td>  </tr></table><a name="z393_2" doxytag="PSoundChannel::PlaySound"></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 BOOL PSoundChannel::PlaySound </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPSound.html">PSound</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>sound</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>wait</em> = TRUE</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Play a sound to the open device. If the wait# parameter is TRUE then the function does not return until the file has been played. If FALSE then the sound play is begun asynchronously and the function returns immediately.<p>Note if the driver is closed of the object destroyed then the sound play is aborted.<p>Also note that not all possible sounds and sound files are playable by this library. No format conversions between sound object and driver are performed.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the sound is playing or has played. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>wait</em>&nbsp;</td><td>Sound to play. Flag to play sound synchronously. </td></tr></table></dl>    </td>  </tr></table><a name="z395_0" doxytag="PSoundChannel::Read"></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 BOOL PSoundChannel::Read </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>buf</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>len</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Low level read from the channel. This function may block until the requested number of characters were read or the read timeout was reached. The <a class="el" href="classPSoundChannel.html#z395_1">GetLastReadCount()</a> function returns the actual number of bytes read.<p>The <a class="el" href="classPChannel.html#z55_2">GetErrorCode()</a> function should be consulted after <a class="el" href="classPSoundChannel.html#z395_0">Read()</a> returns FALSE to determine what caused the failure.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE indicates that at least one character was read from the channel. FALSE means no bytes were read due to timeout or some other I/O error. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>len</em>&nbsp;</td><td>Pointer to a block of memory to receive the read bytes. Maximum number of bytes to read into the buffer. </td></tr></table></dl><p>Reimplemented from <a class="el" href="classPChannel.html#z49_2">PChannel</a>.    </td>  </tr></table><a name="z395_3" doxytag="PSoundChannel::RecordFile"></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 BOOL PSoundChannel::RecordFile </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>file</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Record into the platform dependent sound file all of the buffer's of sound data. Use the <a class="el" href="classPSoundChannel.html#z391_5">SetBuffers()</a> function to determine how long the recording will be made.<p>Note that this function will block until all of the data is buffered. If you wish to do this asynchronously, use <a class="el" href="classPSoundChannel.html#z395_4">StartRecording()</a> and AreAllrecordBuffersFull() to determine when you can call <a class="el" href="classPSoundChannel.html#z395_2">RecordSound()</a> without blocking.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the sound has been recorded. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>file</em>&nbsp;</td><td>Sound file recorded </td></tr></table></dl>    </td>  </tr></table><a name="z395_2" doxytag="PSoundChannel::RecordSound"></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 BOOL PSoundChannel::RecordSound </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classPSound.html">PSound</a> &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>sound</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Record into the sound object all of the buffer's of sound data. Use the <a class="el" href="classPSoundChannel.html#z391_5">SetBuffers()</a> function to determine how long the recording will be made.<p>For the Win32 platform, the most efficient way to record a <a class="el" href="classPSound.html">PSound</a> is to use the <a class="el" href="classPSoundChannel.html#z391_5">SetBuffers()</a> function to set a single buffer of the desired size and then do the recording. For Linux OSS this can cause problems as the buffers are rounded up to a power of two, so to gain more accuracy you need a number of smaller buffers.<p>Note that this function will block until all of the data is buffered. If you wish to do this asynchronously, use <a class="el" href="classPSoundChannel.html#z395_4">StartRecording()</a> and AreAllrecordBuffersFull() to determine when you can call <a class="el" href="classPSoundChannel.html#z395_2">RecordSound()</a> without blocking.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the sound has been recorded. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sound</em>&nbsp;</td><td>Sound recorded </td></tr></table></dl>    </td>  </tr></table><a name="z391_5" doxytag="PSoundChannel::SetBuffers"></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 BOOL PSoundChannel::SetBuffers </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>size</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>count</em> = 2</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>

⌨️ 快捷键说明

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