Log the buffer format when queueing mismatched buffers
[openal-soft.git] / core / buffer_storage.cpp
blob98ca2c1b3fe524f81d850ae37c5126f820d37755
2 #include "config.h"
4 #include "buffer_storage.h"
6 #include <stdint.h>
9 const char *NameFromFormat(FmtType type) noexcept
11 switch(type)
13 case FmtUByte: return "UInt8";
14 case FmtShort: return "Int16";
15 case FmtFloat: return "Float";
16 case FmtDouble: return "Double";
17 case FmtMulaw: return "muLaw";
18 case FmtAlaw: return "aLaw";
19 case FmtIMA4: return "IMA4 ADPCM";
20 case FmtMSADPCM: return "MS ADPCM";
22 return "<internal error>";
25 const char *NameFromFormat(FmtChannels channels) noexcept
27 switch(channels)
29 case FmtMono: return "Mono";
30 case FmtStereo: return "Stereo";
31 case FmtRear: return "Rear";
32 case FmtQuad: return "Quadraphonic";
33 case FmtX51: return "Surround 5.1";
34 case FmtX61: return "Surround 6.1";
35 case FmtX71: return "Surround 7.1";
36 case FmtBFormat2D: return "B-Format 2D";
37 case FmtBFormat3D: return "B-Format 3D";
38 case FmtUHJ2: return "UHJ2";
39 case FmtUHJ3: return "UHJ3";
40 case FmtUHJ4: return "UHJ4";
41 case FmtSuperStereo: return "Super Stereo";
43 return "<internal error>";
46 uint BytesFromFmt(FmtType type) noexcept
48 switch(type)
50 case FmtUByte: return sizeof(uint8_t);
51 case FmtShort: return sizeof(int16_t);
52 case FmtFloat: return sizeof(float);
53 case FmtDouble: return sizeof(double);
54 case FmtMulaw: return sizeof(uint8_t);
55 case FmtAlaw: return sizeof(uint8_t);
56 case FmtIMA4: break;
57 case FmtMSADPCM: break;
59 return 0;
62 uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
64 switch(chans)
66 case FmtMono: return 1;
67 case FmtStereo: return 2;
68 case FmtRear: return 2;
69 case FmtQuad: return 4;
70 case FmtX51: return 6;
71 case FmtX61: return 7;
72 case FmtX71: return 8;
73 case FmtBFormat2D: return (ambiorder*2) + 1;
74 case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
75 case FmtUHJ2: return 2;
76 case FmtUHJ3: return 3;
77 case FmtUHJ4: return 4;
78 case FmtSuperStereo: return 2;
80 return 0;