Check ALROUTER_ACCEPT/REJECT for dlls to accept/reject
[openal-soft.git] / core / storage_formats.cpp
blob51f64644c554c752ae7bf0fa8d0ac7cb16c57375
2 #include "config.h"
4 #include "storage_formats.h"
6 #include <cstdint>
9 const char *NameFromFormat(FmtType type) noexcept
11 switch(type)
13 case FmtUByte: return "UInt8";
14 case FmtShort: return "Int16";
15 case FmtInt: return "Int32";
16 case FmtFloat: return "Float";
17 case FmtDouble: return "Double";
18 case FmtMulaw: return "muLaw";
19 case FmtAlaw: return "aLaw";
20 case FmtIMA4: return "IMA4 ADPCM";
21 case FmtMSADPCM: return "MS ADPCM";
23 return "<internal error>";
26 const char *NameFromFormat(FmtChannels channels) noexcept
28 switch(channels)
30 case FmtMono: return "Mono";
31 case FmtStereo: return "Stereo";
32 case FmtRear: return "Rear";
33 case FmtQuad: return "Quadraphonic";
34 case FmtX51: return "Surround 5.1";
35 case FmtX61: return "Surround 6.1";
36 case FmtX71: return "Surround 7.1";
37 case FmtBFormat2D: return "B-Format 2D";
38 case FmtBFormat3D: return "B-Format 3D";
39 case FmtUHJ2: return "UHJ2";
40 case FmtUHJ3: return "UHJ3";
41 case FmtUHJ4: return "UHJ4";
42 case FmtSuperStereo: return "Super Stereo";
43 case FmtMonoDup: return "Mono (dup)";
45 return "<internal error>";
48 uint BytesFromFmt(FmtType type) noexcept
50 switch(type)
52 case FmtUByte: return sizeof(std::uint8_t);
53 case FmtShort: return sizeof(std::int16_t);
54 case FmtInt: return sizeof(std::int32_t);
55 case FmtFloat: return sizeof(float);
56 case FmtDouble: return sizeof(double);
57 case FmtMulaw: return sizeof(std::uint8_t);
58 case FmtAlaw: return sizeof(std::uint8_t);
59 case FmtIMA4: break;
60 case FmtMSADPCM: break;
62 return 0;
65 uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
67 switch(chans)
69 case FmtMono: return 1;
70 case FmtStereo: return 2;
71 case FmtRear: return 2;
72 case FmtQuad: return 4;
73 case FmtX51: return 6;
74 case FmtX61: return 7;
75 case FmtX71: return 8;
76 case FmtBFormat2D: return (ambiorder*2) + 1;
77 case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
78 case FmtUHJ2: return 2;
79 case FmtUHJ3: return 3;
80 case FmtUHJ4: return 4;
81 case FmtSuperStereo: return 2;
82 case FmtMonoDup: return 1;
84 return 0;