1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 6.5.0.0 for Windows"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>THPAudioDecode</title> 10</head> 11 12<body> 13 14<h1>THPAudioDecode</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/thp.h> 19 20#define THP_AUDIO_INTERLEAVE 0x00 21#define THP_AUDIO_NO_INTERLEAVE 0x01 22#define THP_AUDIO_MONO 0x02 23 24u32 THPAudioDecode(s16 *buffer, u8 *audioFrame, s32 flag); 25</pre></dd></dl> 26 27<h2>Arguments</h2> 28<TABLE class="arguments" border="1" > 29 <tr> 30<th>buffer</th> 31<td>Pointer to a buffer that will store the extracted audio data.</td> 32 </tr> 33 <tr> 34<th>audioFrame</th> 35<td>Pointer to THP audio data.</td> 36 </tr> 37 <tr> 38<th>flag</th> 39<td>Specifies the order of the extracted audio data.</td> 40 </tr> 41</table> 42 43<h2>Return Values</h2> 44<p>Returns the number of decoded stereo samples. (Each left/right channel sample pair increments the count by one.)</p> 45 46<H2>Description</H2> 47<p>The <code>THPAudioDecode</code> function extracts the THP audio data specified as the second argument and outputs it to the buffer specified by the first argument. The format used to output the data is specified by the third argument.</p> 48 49<p>The <code>THPAudioDecode</code> function's output is stereo. If monaural THP audio data is passed to the <code>THPAudioDecode</code> function, it is converted to stereo inside the function. The <code>THPAudioDecode</code> function returns the number of decoded stereo samples in the return value. (Each left/right channel sample pair increments the count by one.)</p> 50 51<p>Specify either <CODE>THP_AUDIO_INTERLEAVE</CODE> or <CODE>THP_AUDIO_NO_INTERLEAVE</CODE> in the third argument (<SPAN class="argument">flag</SPAN>). If <CODE>THP_AUDIO_INTERLEAVE</CODE> is specified, the <code>THPAudioDecode</code> function interleaves the extracted left/right channel data by sample, and then outputs to the specified buffer. The interleave order is "right, left, right, left, etc.", which is based on the Wii's audio interface specifications. If <CODE>THP_AUDIO_NO_INTERLEAVE</CODE> is specified, the <code>THPAudioDecode</code> function groups the extracted left/right channel data by channel, and outputs it to the specified buffer. The output order is "all samples for the right channel, all samples for the left channel".</p> 52 53<p>You can also specify <code>THP_AUDIO_MONO</code> by taking the bitwise <code>OR</code> of <code>THP_AUDIO_INTERLEAVE</code> and <code>THP_AUDIO_NO_INTERLEAVE</code> in the third argument, <SPAN class="argument">flag</SPAN>. If you specify <code>THP_AUDIO_MONO</code>, the <code>THPAudioDecode</code> function will mix the left and right channels of the extracted data and output monaural audio.</p> 54 55<p><B>Note:</B>Even if the specified THP audio data is monaural, the <code>THPAudioDecode</code> function will make the extracted data stereo, regardless of the specification in the third argument. Please prepare an output buffer specified by the first argument of the same size as when the audio data is stereo.</p> 56 57<p><B>Note:</B>The <code>THPAudioDecode</code> function does not use locked cache.</p> 58 59<H2>See Also</H2> 60<p>None.</p> 61 62<H2>Revision History</H2> 63<P> 642008/02/27 Added <code>THP_AUDIO_MONO</code> and modified the <B>Description</B> to include it.<br>2006/03/01 Initial version.<br> 65</P> 66 67<hr><p>CONFIDENTIAL</p></body> 68</html> 69