# HG changeset patch # User Patrice Mandin # Date 1106992720 0 # Node ID 2eca15c3f609e80c156b3fe86ee05af546658ebf # Parent aebfa3ce2a53271949d543c48a428f0f6e7afacb clear convert.buf before filling it diff -r aebfa3ce2a53 -r 2eca15c3f609 src/audio/mint/SDL_mintaudio.c --- a/src/audio/mint/SDL_mintaudio.c Tue Jan 25 17:58:44 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio.c Sat Jan 29 09:58:40 2005 +0000 @@ -49,19 +49,29 @@ void SDL_MintAudio_Callback(void) { Uint8 *buffer; + SDL_AudioDevice *audio = SDL_MintAudio_device; buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; - memset(buffer, SDL_MintAudio_device->spec.silence, SDL_MintAudio_device->spec.size); + memset(buffer, audio->spec.silence, audio->spec.size); + + if (audio->paused) + return; + + if (audio->convert.needed) { + int silence; - if ( ! SDL_MintAudio_device->paused ) { - if ( SDL_MintAudio_device->convert.needed ) { - SDL_MintAudio_device->spec.callback(SDL_MintAudio_device->spec.userdata, - (Uint8 *)SDL_MintAudio_device->convert.buf,SDL_MintAudio_device->convert.len); - SDL_ConvertAudio(&SDL_MintAudio_device->convert); - memcpy(buffer, SDL_MintAudio_device->convert.buf, SDL_MintAudio_device->convert.len_cvt); + if ( audio->convert.src_format == AUDIO_U8 ) { + silence = 0x80; } else { - SDL_MintAudio_device->spec.callback(SDL_MintAudio_device->spec.userdata, buffer, SDL_MintAudio_device->spec.size); + silence = 0; } + memset(audio->convert.buf, silence, audio->convert.len); + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); + memcpy(buffer, audio->convert.buf, audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size); } }