diff options
author | Chris Robinson <[email protected]> | 2020-11-27 19:18:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-11-27 19:18:17 -0800 |
commit | b0919240ab73f2e340f26a913baf7524b35a4c85 (patch) | |
tree | 8a5bf22bf62fe9582af3d930c54f531c16e6b6f1 /core/devformat.cpp | |
parent | d86046d522f45804e28462db0c0e8e1a34a1cfe7 (diff) |
Move some sources to a separate directory
To begin separating the ALC interfaces from internal ones.
Diffstat (limited to 'core/devformat.cpp')
-rw-r--r-- | core/devformat.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/core/devformat.cpp b/core/devformat.cpp new file mode 100644 index 00000000..d13ef3c6 --- /dev/null +++ b/core/devformat.cpp @@ -0,0 +1,65 @@ + +#include "config.h" + +#include "devformat.h" + + +uint BytesFromDevFmt(DevFmtType type) noexcept +{ + switch(type) + { + case DevFmtByte: return sizeof(int8_t); + case DevFmtUByte: return sizeof(uint8_t); + case DevFmtShort: return sizeof(int16_t); + case DevFmtUShort: return sizeof(uint16_t); + case DevFmtInt: return sizeof(int32_t); + case DevFmtUInt: return sizeof(uint32_t); + case DevFmtFloat: return sizeof(float); + } + return 0; +} +uint ChannelsFromDevFmt(DevFmtChannels chans, uint ambiorder) noexcept +{ + switch(chans) + { + case DevFmtMono: return 1; + case DevFmtStereo: return 2; + case DevFmtQuad: return 4; + case DevFmtX51: return 6; + case DevFmtX51Rear: return 6; + case DevFmtX61: return 7; + case DevFmtX71: return 8; + case DevFmtAmbi3D: return (ambiorder+1) * (ambiorder+1); + } + return 0; +} + +const char *DevFmtTypeString(DevFmtType type) noexcept +{ + switch(type) + { + case DevFmtByte: return "Int8"; + case DevFmtUByte: return "UInt8"; + case DevFmtShort: return "Int16"; + case DevFmtUShort: return "UInt16"; + case DevFmtInt: return "Int32"; + case DevFmtUInt: return "UInt32"; + case DevFmtFloat: return "Float32"; + } + return "(unknown type)"; +} +const char *DevFmtChannelsString(DevFmtChannels chans) noexcept +{ + switch(chans) + { + case DevFmtMono: return "Mono"; + case DevFmtStereo: return "Stereo"; + case DevFmtQuad: return "Quadraphonic"; + case DevFmtX51: return "5.1 Surround"; + case DevFmtX51Rear: return "5.1 Surround (Rear)"; + case DevFmtX61: return "6.1 Surround"; + case DevFmtX71: return "7.1 Surround"; + case DevFmtAmbi3D: return "Ambisonic 3D"; + } + return "(unknown channels)"; +} |