diff options
author | Chris Robinson <[email protected]> | 2023-03-07 17:27:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-07 17:27:21 -0800 |
commit | a1bd8875ae142ed6253ab60e9b662443a943ca03 (patch) | |
tree | 067f6c0225ab99b19ce41bf8cc8079014d4e98e4 /al/buffer.cpp | |
parent | ed6b8230bd1f4ac502ce4915d24fedacf3eceee0 (diff) |
Avoid duplicate parameter validation
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r-- | al/buffer.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index ae7bf0d9..951dca90 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -1073,21 +1073,20 @@ START_API_FUNC if(ReadRef(albuf->ref) != 0) UNLIKELY context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic layout", buffer); - else if(value != AL_FUMA_SOFT && value != AL_ACN_SOFT) UNLIKELY + else if(const auto layout = AmbiLayoutFromEnum(value)) + albuf->mAmbiLayout = layout.value(); + else UNLIKELY context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic layout %04x", value); - else - albuf->mAmbiLayout = AmbiLayoutFromEnum(value).value(); break; case AL_AMBISONIC_SCALING_SOFT: if(ReadRef(albuf->ref) != 0) UNLIKELY context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic scaling", buffer); - else if(value != AL_FUMA_SOFT && value != AL_SN3D_SOFT && value != AL_N3D_SOFT) - UNLIKELY + else if(const auto scaling = AmbiScalingFromEnum(value)) + albuf->mAmbiScaling = scaling.value(); + else UNLIKELY context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic scaling %04x", value); - else - albuf->mAmbiScaling = AmbiScalingFromEnum(value).value(); break; case AL_UNPACK_AMBISONIC_ORDER_SOFT: |