typedef struct _AXPBADPCM
{
u16 a[8][2]; // Decode coefficient table
u16 gain; // Gain (Specify 0 for ADPCM; 0x0800 for PCM16; 0x0100 for PCM8)
u16 pred_scale; // Predictor and scale
u16 yn1; // Log data (y[n - 1])
u16 yn2; // Log data (y[n - 2])
} AXPBADPCM;
Sets parameters (context) to the AXPBADPCM structure so the ADPCM hardware decoder operates properly.
The AX uses the ADPCM hardware decoder not only for ADPCM data but also for 16-bit PCM and 8-bit PCM data. When playing these data types, therefore, you must appropriately configure the AXPBADPCM structure.
In the case of ADPCM data, for the a[ ][ ] data coefficient table specify the coef[] coefficient that is described in the DSPADPCM tool's output data header (the DSPADPCM structure). The correspondence between the AXPBADPCM structure's a[ ][ ] and the header's coef[] is shown below.
DSPADPCM *ps = (DSPADPCM*) (Pointer to ADPCM data) AXPBADPCM adpcm; adpcm.a[0][0] = ps->coef[0]; adpcm.a[0][1] = ps->coef[1]; adpcm.a[1][0] = ps->coef[2]; adpcm.a[1][1] = ps->coef[3]; adpcm.a[2][0] = ps->coef[4]; adpcm.a[2][1] = ps->coef[5]; adpcm.a[3][0] = ps->coef[6]; adpcm.a[3][1] = ps->coef[7]; adpcm.a[4][0] = ps->coef[8]; adpcm.a[4][1] = ps->coef[9]; adpcm.a[5][0] = ps->coef[10]; adpcm.a[5][1] = ps->coef[11]; adpcm.a[6][0] = ps->coef[12]; adpcm.a[6][1] = ps->coef[13]; adpcm.a[7][0] = ps->coef[14]; adpcm.a[7][1] = ps->coef[15];
For gain, specify one of the following values, based on the data type.
| ADPCM | 0x0000 |
| 16-bit PCM (PCM16) | 0x0800 |
| 8-bit PCM (PCM8) | 0x0100 |
In the case of ADPCM data, for the pred_scale predictor and scale and the yn1 and yn2 log data, specify the values for ps, yn1 and yn2 described in the DSPADPCM tool's output data header (the DSPADPCM structure).
DSPADPCM *ps = (DSPADPCM*) (Pointer to ADPCM data) AXPBADPCM adpcm; adpcm.pred_scale = ps->ps; adpcm.yn1 = ps->yn1; adpcm.yn2 = ps->yn2;
For more information about the DSPADPCM structure, see DSPADPCM.pdf in the DSPADPCM tools.
In the case of 16-bit PCM or 8-bit PCM data, you must specify 0 for all parameters other than gain.
Note: The parameters for the voice parameter block are set per the values in the AXPBADPCM structure, but once the voice moves to the running state, the AX library automatically updates the parameters as ADPCM hardware decoder context. Also, when the data is looped ADPCM data, each time the loop occurs the AX library automatically overwrites this context with the loop context, axvpb.pb.adpcmLoop(the AXPBADPCMLOOP structure). The parameters inside this voice parameter block cannot be changed while voices are playing.
If you have changed any members of axvpb.pb.adpcm (AXPBADPCM structure), set the AX_SYNC_USER_ADPCM bit in the axvpb.sync member.
axvpb.sync
axvpb.pb.adpcmLoop
AXSetVoiceAdpcm
2009/05/11 Revised Description.
2006/03/01 Initial version.
CONFIDENTIAL