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!).
This commit is contained in:
Ryan C. Gordon 2017-01-06 01:02:58 -05:00
parent 99fc1ef994
commit 992124d4de
6 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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);