From a9e0e57797c6f4321d5776e1f29bf1e75b11e6a1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 24 Feb 2010 18:51:57 -0800 Subject: [PATCH] Keep UpdateSize updated when apps request a frequency --- Alc/ALc.c | 3 +++ Alc/portaudio.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Alc/ALc.c b/Alc/ALc.c index 1327c04f..40538a64 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1257,6 +1257,9 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint attrIdx += 2; } + device->UpdateSize = (ALuint64)device->UpdateSize * freq / + device->Frequency; + device->Bs2bLevel = level; device->Frequency = freq; device->lNumMonoSources = numMono; diff --git a/Alc/portaudio.c b/Alc/portaudio.c index 5d403f29..1a6142ed 100644 --- a/Alc/portaudio.c +++ b/Alc/portaudio.c @@ -126,6 +126,7 @@ void pa_unload(void) typedef struct { PaStream *stream; + ALuint update_size; } pa_data; @@ -160,6 +161,8 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_FALSE; data = (pa_data*)calloc(1, sizeof(pa_data)); + data->update_size = device->UpdateSize; + device->ExtraData = data; outParams.device = GetConfigValueInt("port", "device", -1); @@ -232,6 +235,7 @@ static ALCboolean pa_reset_playback(ALCdevice *device) streamInfo = pPa_GetStreamInfo(data->stream); device->Frequency = streamInfo->sampleRate; + device->UpdateSize = data->update_size; err = pPa_StartStream(data->stream); if(err != paNoError)