AXGetAdpcmData

Syntax

#include <cafe/ax.h>

s32 AXGetAdpcmData(s16*      input,
                    s32       samples,
                    s32       rate,
                    s32       loop_start,
                    s32       loop_end,
                    u8*       output,
                    DSPADPCM* info,
                    void*     work);

Parameters

input Specifies the 16-bit PCM data to encode in DSP-ADPCM format.
samples Specifies the number of samples to encode. This function outputs DSP-ADPCM data in frames of 8 bytes for every 14 samples. If samples is not a multiple of 14, the final frame is padded with zeros equivalent in amount to the number of missing samples. However, the return value (number of samples encoded) does not include this padding.
rate 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.
loop_start Specifies the starting loop position. Specify the value relative to 0 as the origin. If loop_start is specified using negative numbers, or the loop position is otherwise set inappropriately, the data is encoded as non-looping.
loop_end Specifies the ending loop position. Specify the value relative to 0 as the origin. Leave one or more samples 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 loop_end is specified using negative numbers, or the loop position is otherwise set inappropriately, the data is encoded as non-looping.
output Specifies the location to output DSP-ADPCM data. The AXGetAdpcmOutputSize function can be used to get the size of the region required for the output location. If the region specified as the output location is accessed directly by AX, its address must be 8-byte aligned.
info Specifies the location to output information for the DSP-ADPCM data.
work Specifies the work area that this function uses during encoding. The AXGetAdpcmWorkSize function may be used to get the size of the region required for working memory.

Return Values

Returns the number of samples that were actually encoded (excluding padding).

Description

This function encodes monaural 16-bit (big-endian) PCM data in DSP-ADPCM format so that it can be handled by an audio DSP.

Availability

Library Version Availability
Sound 2.0 Yes
Sound 1.0 Yes

Do Not Call From

None.

See Also

AXGetAdpcmOutputSize
AXGetAdpcmWorkSize

Revision History

2013/05/08 Automated cleanup pass.
2008/12/19 Revised the description of how padding is handled.
2008/02/26 Initial version.


CONFIDENTIAL