wavestream.c
changeset 718 fb0562cc1559
parent 711 f40c5ac95b12
child 725 bdf7b8d20566
equal deleted inserted replaced
717:27eb690edafc 718:fb0562cc1559
   239         if ((music->cvt.src_format & 0x0010) && (original_len & 1)) {
   239         if ((music->cvt.src_format & 0x0010) && (original_len & 1)) {
   240             original_len--;
   240             original_len--;
   241         }
   241         }
   242         music->cvt.len = original_len;
   242         music->cvt.len = original_len;
   243         SDL_ConvertAudio(&music->cvt);
   243         SDL_ConvertAudio(&music->cvt);
   244         SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume);
   244         SDL_MixAudioFormat(stream, music->cvt.buf, mixer.format,music->cvt.len_cvt, wavestream_volume);
   245         consumed = music->cvt.len_cvt;
   245         consumed = music->cvt.len_cvt;
   246     } else {
   246     } else {
   247         Uint8 *data;
   247         Uint8 *data;
   248         if ((stop - pos) < len) {
   248         if ((stop - pos) < len) {
   249             len = (int)(stop - pos);
   249             len = (int)(stop - pos);
   250         }
   250         }
   251         data = SDL_stack_alloc(Uint8, len);
   251         data = SDL_stack_alloc(Uint8, len);
   252         if (data) {
   252         if (data) {
   253             len = SDL_RWread(music->src, data, 1, len);
   253             len = SDL_RWread(music->src, data, 1, len);
   254             SDL_MixAudio(stream, data, len, wavestream_volume);
   254             SDL_MixAudioFormat(stream, data, mixer.format, len, wavestream_volume);
   255             SDL_stack_free(data);
   255             SDL_stack_free(data);
   256         }
   256         }
   257         consumed = len;
   257         consumed = len;
   258     }
   258     }
   259 
   259