blob: cbe8eaf31048318ff98276c8719731c840b4ade6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 DevFmtX61: return 7;
case DevFmtX71: return 8;
case DevFmtX3D71: 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 DevFmtX61: return "6.1 Surround";
case DevFmtX71: return "7.1 Surround";
case DevFmtX3D71: return "3D7.1 Surround";
case DevFmtAmbi3D: return "Ambisonic 3D";
}
return "(unknown channels)";
}
|