THPAudioDecode

Syntax

#include <revolution/thp.h>

#define THP_AUDIO_INTERLEAVE    0x00
#define THP_AUDIO_NO_INTERLEAVE 0x01
#define THP_AUDIO_MONO          0x02

u32 THPAudioDecode(s16 *buffer, u8 *audioFrame, s32 flag);

Arguments

buffer Pointer to a buffer that will store the extracted audio data.
audioFrame Pointer to THP audio data.
flag Specifies the order of the extracted audio data.

Return Values

Returns the number of decoded stereo samples. (Each left/right channel sample pair increments the count by one.)

Description

The THPAudioDecode 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.

The THPAudioDecode function's output is stereo. If monaural THP audio data is passed to the THPAudioDecode function, it is converted to stereo inside the function. The THPAudioDecode function returns the number of decoded stereo samples in the return value. (Each left/right channel sample pair increments the count by one.)

Specify either THP_AUDIO_INTERLEAVE or THP_AUDIO_NO_INTERLEAVE in the third argument (flag). If THP_AUDIO_INTERLEAVE is specified, the THPAudioDecode 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 THP_AUDIO_NO_INTERLEAVE is specified, the THPAudioDecode 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".

You can also specify THP_AUDIO_MONO by taking the bitwise OR of THP_AUDIO_INTERLEAVE and THP_AUDIO_NO_INTERLEAVE in the third argument, flag. If you specify THP_AUDIO_MONO, the THPAudioDecode function will mix the left and right channels of the extracted data and output monaural audio.

Note:Even if the specified THP audio data is monaural, the THPAudioDecode 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.

Note:The THPAudioDecode function does not use locked cache.

See Also

None.

Revision History

2008/02/27 Added THP_AUDIO_MONO and modified the Description to include it.
2006/03/01 Initial version.


CONFIDENTIAL