diff options
author | Chris Robinson <[email protected]> | 2020-11-20 04:27:10 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-11-20 04:27:10 -0800 |
commit | 2cb2ffef72e19737e457048aae57d1c4856142bf (patch) | |
tree | 2cd6b6b2ff55ca69d9ea0f1b75d8ad35cb967b39 /alc | |
parent | c3cb09aa0cd8a7e9deeab736087cd8db7298743b (diff) |
Disassociate internal buffer enums from AL enum values
Diffstat (limited to 'alc')
-rw-r--r-- | alc/buffer_storage.cpp | 5 | ||||
-rw-r--r-- | alc/buffer_storage.h | 44 |
2 files changed, 25 insertions, 24 deletions
diff --git a/alc/buffer_storage.cpp b/alc/buffer_storage.cpp index 727cb281..7d3adddd 100644 --- a/alc/buffer_storage.cpp +++ b/alc/buffer_storage.cpp @@ -6,7 +6,7 @@ #include <cstdint> -ALuint BytesFromFmt(FmtType type) noexcept +uint BytesFromFmt(FmtType type) noexcept { switch(type) { @@ -19,7 +19,8 @@ ALuint BytesFromFmt(FmtType type) noexcept } return 0; } -ALuint ChannelsFromFmt(FmtChannels chans, ALuint ambiorder) noexcept + +uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept { switch(chans) { diff --git a/alc/buffer_storage.h b/alc/buffer_storage.h index 434d5ed0..60770184 100644 --- a/alc/buffer_storage.h +++ b/alc/buffer_storage.h @@ -3,15 +3,13 @@ #include <atomic> -#include "AL/al.h" -#include "AL/alext.h" - #include "albyte.h" #include "almalloc.h" -#include "inprogext.h" #include "vector.h" +using uint = unsigned int; + /* Storable formats */ enum FmtType : unsigned char { FmtUByte, @@ -34,43 +32,45 @@ enum FmtChannels : unsigned char { }; enum class AmbiLayout : unsigned char { - FuMa = AL_FUMA_SOFT, - ACN = AL_ACN_SOFT, + FuMa, + ACN, }; enum class AmbiScaling : unsigned char { - FuMa = AL_FUMA_SOFT, - SN3D = AL_SN3D_SOFT, - N3D = AL_N3D_SOFT, + FuMa, + SN3D, + N3D, }; -ALuint BytesFromFmt(FmtType type) noexcept; -ALuint ChannelsFromFmt(FmtChannels chans, ALuint ambiorder) noexcept; -inline ALuint FrameSizeFromFmt(FmtChannels chans, FmtType type, ALuint ambiorder) noexcept +uint BytesFromFmt(FmtType type) noexcept; +uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept; +inline uint FrameSizeFromFmt(FmtChannels chans, FmtType type, uint ambiorder) noexcept { return ChannelsFromFmt(chans, ambiorder) * BytesFromFmt(type); } +using CallbackType = int(*)(void*, void*, int); + struct BufferStorage { al::vector<al::byte,16> mData; - LPALBUFFERCALLBACKTYPESOFT mCallback{nullptr}; + CallbackType mCallback{nullptr}; void *mUserData{nullptr}; - ALuint mSampleRate{0u}; + uint mSampleRate{0u}; FmtChannels mChannels{}; FmtType mType{}; - ALuint mSampleLen{0u}; + uint mSampleLen{0u}; AmbiLayout mAmbiLayout{AmbiLayout::FuMa}; AmbiScaling mAmbiScaling{AmbiScaling::FuMa}; - ALuint mAmbiOrder{0u}; + uint mAmbiOrder{0u}; - ALuint mLoopStart{0u}; - ALuint mLoopEnd{0u}; + uint mLoopStart{0u}; + uint mLoopEnd{0u}; - inline ALuint bytesFromFmt() const noexcept { return BytesFromFmt(mType); } - inline ALuint channelsFromFmt() const noexcept + inline uint bytesFromFmt() const noexcept { return BytesFromFmt(mType); } + inline uint channelsFromFmt() const noexcept { return ChannelsFromFmt(mChannels, mAmbiOrder); } - inline ALuint frameSizeFromFmt() const noexcept { return channelsFromFmt() * bytesFromFmt(); } + inline uint frameSizeFromFmt() const noexcept { return channelsFromFmt() * bytesFromFmt(); } inline bool isBFormat() const noexcept { return mChannels == FmtBFormat2D || mChannels == FmtBFormat3D; } @@ -79,7 +79,7 @@ struct BufferStorage { struct BufferlistItem { std::atomic<BufferlistItem*> mNext{nullptr}; - ALuint mSampleLen{0u}; + uint mSampleLen{0u}; BufferStorage *mBuffer{nullptr}; DEF_NEWDEL(BufferlistItem) |