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

📄 vc25pro_doc_unawave.html

📁 Voice Commnucation Components for Delphi
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<TITLE>Lake of Soft :: Audio streaming components for Delphi/BDS and C++Builder :: Classes </TITLE>
	<META name="keywords" content="voice,voip,delphi,builder,bcb,audio,tcp,udp,connection,broadcast,record,playback,sample,rate,pcm,compression,codec,mixer,resample,mp3,acm,streaming,conference,wav,vorbis,bass,shoutcast">
	<LINK REL="STYLESHEET" TYPE="text/css" HREF="vc25_doc.css">
</HEAD>

<BODY>

<DIV class="center"><H2>Voice Communicator components version 2.5.2007.04 Pro classes reference</H2></DIV>

<P>Last updated: April 2007

<DIV><P>List of most important units included in <A href="http://lakeofsoft.com/vc/">VC components</A> version 2.5 Pro:
<UL>
	<LI>General purpose units:</LI>
	<UL>
		<LI><A HREF="vc25pro_doc_unaTypes.html#unit_unaTypes">unaTypes.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaUtils.html#unit_unaUtils">unaUtils.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaClasses.html#unit_unaClasses">unaClasses.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaSockets.html#unit_unaSockets">unaSockets.pas</A></LI>
	</UL>
	<LI>MS Wave/ACM/VCL units:</LI>
	<UL>
		<LI><A HREF="vc25pro_doc_unaMsAcmAPI.html#unit_unaMsAcmAPI">unaMsAcmAPI.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaMsAcmClasses.html#unit_unaMsAcmClasses">unaMsAcmClasses.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unavcIDE.html#unit_unavcIDE">unavcIDE.pas</A><BR/></LI>
	</UL>
	<LI>DSP Library units:</LI>
	<UL>
		<LI><A HREF="vc25pro_doc_unaDspDLib.html#unit_unaDspDLib">unaDspDLib.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaDspDLibPipes.html#unit_unaDspDLibPipes">unaDspDLibPipes.pas</A></LI>
	</UL>
	<LI>Additional units:</LI>
	<UL>
		<LI><A HREF="vc25pro_doc_unaWinClasses.html#unit_unaWinClasses">unaWinClasses.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaWave.html#unit_unaWave">unaWave.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaMsMixer.html#unit_unaMsMixer">unaMsMixer.pas</A></LI>
		<LI><A HREF="vc25pro_doc_unaEncoderAPI.html#unit_unaEncoderAPI">unaEncoderAPI.pas</A></LI>
	</UL>
</UL>
</DIV><DIV><P /><HR />
<P /><H3><A NAME="unit_unaWave">Unit <SPAN class="unit">unaWave</SPAN></A>.</H3><P />
  Contains set of routines designed to work with PCM wave data.
<P />Classes:
<UL></UL>
<P />Routines:
<UL>	<LI><A HREF="#routine_waveMix">waveMix()</A>;</LI>
	<LI><A HREF="#routine_waveMix">waveMix()</A>;</LI>
	<LI><A HREF="#routine_waveGetVolume">waveGetVolume()</A>;</LI>
	<LI><A HREF="#routine_waveGetLogVolume">waveGetLogVolume()</A>;</LI>
	<LI><A HREF="#routine_waveExtractChannel">waveExtractChannel()</A>;</LI>
	<LI><A HREF="#routine_waveReplaceChannel">waveReplaceChannel()</A>;</LI>
	<LI><A HREF="#routine_waveReverse">waveReverse()</A>;</LI>
	<LI><A HREF="#routine_waveResample">waveResample()</A>;</LI>
	<LI><A HREF="#routine_waveResample">waveResample()</A>;</LI>
	<LI><A HREF="#routine_waveGetChunkMaxSamplesCount">waveGetChunkMaxSamplesCount()</A>;</LI>
	<LI><A HREF="#routine_waveGetChunkCurSamplesCount">waveGetChunkCurSamplesCount()</A>;</LI>
	<LI><A HREF="#routine_waveReallocateChunk">waveReallocateChunk()</A>;</LI>
	<LI><A HREF="#routine_waveReadFromChunk">waveReadFromChunk()</A>;</LI>
	<LI><A HREF="#routine_waveWriteToChunk">waveWriteToChunk()</A>;</LI>
	<LI><A HREF="#routine_waveFindNextGcd">waveFindNextGcd()</A>;</LI>
	<LI><A HREF="#routine_waveModifyVolume">waveModifyVolume()</A>;</LI>
	<LI><A HREF="#routine_waveModifyVolume">waveModifyVolume()</A>;</LI>
