diff options
author | Chris Robinson <[email protected]> | 2019-12-02 11:39:30 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-12-02 11:51:27 -0800 |
commit | 799c60f3bbf041c5eafeb6b3acb7fc5d3f395718 (patch) | |
tree | 205e8772dcf9e90ae482f1702c0b5ab3c570e68e /al/buffer.cpp | |
parent | 58e4d643d3daa1d181901f6618ba96919f199f55 (diff) |
Add an interface to set a B-Format buffer's layout and scaling
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r-- | al/buffer.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index 8f4228a8..abad6236 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -1090,6 +1090,26 @@ START_API_FUNC albuf->PackAlign = static_cast<ALuint>(value); break; + case AL_AMBISONIC_LAYOUT_SOFT: + if UNLIKELY(ReadRef(albuf->ref) != 0) + context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic layout", + buffer); + else if UNLIKELY(value != AL_FUMA_SOFT && value != AL_ACN_SOFT) + context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic layout %04x", value); + else + albuf->AmbiLayout = value; + break; + + case AL_AMBISONIC_SCALING_SOFT: + if UNLIKELY(ReadRef(albuf->ref) != 0) + context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic scaling", + buffer); + else if UNLIKELY(value != AL_FUMA_SOFT && value != AL_SN3D_SOFT && value != AL_N3D_SOFT) + context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic scaling %04x", value); + else + albuf->AmbiScaling = value; + break; + default: context->setError(AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } @@ -1125,6 +1145,8 @@ START_API_FUNC { case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: case AL_PACK_BLOCK_ALIGNMENT_SOFT: + case AL_AMBISONIC_LAYOUT_SOFT: + case AL_AMBISONIC_SCALING_SOFT: alBufferi(buffer, param, values[0]); return; } @@ -1277,6 +1299,14 @@ START_API_FUNC *value = static_cast<ALint>(albuf->PackAlign); break; + case AL_AMBISONIC_LAYOUT_SOFT: + *value = albuf->AmbiLayout; + break; + + case AL_AMBISONIC_SCALING_SOFT: + *value = albuf->AmbiScaling; + break; + default: context->setError(AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } @@ -1317,6 +1347,8 @@ START_API_FUNC case AL_SAMPLE_LENGTH_SOFT: case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: case AL_PACK_BLOCK_ALIGNMENT_SOFT: + case AL_AMBISONIC_LAYOUT_SOFT: + case AL_AMBISONIC_SCALING_SOFT: alGetBufferi(buffer, param, values); return; } |