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!).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 94ee381..938e2b7 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 767fb8d..62467cf 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 b79c64b..cee4e7a 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 d8a6457..f920de8 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 c222b75..01d1c4c 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 3405281..31aba7e 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);