encode

Syntax

#include "dsptool.h"

typedef struct
{

    	// start context
    	s16 coef[16];
    	u16 gain;
    	u16 pred_scale;
    	s16 yn1;
    	s16 yn2;

    	// loop context
    	u16 loop_pred_scale;
    	s16 loop_yn1;
    	s16 loop_yn2;

} ADPCMINFO; 

void encode(
	s16         *src,   // location of source samples (16-bit PCM signed little-endian)
	u8          *dst,   // location of destination buffer
	ADPCMINFO   *cxt,   // location of adpcm info
	u32         samples // number of samples to encode         
);

Parameters

src This is a pointer to a buffer containing a signed, little-endian, 16-bit PCM sample.
dst This is a pointer to a buffer which will contain the DSP-ADPCM encoded output.
NOTE:
Your application must allocate storage for this buffer. The size of this buffer must be calculated with getBytesForAdpcmBuffer.
cxt Pointer to a structure of type ADPCMINFO. The encode function will store the sample’s coefficients and context information in this structure.
NOTE:
Several of the parameters (gain, yn1, and yn2) will always be zero. These parameters are included in the structure to emphasize the fact that the corresponding registers in the DSP decoder hardware must be cleared before starting the decode process. Refer to the Audio Library (AX) section in this guide for more information.
Consider also that the loop context parameters will always be zero after calling encode. To set these values, call getLoopContext if the sample is looped.
samples Number of samples to encode.

Return Values

None.

Description

encode will compress a 16-bit PCM sample into the DSP-ADPCM format.

Do Not Call From

Wii U (Host PC only) Do not call this function on the Wii U console. It is available only on the host PC.

Revision History

2013/05/08 Automated cleanup pass.
2011/02/21 Initial version.


CONFIDENTIAL