aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-23 19:49:49 -0700
committerChris Robinson <[email protected]>2018-05-23 19:49:49 -0700
commit422cf429e61c610f271a05c9b5ac44c60b7e58fe (patch)
tree050e7d59215ff448e2f34281da6db5530955e704 /Alc/ALc.c
parent93de5350b9d41c4106bc6a6ccfc23e1bc5f48482 (diff)
Clamp the dither depth between 2 and 20 bits
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 1d001a55..1858c29b 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2217,9 +2217,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
break;
}
}
- else if(depth > 24)
- depth = 24;
- device->DitherDepth = (depth > 0) ? powf(2.0f, (ALfloat)(depth-1)) : 0.0f;
+
+ if(depth > 0)
+ {
+ depth = clampi(depth, 2, 20);
+ device->DitherDepth = powf(2.0f, (ALfloat)(depth-1));
+ }
}
if(!(device->DitherDepth > 0.0f))
TRACE("Dithering disabled\n");