AXGetMultiVoiceReformatBufferSize

Syntax

#include <cafe.h>
#include <cafe/ax.h>

AXPB_ERROR_CODE AXGetMultiVoiceReformatBufferSize (u32 format, u32 num_chans,
                                                   u32 num_bytes, u32 *size);

Parameters

format The encoded data format. One of AX_PB_FORMAT_ADPCM, AX_PB_FORMAT_PCM8, or AX_PB_FORMAT_PCM16
num_chans Number of channels encoded.
num_bytes Size in bytes of one channel of the source data.
size Receives the size of the work buffer needed by AX for the life of the MultiVoice.

Return Values

AXPB_ERROR_NONE if success. AXPB_ERROR_MULTI_VOICE_INVALID_FORMAT if error.

Description

This calculates the bytes required to process num_bytes of samples internally depending on the format data. AX_PB_FORMAT_PCM8 formatted samples is handled internally in 16 bits so requires twice the num_bytes count. AX_PB_FORMAT_PCM16 uses as many bytes as samples. AX_PB_FORMAT_ADPCM also uses as many bytes as samples given but also must extend to 8-byte alignment. This function can be used to calculate the internal buffer size requirements given the format, channel count, and source byte count.

For basic use, where the entire source is to kept in main RAM, num_bytes would be the size of the file image (excluding the header size). For streaming it may be the block size the user will fetch from the file or file image in RAM as needed. The latter case effectively distributes the cost of managing the reformatting over the play time of the MultiVoice

Availability

Library Version Availability
Sound 2.0 Yes
Sound 1.0 No

Do Not Call From

None.

See Also

AXSetMultiVoiceOffsets

Revision History

2013/10/20 Initial Version


CONFIDENTIAL