aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-15 12:26:19 -0800
committerChris Robinson <[email protected]>2012-02-15 12:26:19 -0800
commit670c88a64c87c23a505d941ea7e72785918d304c (patch)
tree6cad50daa9c8ad8ddac4c81acd952e0106137434
parent425ff7cb00c3666e87ec5dbdbf3a65c9a77d9266 (diff)
Define a minimum output sample rate and warn if the config option goes below it
-rw-r--r--Alc/ALc.c12
-rw-r--r--OpenAL32/Include/alMain.h1
2 files changed, 9 insertions, 4 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index aac7b6d3..d451e139 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1114,7 +1114,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(device->IsLoopbackDevice)
{
freq = attrList[attrIdx + 1];
- if(freq < 8000)
+ if(freq < MIN_OUTPUT_RATE)
return ALC_INVALID_VALUE;
gotFmt |= GotFreq;
}
@@ -1151,7 +1151,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
else
{
ConfigValueUInt(NULL, "frequency", &freq);
- freq = maxu(freq, 8000);
+ freq = maxu(freq, MIN_OUTPUT_RATE);
}
ConfigValueUInt(NULL, "sends", &numSends);
numSends = minu(MAX_SENDS, numSends);
@@ -2495,8 +2495,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
device->Frequency = DEFAULT_OUTPUT_RATE;
if(ConfigValueUInt(NULL, "frequency", &device->Frequency))
+ {
device->Flags |= DEVICE_FREQUENCY_REQUEST;
- device->Frequency = maxu(device->Frequency, 8000);
+ if(device->Frequency < MIN_OUTPUT_RATE)
+ ERR("%uhz request clamped to %uhz minimum\n", device->Frequency, MIN_OUTPUT_RATE);
+ device->Frequency = maxu(device->Frequency, MIN_OUTPUT_RATE);
+ }
fmt = "AL_FORMAT_STEREO32";
if(ConfigValueStr(NULL, "format", &fmt))
@@ -2676,7 +2680,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device
else
{
if(BytesFromDevFmt(type) > 0 && ChannelsFromDevFmt(channels) > 0 &&
- freq >= 8000)
+ freq >= MIN_OUTPUT_RATE)
ret = ALC_TRUE;
}
if(device) ALCdevice_DecRef(device);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 1f10d639..edfe9f64 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -377,6 +377,7 @@ extern "C" {
#define DEFAULT_OUTPUT_RATE (44100)
+#define MIN_OUTPUT_RATE (8000)
#define SPEEDOFSOUNDMETRESPERSEC (343.3f)
#define AIRABSORBGAINHF (0.99426f) /* -0.05dB */