X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Faudio%2Fstream_sound_source.cpp;h=5a0172362c4669fbc300482e55c5dd9796ed0b4c;hb=6b0c80bde84af0bf9323320d99f2fccd7c9eeedd;hp=3569ecdeee90343f584f435a9f0d2a15219e4bb4;hpb=a6864e69a9eda8a902dfaa9712093206f17e508d;p=supertux.git diff --git a/src/audio/stream_sound_source.cpp b/src/audio/stream_sound_source.cpp index 3569ecdee..5a0172362 100644 --- a/src/audio/stream_sound_source.cpp +++ b/src/audio/stream_sound_source.cpp @@ -78,8 +78,8 @@ StreamSoundSource::update() if(!playing()) { if(processed == 0 || !looping) return; - - // we might have to restart the source if we had a buffer underrun + + // we might have to restart the source if we had a buffer underrun log_info << "Restarting audio source because of buffer underrun" << std::endl; play(); } @@ -132,14 +132,13 @@ StreamSoundSource::fillBufferAndQueue(ALuint buffer) if(bytesread > 0) { ALenum format = SoundManager::get_sample_format(file); alBufferData(buffer, format, bufferdata, bytesread, file->rate); - delete[] bufferdata; SoundManager::check_al_error("Couldn't refill audio buffer: "); alSourceQueueBuffers(source, 1, &buffer); SoundManager::check_al_error("Couldn't queue audio buffer: "); } + delete[] bufferdata; // return false if there aren't more buffers to fill return bytesread >= STREAMFRAGMENTSIZE; } -