mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
audio: fixed more "spec" references that should have been "callbackspec".
This should catch all the ones for audio targets that have provided their own audio threads.
This commit is contained in:
parent
8b7ae35356
commit
c878b59bbe
@ -412,7 +412,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
|
|||||||
if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
|
if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
|
||||||
/* Generate the data */
|
/* Generate the data */
|
||||||
SDL_LockMutex(this->mixer_lock);
|
SDL_LockMutex(this->mixer_lock);
|
||||||
(*this->spec.callback)(this->spec.userdata,
|
(*this->callbackspec.callback)(this->callbackspec.userdata,
|
||||||
this->hidden->buffer, this->hidden->bufferSize);
|
this->hidden->buffer, this->hidden->bufferSize);
|
||||||
SDL_UnlockMutex(this->mixer_lock);
|
SDL_UnlockMutex(this->mixer_lock);
|
||||||
this->hidden->bufferOffset = 0;
|
this->hidden->bufferOffset = 0;
|
||||||
@ -459,7 +459,7 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer
|
|||||||
|
|
||||||
if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
|
if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
|
||||||
SDL_LockMutex(this->mixer_lock);
|
SDL_LockMutex(this->mixer_lock);
|
||||||
(*this->spec.callback)(this->spec.userdata, this->hidden->buffer, this->hidden->bufferSize);
|
(*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize);
|
||||||
SDL_UnlockMutex(this->mixer_lock);
|
SDL_UnlockMutex(this->mixer_lock);
|
||||||
this->hidden->bufferOffset = 0;
|
this->hidden->bufferOffset = 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ FeedAudioDevice(_THIS, const void *buf, const int buflen)
|
|||||||
static void
|
static void
|
||||||
HandleAudioProcess(_THIS)
|
HandleAudioProcess(_THIS)
|
||||||
{
|
{
|
||||||
SDL_AudioCallback callback = this->spec.callback;
|
SDL_AudioCallback callback = this->callbackspec.callback;
|
||||||
const int stream_len = this->callbackspec.size;
|
const int stream_len = this->callbackspec.size;
|
||||||
|
|
||||||
/* Only do something if audio is enabled */
|
/* Only do something if audio is enabled */
|
||||||
@ -65,11 +65,11 @@ HandleAudioProcess(_THIS)
|
|||||||
|
|
||||||
if (this->stream == NULL) { /* no conversion necessary. */
|
if (this->stream == NULL) { /* no conversion necessary. */
|
||||||
SDL_assert(this->spec.size == stream_len);
|
SDL_assert(this->spec.size == stream_len);
|
||||||
callback(this->spec.userdata, this->work_buffer, stream_len);
|
callback(this->callbackspec.userdata, this->work_buffer, stream_len);
|
||||||
} else { /* streaming/converting */
|
} else { /* streaming/converting */
|
||||||
int got;
|
int got;
|
||||||
while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) {
|
while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) {
|
||||||
callback(this->spec.userdata, this->work_buffer, stream_len);
|
callback(this->callbackspec.userdata, this->work_buffer, stream_len);
|
||||||
if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) {
|
if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) {
|
||||||
SDL_AudioStreamClear(this->stream);
|
SDL_AudioStreamClear(this->stream);
|
||||||
SDL_AtomicSet(&this->enabled, 0);
|
SDL_AtomicSet(&this->enabled, 0);
|
||||||
@ -90,7 +90,7 @@ HandleAudioProcess(_THIS)
|
|||||||
static void
|
static void
|
||||||
HandleCaptureProcess(_THIS)
|
HandleCaptureProcess(_THIS)
|
||||||
{
|
{
|
||||||
SDL_AudioCallback callback = this->spec.callback;
|
SDL_AudioCallback callback = this->callbackspec.callback;
|
||||||
const int stream_len = this->callbackspec.size;
|
const int stream_len = this->callbackspec.size;
|
||||||
|
|
||||||
/* Only do something if audio is enabled */
|
/* Only do something if audio is enabled */
|
||||||
@ -123,7 +123,7 @@ HandleCaptureProcess(_THIS)
|
|||||||
|
|
||||||
if (this->stream == NULL) { /* no conversion necessary. */
|
if (this->stream == NULL) { /* no conversion necessary. */
|
||||||
SDL_assert(this->spec.size == stream_len);
|
SDL_assert(this->spec.size == stream_len);
|
||||||
callback(this->spec.userdata, this->work_buffer, stream_len);
|
callback(this->callbackspec.userdata, this->work_buffer, stream_len);
|
||||||
} else { /* streaming/converting */
|
} else { /* streaming/converting */
|
||||||
if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) {
|
if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) {
|
||||||
SDL_AtomicSet(&this->enabled, 0);
|
SDL_AtomicSet(&this->enabled, 0);
|
||||||
@ -135,7 +135,7 @@ HandleCaptureProcess(_THIS)
|
|||||||
if (got != stream_len) {
|
if (got != stream_len) {
|
||||||
SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len);
|
SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len);
|
||||||
}
|
}
|
||||||
callback(this->spec.userdata, this->work_buffer, stream_len); /* Send it to the app. */
|
callback(this->callbackspec.userdata, this->work_buffer, stream_len); /* Send it to the app. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ FillSound(void *device, void *stream, size_t len,
|
|||||||
const media_raw_audio_format & format)
|
const media_raw_audio_format & format)
|
||||||
{
|
{
|
||||||
SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
|
SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
|
||||||
SDL_AudioCallback callback = audio->spec.callback;
|
SDL_AudioCallback callback = audio->callbackspec.callback;
|
||||||
|
|
||||||
/* Only do something if audio is enabled */
|
/* Only do something if audio is enabled */
|
||||||
if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) {
|
if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) {
|
||||||
@ -63,13 +63,13 @@ FillSound(void *device, void *stream, size_t len,
|
|||||||
|
|
||||||
if (audio->stream == NULL) { /* no conversion necessary. */
|
if (audio->stream == NULL) { /* no conversion necessary. */
|
||||||
SDL_LockMutex(audio->mixer_lock);
|
SDL_LockMutex(audio->mixer_lock);
|
||||||
callback(audio->spec.userdata, (Uint8 *) stream, len);
|
callback(audio->callbackspec.userdata, (Uint8 *) stream, len);
|
||||||
SDL_UnlockMutex(audio->mixer_lock);
|
SDL_UnlockMutex(audio->mixer_lock);
|
||||||
} else { /* streaming/converting */
|
} else { /* streaming/converting */
|
||||||
const int stream_len = audio->callbackspec.size;
|
const int stream_len = audio->callbackspec.size;
|
||||||
const int ilen = (int) len;
|
const int ilen = (int) len;
|
||||||
while (SDL_AudioStreamAvailable(audio->stream) < ilen) {
|
while (SDL_AudioStreamAvailable(audio->stream) < ilen) {
|
||||||
callback(audio->spec.userdata, audio->work_buffer, stream_len);
|
callback(audio->callbackspec.userdata, audio->work_buffer, stream_len);
|
||||||
if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) {
|
if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) {
|
||||||
SDL_AudioStreamClear(audio->stream);
|
SDL_AudioStreamClear(audio->stream);
|
||||||
SDL_AtomicSet(&audio->enabled, 0);
|
SDL_AtomicSet(&audio->enabled, 0);
|
||||||
|
@ -48,7 +48,7 @@ static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelt
|
|||||||
static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) {
|
static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) {
|
||||||
const int len = (int) buffer_size;
|
const int len = (int) buffer_size;
|
||||||
SDL_AudioDevice* _this = (SDL_AudioDevice*) data;
|
SDL_AudioDevice* _this = (SDL_AudioDevice*) data;
|
||||||
SDL_AudioCallback callback = _this->spec.callback;
|
SDL_AudioCallback callback = _this->callbackspec.callback;
|
||||||
|
|
||||||
SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */
|
SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */
|
||||||
|
|
||||||
@ -65,12 +65,12 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta
|
|||||||
|
|
||||||
if (_this->stream == NULL) { /* no conversion necessary. */
|
if (_this->stream == NULL) { /* no conversion necessary. */
|
||||||
SDL_LockMutex(_this->mixer_lock);
|
SDL_LockMutex(_this->mixer_lock);
|
||||||
callback(_this->spec.userdata, stream, len);
|
callback(_this->callbackspec.userdata, stream, len);
|
||||||
SDL_UnlockMutex(_this->mixer_lock);
|
SDL_UnlockMutex(_this->mixer_lock);
|
||||||
} else { /* streaming/converting */
|
} else { /* streaming/converting */
|
||||||
const int stream_len = _this->callbackspec.size;
|
const int stream_len = _this->callbackspec.size;
|
||||||
while (SDL_AudioStreamAvailable(_this->stream) < len) {
|
while (SDL_AudioStreamAvailable(_this->stream) < len) {
|
||||||
callback(_this->spec.userdata, _this->work_buffer, stream_len);
|
callback(_this->callbackspec.userdata, _this->work_buffer, stream_len);
|
||||||
if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) {
|
if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) {
|
||||||
SDL_AudioStreamClear(_this->stream);
|
SDL_AudioStreamClear(_this->stream);
|
||||||
SDL_AtomicSet(&_this->enabled, 0);
|
SDL_AtomicSet(&_this->enabled, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user