src/audio/SDL_wave.c
changeset 8879 f6e4f24df1ac
parent 8831 9326ec96c132
child 8909 a894224dc538
equal deleted inserted replaced
8878:f7ba2119fd91 8879:f6e4f24df1ac
   119 MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
   119 MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
   120 {
   120 {
   121     struct MS_ADPCM_decodestate *state[2];
   121     struct MS_ADPCM_decodestate *state[2];
   122     Uint8 *freeable, *encoded, *decoded;
   122     Uint8 *freeable, *encoded, *decoded;
   123     Sint32 encoded_len, samplesleft;
   123     Sint32 encoded_len, samplesleft;
   124     Sint8 nybble, stereo;
   124     Sint8 nybble;
       
   125     Uint8 stereo;
   125     Sint16 *coeff[2];
   126     Sint16 *coeff[2];
   126     Sint32 new_sample;
   127     Sint32 new_sample;
   127 
   128 
   128     /* Allocate the proper sized output buffer */
   129     /* Allocate the proper sized output buffer */
   129     encoded_len = *audio_len;
   130     encoded_len = *audio_len;
   276     if (state->index > 88) {
   277     if (state->index > 88) {
   277         state->index = 88;
   278         state->index = 88;
   278     } else if (state->index < 0) {
   279     } else if (state->index < 0) {
   279         state->index = 0;
   280         state->index = 0;
   280     }
   281     }
   281     step = step_table[state->index];
   282     /* explicit cast to avoid gcc warning about using 'char' as array index */
       
   283     step = step_table[(int)state->index];
   282     delta = step >> 3;
   284     delta = step >> 3;
   283     if (nybble & 0x04)
   285     if (nybble & 0x04)
   284         delta += step;
   286         delta += step;
   285     if (nybble & 0x02)
   287     if (nybble & 0x02)
   286         delta += (step >> 1);
   288         delta += (step >> 1);