aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-08-13 13:28:35 -0700
committerChris Robinson <[email protected]>2009-08-13 13:28:35 -0700
commitd46655fbb2a70758b8a901b86055b82068c7231b (patch)
tree648408bad3efb951e2275e2f3b23f63f0a108497 /Alc
parent87fee8c504b831d451390bc60549a941a5f25f7f (diff)
Support the ALC_FREQUENCY context attribute
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 24d12e5e..034bfb4a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1049,6 +1049,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
// Check for attributes
if (attrList)
{
+ ALCuint freq = device->Frequency;
ALCint numMono = device->lNumMonoSources;
ALCint numStereo = device->lNumStereoSources;
ALCuint numSends = device->NumAuxSends;
@@ -1056,7 +1057,14 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
ulAttributeIndex = 0;
while ((ulAttributeIndex < 10) && (attrList[ulAttributeIndex]))
{
- if (attrList[ulAttributeIndex] == ALC_STEREO_SOURCES)
+ if(attrList[ulAttributeIndex] == ALC_FREQUENCY)
+ {
+ freq = attrList[ulAttributeIndex + 1];
+ if(freq == 0)
+ freq = device->Frequency;
+ }
+
+ if(attrList[ulAttributeIndex] == ALC_STEREO_SOURCES)
{
ulRequestedStereoSources = attrList[ulAttributeIndex + 1];
@@ -1080,6 +1088,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
ulAttributeIndex += 2;
}
+ device->Frequency = GetConfigValueInt(NULL, "frequency", freq);
device->lNumMonoSources = numMono;
device->lNumStereoSources = numStereo;
device->NumAuxSends = numSends;
@@ -1091,6 +1100,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint
ALContext = NULL;
SetALCError(ALC_INVALID_VALUE);
}
+ ALContext->Frequency = device->Frequency;
}
else
{
@@ -1266,7 +1276,7 @@ ALCAPI ALCdevice* ALCAPIENTRY alcOpenDevice(const ALCchar *deviceName)
//Set output format
device->Frequency = GetConfigValueInt(NULL, "frequency", SWMIXER_OUTPUT_RATE);
- if((ALint)device->Frequency <= 0)
+ if(device->Frequency == 0)
device->Frequency = SWMIXER_OUTPUT_RATE;
fmt = GetConfigValue(NULL, "format", "AL_FORMAT_STEREO16");