From 992124d4de01ec040a97c52d4a5d48edb65ea552 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 6 Jan 2017 01:02:58 -0500 Subject: [PATCH] audio: Fixed SDL_AudioStreamGet() function parameters. There was a draft of this where it did audio conversion into the final buffer, if there was enough room available past what you asked for, but that interface got removed, so the parameters didn't make sense (and we were using the wrong one in any case, too!). --- src/audio/SDL_audio.c | 4 ++-- src/audio/SDL_audio_c.h | 2 +- src/audio/SDL_audiocvt.c | 4 ++-- src/audio/emscripten/SDL_emscriptenaudio.c | 4 ++-- src/audio/haiku/SDL_haikuaudio.cc | 2 +- src/audio/nacl/SDL_naclaudio.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 94ee3816ee534..938e2b7abf61f 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -605,7 +605,7 @@ SDL_RunAudio(void *devicep) SDL_Delay(delay); break; } else { - const int got = SDL_AudioStreamGet(device->stream, device->spec.size, stream, device->spec.size); + const int got = SDL_AudioStreamGet(device->stream, stream, device->spec.size); SDL_assert((got < 0) || (got == device->spec.size)); if (got != device->spec.size) { SDL_memset(stream, device->spec.silence, device->spec.size); @@ -702,7 +702,7 @@ SDL_CaptureAudio(void *devicep) SDL_AudioStreamPut(device->stream, stream, stream_len); while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) { - const int got = SDL_AudioStreamGet(device->stream, device->callbackspec.size, device->fake_stream, device->fake_stream_len); + const int got = SDL_AudioStreamGet(device->stream, device->fake_stream, device->callbackspec.size); SDL_assert((got < 0) || (got == device->callbackspec.size)); if (got != device->callbackspec.size) { SDL_memset(device->fake_stream, device->spec.silence, device->callbackspec.size); diff --git a/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h index 767fb8d4fd297..62467cfb50b4f 100644 --- a/src/audio/SDL_audio_c.h +++ b/src/audio/SDL_audio_c.h @@ -87,7 +87,7 @@ SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format, int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, const Uint32 len); /* get converted/resampled data from the stream */ -int SDL_AudioStreamGet(SDL_AudioStream *stream, Uint32 len, void *buf, const Uint32 buflen); +int SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, const Uint32 len); /* clear any pending data in the stream without converting it. */ void SDL_AudioStreamClear(SDL_AudioStream *stream); diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index b79c64b6a6402..cee4e7ae9f1fb 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -832,7 +832,7 @@ SDL_AudioStreamClear(SDL_AudioStream *stream) /* get converted/resampled data from the stream */ int -SDL_AudioStreamGet(SDL_AudioStream *stream, Uint32 len, void *buf, const Uint32 buflen) +SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, const Uint32 len) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -844,7 +844,7 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, Uint32 len, void *buf, const Uint32 return SDL_SetError("Can't request partial sample frames"); } - return (int) SDL_ReadFromDataQueue(stream->queue, buf, buflen); + return (int) SDL_ReadFromDataQueue(stream->queue, buf, len); } /* number of converted/resampled bytes available */ diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index d8a645722bce0..f920de8d49924 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -77,7 +77,7 @@ HandleAudioProcess(_THIS) } } - got = SDL_AudioStreamGet(this->stream, this->spec.size, this->fake_stream, this->spec.size); + got = SDL_AudioStreamGet(this->stream, this->fake_stream, this->spec.size); SDL_assert((got < 0) || (got == this->spec.size)); if (got != this->spec.size) { SDL_memset(this->fake_stream, this->spec.silence, this->spec.size); @@ -130,7 +130,7 @@ HandleCaptureProcess(_THIS) } while (SDL_AudioStreamAvailable(this->stream) >= stream_len) { - const int got = SDL_AudioStreamGet(this->stream, stream_len, this->fake_stream, stream_len); + const int got = SDL_AudioStreamGet(this->stream, this->fake_stream, stream_len); SDL_assert((got < 0) || (got == stream_len)); if (got != stream_len) { SDL_memset(this->fake_stream, this->callbackspec.silence, stream_len); diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc index c222b75434659..01d1c4cae8aab 100644 --- a/src/audio/haiku/SDL_haikuaudio.cc +++ b/src/audio/haiku/SDL_haikuaudio.cc @@ -77,7 +77,7 @@ FillSound(void *device, void *stream, size_t len, } } - const int got = SDL_AudioStreamGet(audio->stream, ilen, stream, ilen); + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); SDL_assert((got < 0) || (got == ilen)); if (got != ilen) { SDL_memset(stream, audio->spec.silence, len); diff --git a/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c index 34052813d8ca6..31aba7e473dec 100644 --- a/src/audio/nacl/SDL_naclaudio.c +++ b/src/audio/nacl/SDL_naclaudio.c @@ -78,7 +78,7 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta } } - const int got = SDL_AudioStreamGet(_this->stream, len, stream, len); + const int got = SDL_AudioStreamGet(_this->stream, stream, len); SDL_assert((got < 0) || (got == len)); if (got != len) { SDL_memset(stream, _this->spec.silence, len);