1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<title>AXGetAdpcmData</title> 6<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 7<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 8<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 9<META http-equiv="Content-Style-Type" content="text/css"> 10</head> 11 12<body> 13 14<h1 align="left">AXGetAdpcmData</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction">#include <revolution/ax.h> 18 19s32 AXGetAdpcmData(s16* input, 20 s32 samples, 21 s32 rate, 22 s32 loop_start, 23 s32 loop_end, 24 u8* output, 25 DSPADPCM* info, 26 void* work); 27</pre></dd></dl> 28 29<h2>Arguments</h2> 30 31<table class="arguments" border="1" > 32 <tr> 33 <th>input</th> 34 <td>Pointer to 16-bit PCM data to encode in DSP-ADPCM format.</td> 35 </tr> 36 <tr> 37 <th>samples</th> 38 <td>Number of 16-bit PCM data samples to encode.</td> 39 </tr> 40 <tr> 41 <th>rate</th> 42 <td>Sampling frequency of the 16-bit PCM data to encode.</td> 43 </tr> 44 <tr> 45 <th>loop_start</th> 46 <td>Specifies the loop's starting sample (0 is the origin).</td> 47 </tr> 48 <tr> 49 <th>loop_end</th> 50 <td>Specifies the loop's ending sample (0 is the origin).</td> 51 </tr> 52 <tr> 53 <th>output</th> 54 <td>Pointer to the location to output the DSP-ADPCM data.</td> 55 </tr> 56 <tr> 57 <th>info</th> 58 <td>Pointer to the location where information is stored for the DSP-ADPCM data.</td> 59 </tr> 60 <tr> 61 <th>work</th> 62 <td>Pointer to the work region to use while encoding.</td> 63 </tr> 64</table> 65 66<h2>Return Values</h2> 67 68<p>Returns the number of samples that were actually encoded.</p> 69 70<h2>Description</h2> 71 72<p>This function encodes monaural 16-bit (big-endian) PCM data in DSP-ADPCM format so that it can be handled by an audio DSP.</p> 73 74<p>The second argument, <SPAN class="argument">samples</SPAN>, specifies the number of samples to encode. This function outputs DSP-ADPCM data in frames of 8 bytes for every 14 samples. If <SPAN class="argument">samples</SPAN> is not a multiple of 14, therefore, the last frame will be encoded after an equivalent number of <code>0</code>'s have been added for its unused samples. The return value is the number of samples that were actually encoded and includes this added data.</p> 75 76<p>The third argument, <SPAN class="argument">rate</SPAN>, specifies the sampling frequency of the PCM data. This function does not perform any sort of resampling, so the DSP-ADPCM data will be output with the same sampling frequency.</p> 77 78<p>The fourth and fifth arguments, <SPAN class="argument">loop_start</SPAN> and <SPAN class="argument">loop_end</SPAN>, specify the starting and ending loop positions. Specify each value relative to 0 as the origin. Leave one sample or more between the start of the loop and the end, and always set the end of the loop to a larger value than the start of the loop. If <SPAN class="argument">loop_start</SPAN> or <SPAN class="argument">loop_end</SPAN> are specified using negative numbers, or the loop positions are otherwise set inappropriately, the data will be encoded as non-looping.</p> 79 80<p>The sixth argument, <SPAN class="argument">output</SPAN>, specifies the location to output DSP-ADPCM data. The <code>AXGetAdpcmOutputSize</code> function can be used to get the size of the region required for the output location. If the region specified here as the output location is accessed directly by AX, its address must be 8-byte aligned.</p> 81 82<p>The seventh argument, <SPAN class="argument">info</SPAN>, specifies the location to output information on the DSP-ADPCM data.</p> 83 84<p>The work area that this function uses during encoding is specified in the eighth argument, <SPAN class="argument">work</SPAN>. The <code>AXGetAdpcmWorkSize</code> function can be used to get the size of the region required for working memory.</p> 85 86<h2>See Also</h2> 87 88<p class="reference"> 89<a href="AXGetAdpcmOutputSize.html">AXGetAdpcmOutputSize</a>, 90<a href="AXGetAdpcmWorkSize.html">AXGetAdpcmWorkSize</a> 91</p> 92 93<H2>Revision History</H2> 94 95<p> 962008/02/26 Initial version. 97</p> 98 99<hr><p>CONFIDENTIAL</p></body> 100</html>