Add queries for the buffer byte/sample/sec length
commited6b8230bd1f4ac502ce4915d24fedacf3eceee0
authorChris Robinson <chris.kcat@gmail.com>
Tue, 7 Mar 2023 21:30:15 +0000 (7 13:30 -0800)
committerChris Robinson <chris.kcat@gmail.com>
Tue, 7 Mar 2023 21:30:15 +0000 (7 13:30 -0800)
treec7766a230fc26a2322ebd472a8022286f544545b
parentf11313c62dd6ab8666023e90dc6fbf3fc70cb1da
Add queries for the buffer byte/sample/sec length

These used to exist with the now-defunct AL_SOFT_buffer_samples extension, this
just restores those queries without extra baggage.

The sample length query are necessary when handling ADPCM buffers, since the
size/channels*8/bits calculation is incorrect with ADPCM. 'Bits' is usually
reported as 4 since most samples in a block are stored as nibbles, but that's
only approximate and doesn't account for the block header. The average number
of bits per sample in an ADPCM block can't be represented as an integer, so the
more blocks there are stored in the buffer, the more inaccurate the calculation
becomes.
al/buffer.cpp
alc/context.cpp
include/AL/alext.h