diff options
Diffstat (limited to 'alc/buffer_storage.h')
-rw-r--r-- | alc/buffer_storage.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/alc/buffer_storage.h b/alc/buffer_storage.h index b10cea4c..4a5b8b5c 100644 --- a/alc/buffer_storage.h +++ b/alc/buffer_storage.h @@ -2,6 +2,11 @@ #define ALC_BUFFER_FORMATS_H #include "AL/al.h" +#include "AL/alext.h" + +#include "albyte.h" +#include "inprogext.h" +#include "vector.h" /* Storable formats */ @@ -25,9 +30,44 @@ enum FmtChannels : unsigned char { FmtBFormat3D, }; +enum class AmbiLayout : unsigned char { + FuMa = AL_FUMA_SOFT, + ACN = AL_ACN_SOFT, +}; +enum class AmbiScaling : unsigned char { + FuMa = AL_FUMA_SOFT, + SN3D = AL_SN3D_SOFT, + N3D = AL_N3D_SOFT, +}; + ALuint BytesFromFmt(FmtType type) noexcept; ALuint ChannelsFromFmt(FmtChannels chans, ALuint ambiorder) noexcept; inline ALuint FrameSizeFromFmt(FmtChannels chans, FmtType type, ALuint ambiorder) noexcept { return ChannelsFromFmt(chans, ambiorder) * BytesFromFmt(type); } + +struct BufferStorage { + al::vector<al::byte,16> mData; + + LPALBUFFERCALLBACKTYPESOFT mCallback{nullptr}; + void *mUserData{nullptr}; + + ALuint mSampleRate{0u}; + FmtChannels mChannels{}; + FmtType mType{}; + ALuint mSampleLen{0u}; + + AmbiLayout mAmbiLayout{AmbiLayout::FuMa}; + AmbiScaling mAmbiScaling{AmbiScaling::FuMa}; + ALuint mAmbiOrder{0u}; + + inline ALuint bytesFromFmt() const noexcept { return BytesFromFmt(mType); } + inline ALuint channelsFromFmt() const noexcept + { return ChannelsFromFmt(mChannels, mAmbiOrder); } + inline ALuint frameSizeFromFmt() const noexcept { return channelsFromFmt() * bytesFromFmt(); } + + inline bool isBFormat() const noexcept + { return mChannels == FmtBFormat2D || mChannels == FmtBFormat3D; } +}; + #endif /* ALC_BUFFER_FORMATS_H */ |