audio: Fixed SDL_AudioStreamGet() function parameters.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 06 Jan 2017 01:02:58 -0500
changeset 10764f9bf759e9dd1
parent 10763 57d013df99b0
child 10765 61312c8c59fe
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
src/audio/SDL_audio_c.h
src/audio/SDL_audiocvt.c
src/audio/emscripten/SDL_emscriptenaudio.c
src/audio/haiku/SDL_haikuaudio.cc
src/audio/nacl/SDL_naclaudio.c
     1.1 --- a/src/audio/SDL_audio.c	Fri Jan 06 00:56:29 2017 -0500
     1.2 +++ b/src/audio/SDL_audio.c	Fri Jan 06 01:02:58 2017 -0500
     1.3 @@ -605,7 +605,7 @@
     1.4                      SDL_Delay(delay);
     1.5                      break;
     1.6                  } else {
     1.7 -                    const int got = SDL_AudioStreamGet(device->stream, device->spec.size, stream, device->spec.size);
     1.8 +                    const int got = SDL_AudioStreamGet(device->stream, stream, device->spec.size);
     1.9                      SDL_assert((got < 0) || (got == device->spec.size));
    1.10                      if (got != device->spec.size) {
    1.11                          SDL_memset(stream, device->spec.silence, device->spec.size);
    1.12 @@ -702,7 +702,7 @@
    1.13              SDL_AudioStreamPut(device->stream, stream, stream_len);
    1.14  
    1.15              while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) {
    1.16 -                const int got = SDL_AudioStreamGet(device->stream, device->callbackspec.size, device->fake_stream, device->fake_stream_len);
    1.17 +                const int got = SDL_AudioStreamGet(device->stream, device->fake_stream, device->callbackspec.size);
    1.18                  SDL_assert((got < 0) || (got == device->callbackspec.size));
    1.19                  if (got != device->callbackspec.size) {
    1.20                      SDL_memset(device->fake_stream, device->spec.silence, device->callbackspec.size);
     2.1 --- a/src/audio/SDL_audio_c.h	Fri Jan 06 00:56:29 2017 -0500
     2.2 +++ b/src/audio/SDL_audio_c.h	Fri Jan 06 01:02:58 2017 -0500
     2.3 @@ -87,7 +87,7 @@
     2.4  int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, const Uint32 len);
     2.5  
     2.6  /* get converted/resampled data from the stream */
     2.7 -int SDL_AudioStreamGet(SDL_AudioStream *stream, Uint32 len, void *buf, const Uint32 buflen);
     2.8 +int SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, const Uint32 len);
     2.9  
    2.10  /* clear any pending data in the stream without converting it. */
    2.11  void SDL_AudioStreamClear(SDL_AudioStream *stream);
     3.1 --- a/src/audio/SDL_audiocvt.c	Fri Jan 06 00:56:29 2017 -0500
     3.2 +++ b/src/audio/SDL_audiocvt.c	Fri Jan 06 01:02:58 2017 -0500
     3.3 @@ -832,7 +832,7 @@
     3.4  
     3.5  /* get converted/resampled data from the stream */
     3.6  int
     3.7 -SDL_AudioStreamGet(SDL_AudioStream *stream, Uint32 len, void *buf, const Uint32 buflen)
     3.8 +SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, const Uint32 len)
     3.9  {
    3.10      if (!stream) {
    3.11          return SDL_InvalidParamError("stream");
    3.12 @@ -844,7 +844,7 @@
    3.13          return SDL_SetError("Can't request partial sample frames");
    3.14      }
    3.15  
    3.16 -    return (int) SDL_ReadFromDataQueue(stream->queue, buf, buflen);
    3.17 +    return (int) SDL_ReadFromDataQueue(stream->queue, buf, len);
    3.18  }
    3.19  
    3.20  /* number of converted/resampled bytes available */
     4.1 --- a/src/audio/emscripten/SDL_emscriptenaudio.c	Fri Jan 06 00:56:29 2017 -0500
     4.2 +++ b/src/audio/emscripten/SDL_emscriptenaudio.c	Fri Jan 06 01:02:58 2017 -0500
     4.3 @@ -77,7 +77,7 @@
     4.4              }
     4.5          }
     4.6  
     4.7 -        got = SDL_AudioStreamGet(this->stream, this->spec.size, this->fake_stream, this->spec.size);
     4.8 +        got = SDL_AudioStreamGet(this->stream, this->fake_stream, this->spec.size);
     4.9          SDL_assert((got < 0) || (got == this->spec.size));
    4.10          if (got != this->spec.size) {
    4.11              SDL_memset(this->fake_stream, this->spec.silence, this->spec.size);
    4.12 @@ -130,7 +130,7 @@
    4.13          }
    4.14  
    4.15          while (SDL_AudioStreamAvailable(this->stream) >= stream_len) {
    4.16 -            const int got = SDL_AudioStreamGet(this->stream, stream_len, this->fake_stream, stream_len);
    4.17 +            const int got = SDL_AudioStreamGet(this->stream, this->fake_stream, stream_len);
    4.18              SDL_assert((got < 0) || (got == stream_len));
    4.19              if (got != stream_len) {
    4.20                  SDL_memset(this->fake_stream, this->callbackspec.silence, stream_len);
     5.1 --- a/src/audio/haiku/SDL_haikuaudio.cc	Fri Jan 06 00:56:29 2017 -0500
     5.2 +++ b/src/audio/haiku/SDL_haikuaudio.cc	Fri Jan 06 01:02:58 2017 -0500
     5.3 @@ -77,7 +77,7 @@
     5.4              }
     5.5          }
     5.6  
     5.7 -        const int got = SDL_AudioStreamGet(audio->stream, ilen, stream, ilen);
     5.8 +        const int got = SDL_AudioStreamGet(audio->stream, stream, ilen);
     5.9          SDL_assert((got < 0) || (got == ilen));
    5.10          if (got != ilen) {
    5.11              SDL_memset(stream, audio->spec.silence, len);
     6.1 --- a/src/audio/nacl/SDL_naclaudio.c	Fri Jan 06 00:56:29 2017 -0500
     6.2 +++ b/src/audio/nacl/SDL_naclaudio.c	Fri Jan 06 01:02:58 2017 -0500
     6.3 @@ -78,7 +78,7 @@
     6.4              }
     6.5          }
     6.6  
     6.7 -        const int got = SDL_AudioStreamGet(_this->stream, len, stream, len);
     6.8 +        const int got = SDL_AudioStreamGet(_this->stream, stream, len);
     6.9          SDL_assert((got < 0) || (got == len));
    6.10          if (got != len) {
    6.11              SDL_memset(stream, _this->spec.silence, len);