Ensure fmt doesn't install with OpenAL
[openal-soft.git] / core / devformat.cpp
blob57d1d8ea762317bf4e2890cd3fbadc5a24966273
2 #include "config.h"
4 #include "devformat.h"
7 uint BytesFromDevFmt(DevFmtType type) noexcept
9 switch(type)
11 case DevFmtByte: return sizeof(int8_t);
12 case DevFmtUByte: return sizeof(uint8_t);
13 case DevFmtShort: return sizeof(int16_t);
14 case DevFmtUShort: return sizeof(uint16_t);
15 case DevFmtInt: return sizeof(int32_t);
16 case DevFmtUInt: return sizeof(uint32_t);
17 case DevFmtFloat: return sizeof(float);
19 return 0;
21 uint ChannelsFromDevFmt(DevFmtChannels chans, uint ambiorder) noexcept
23 switch(chans)
25 case DevFmtMono: return 1;
26 case DevFmtStereo: return 2;
27 case DevFmtQuad: return 4;
28 case DevFmtX51: return 6;
29 case DevFmtX61: return 7;
30 case DevFmtX71: return 8;
31 case DevFmtX714: return 12;
32 case DevFmtX7144: return 16;
33 case DevFmtX3D71: return 8;
34 case DevFmtAmbi3D: return (ambiorder+1) * (ambiorder+1);
36 return 0;
39 const char *DevFmtTypeString(DevFmtType type) noexcept
41 switch(type)
43 case DevFmtByte: return "Int8";
44 case DevFmtUByte: return "UInt8";
45 case DevFmtShort: return "Int16";
46 case DevFmtUShort: return "UInt16";
47 case DevFmtInt: return "Int32";
48 case DevFmtUInt: return "UInt32";
49 case DevFmtFloat: return "Float32";
51 return "(unknown type)";
53 const char *DevFmtChannelsString(DevFmtChannels chans) noexcept
55 switch(chans)
57 case DevFmtMono: return "Mono";
58 case DevFmtStereo: return "Stereo";
59 case DevFmtQuad: return "Quadraphonic";
60 case DevFmtX51: return "5.1 Surround";
61 case DevFmtX61: return "6.1 Surround";
62 case DevFmtX71: return "7.1 Surround";
63 case DevFmtX714: return "7.1.4 Surround";
64 case DevFmtX7144: return "7.1.4.4 Surround";
65 case DevFmtX3D71: return "3D7.1 Surround";
66 case DevFmtAmbi3D: return "Ambisonic 3D";
68 return "(unknown channels)";