Keep UpdateSize updated when apps request a frequency

This commit is contained in:
Chris Robinson 2010-02-24 18:51:57 -08:00
parent 9b47048231
commit a9e0e57797
2 changed files with 7 additions and 0 deletions

View File

@ -1257,6 +1257,9 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
attrIdx += 2; attrIdx += 2;
} }
device->UpdateSize = (ALuint64)device->UpdateSize * freq /
device->Frequency;
device->Bs2bLevel = level; device->Bs2bLevel = level;
device->Frequency = freq; device->Frequency = freq;
device->lNumMonoSources = numMono; device->lNumMonoSources = numMono;

View File

@ -126,6 +126,7 @@ void pa_unload(void)
typedef struct { typedef struct {
PaStream *stream; PaStream *stream;
ALuint update_size;
} pa_data; } pa_data;
@ -160,6 +161,8 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
return ALC_FALSE; return ALC_FALSE;
data = (pa_data*)calloc(1, sizeof(pa_data)); data = (pa_data*)calloc(1, sizeof(pa_data));
data->update_size = device->UpdateSize;
device->ExtraData = data; device->ExtraData = data;
outParams.device = GetConfigValueInt("port", "device", -1); outParams.device = GetConfigValueInt("port", "device", -1);
@ -232,6 +235,7 @@ static ALCboolean pa_reset_playback(ALCdevice *device)
streamInfo = pPa_GetStreamInfo(data->stream); streamInfo = pPa_GetStreamInfo(data->stream);
device->Frequency = streamInfo->sampleRate; device->Frequency = streamInfo->sampleRate;
device->UpdateSize = data->update_size;
err = pPa_StartStream(data->stream); err = pPa_StartStream(data->stream);
if(err != paNoError) if(err != paNoError)