</UL>
<DIV><HR /><P />Unit classes</DIV>
<DIV><HR /><P />Unit routines<DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveMix"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveMix(buf1, buf2, buf3: pointer; samples: unsigned; bits1, bits2, bits3: unsigned; doAdd: bool = true; numChannels: unsigned = 1): unsigned; overload;</SPAN></A><P />
  Mixes buf1 and buf2 and stores the result in buf3 (buf3 could be one of buf1 or buf2).
  <BR />Returns number of samples mixed.

  <BR />bitsN (N = 1, 2 or 3) specifies the number or bits in sample:
  <UL>
     <LI>8 = 1 byte per sample. Every sample contains PCM value in the following format:</LI>
     <TABLE CELLSPACING="0" BORDER="1">
	<TR><TD>Value</TD><TD>PCM value</TD></TR>
	<TR><TD>0x00</TD><TD>-128</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0x7F</TD><TD>-1</TD></TR>
	<TR><TD>0x80</TD><TD>0</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0xFF</TD><TD>+127</TD></TR>
     </TABLE>
     <BR /><BR />
     <LI>16 = 2 bytes per sample. Every sample contains PCM value in the following format:</LI>
     <TABLE CELLSPACING="0" BORDER="1">
	<TR><TD>Value</TD><TD>PCM value</TD></TR>
	<TR><TD>0x0000</TD><TD>0</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0x7FFF</TD><TD>+32767</TD></TR>
	<TR><TD>0x8000</TD><TD>-32768</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0xFFFF</TD><TD>-1</TD></TR>
     </TABLE>
     <BR /><BR />
     <LI>32 = 4 bytes per sample, signed integer. Every sample contains PCM value in the following format:</LI>
     <TABLE CELLSPACING="0" BORDER="1">
	<TR><TD>Value</TD><TD>PCM value</TD></TR>
	<TR><TD>0x00000000</TD><TD>0</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0x7FFFFFFF</TD><TD>+2147483647</TD></TR>
	<TR><TD>0x80000000</TD><TD>-2147483648</TD></TR>
	<TR><TD COLSPAN="2">..</TD></TR>
	<TR><TD>0xFFFFFFFF</TD><TD>-1</TD></TR>
     </TABLE>
     <BR /><BR />
  </UL>
  <BR />Size of buffer #N in bytes = (bitsN * samples * numChannels) shr 3
  <BR />Mixing is done by adding (doAdd is true) or subtracting (doAdd is false) samples with clipping.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveMix"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveMix(const chunk1, chunk2, chunk3: unaPCMChunk; doAdd: bool = true): unsigned; overload;</SPAN></A><P /></TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveGetVolume"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveGetVolume(buf: pointer; samples: unsigned; bits: unsigned; numChannels: unsigned = 1; channel: unsigned = 0; deltaMethod: bool = false): unsigned;</SPAN></A><P />
  Calculates volume. Calculation is done by adding squares of samples and then dividing result on number of samples and applying square root.
  <BR />buf is a pointer to PCM samples
  <BR />samples is a number of samples.
  <BR />bits should have the value as described in waveMix() routine
  <BR />For multi-channel streams specify the channel number you wish to get the power of and total number of channels in the stream.
  <BR />Size of buffer can be calculated as (samples * bits * numChannels) shr 3
  <BR />Resulting value is from 0 (silence) to 32768 (loudest possible sound).
  <BR />Assumption sound has "natural" source is in effect. That means you can get useless results for signals, that are not sound by nature (constant non-zero signal for example).
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveGetLogVolume"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveGetLogVolume(volume: int): unsigned;</SPAN></A><P />
  Returns Logarithmic volume.
  <BR />Input range is from 0 to 32768.
  <BR />Result range is from 0 to 300.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveExtractChannel"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveExtractChannel(buf, dest: pointer; samples: unsigned; bits: unsigned; numChannels: unsigned = 1; channel: unsigned = 0): unsigned;</SPAN></A><P />
  Extracts specified channel from PCM chunk.
  <BR />dest must be large enough to store required data (one channel).
  <BR />channel specifies which channel to extract (0, 1, 2... )
  <BR />Returns number of samples stored in dest buffer.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveReplaceChannel"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveReplaceChannel(buf, source: pointer; samples: unsigned; bits: unsigned; numChannels: unsigned = 1; channel: unsigned = 0): unsigned;</SPAN></A><P />
  Replaces PCM data for specified channel with new one. Old data for this channel will be lost.
  <BR />channel specifies which channel to replace (0, 1, 2... )
  <BR />Returns number of samples stored in dest buffer.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveReverse"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveReverse(buf: pointer; samples: unsigned; bits: unsigned; numChannels: unsigned): unsigned;</SPAN></A><P />
  Reverses PCM samples in wave chunk.
  <BR />bits specifies number of bits in sample.
  <BR />numChannels specifies number of channels in stream.
  <BR />Returns number of samples processed.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveResample"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveResample(bufSrc, bufDst: pointer; samples, numChannelsSrc, numChannelsDst, bitsSrc, bitsDst, rateSrc, rateDst: unsigned): unsigned; overload;</SPAN></A><P />
  Changes PCM stream characteristics.
  <BR />Returns number of bytes produced by the function.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveResample"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveResample(const bufSrc: unaPCMChunk; var bufDst: unaPCMChunk): unsigned; overload;</SPAN></A><P />
  Changes PCM stream characteristics.
  <BR />Returns number of bytes produced by the function.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveGetChunkMaxSamplesCount"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveGetChunkMaxSamplesCount(const chunk: unaPCMChunk): unsigned;</SPAN></A><P />
  Returns number of full samples which can be stored in given PCM chunk.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveGetChunkCurSamplesCount"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveGetChunkCurSamplesCount(const chunk: unaPCMChunk): unsigned;</SPAN></A><P />
  Returns current number of full samples which is stored in given PCM chunk.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveReallocateChunk"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveReallocateChunk(var chunk: unaPCMChunk; numSamples: unsigned = 0): unsigned;</SPAN></A><P />
  Reallocates PCM chunk to hold required number of samples.
  <BR />NOTE: chunk.chunkData must be a valid pointer (or nil) before calling this function.
  <BR />Returns number of bytes allocated.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveReadFromChunk"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveReadFromChunk(var chunk: unaPCMChunk; buf: pointer; size: unsigned; bufOffs: unsigned = 0): unsigned;</SPAN></A><P />
  Reads bytes from PCM chunk.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveWriteToChunk"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveWriteToChunk(var chunk: unaPCMChunk; buf: pointer; size: unsigned; bufOffs: unsigned = 0): unsigned;</SPAN></A><P />
  Writes bytes to PCM chunk.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveFindNextGcd"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveFindNextGcd(rate1, rate2: unsigned; startFrom: unsigned): unsigned;</SPAN></A><P />
  Returns next gcd value.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveModifyVolume"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveModifyVolume(volume: unsigned; buf: pointer; samples: unsigned; bits: unsigned = 1; numChannels: unsigned = 1; channel: int): unsigned; overload;</SPAN></A><P />
<PRE>
  volume:
     100 =  10% original volume
     500 =  50% original volume
    1000 = 100% original volume
    2000 = 200% original volume (two times louder)
      and so on
</PRE>
NOTE: scale is linear, for better results you need to use log scale instead.
</TD></TR></TABLE></DIV><DIV><P /><TABLE BORDER="1" width="100%"><TR><TD><A NAME="routine_waveModifyVolume"><SPAN class="source">function <SPAN class="class">unaWave</SPAN>.waveModifyVolume(volume: unsigned; const chunk: unaPCMChunk; channel: int): unsigned; overload;</SPAN></A><P /></TD></TR></TABLE></DIV></DIV>
</DIV>
<HR><DIV style="text-align: center; font-size: 8pt">&copy; 2000-2007 <A HREF="http://www.lakeofsoft.com/">Lake of Soft, Ltd</A><BR></DIV></BODY></HTML>

⌨️ 快捷键说明

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