Move assume_aligned to opthelpers.h and define force_inline
[openal-soft.git] / core / buffer_storage.cpp
blob1c80e7ef60a8ef45b6795dacfa9321cb43d2833e
2 #include "config.h"
4 #include "buffer_storage.h"
6 #include <stdint.h>
9 uint BytesFromFmt(FmtType type) noexcept
11 switch(type)
13 case FmtUByte: return sizeof(uint8_t);
14 case FmtShort: return sizeof(int16_t);
15 case FmtFloat: return sizeof(float);
16 case FmtDouble: return sizeof(double);
17 case FmtMulaw: return sizeof(uint8_t);
18 case FmtAlaw: return sizeof(uint8_t);
20 return 0;
23 uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
25 switch(chans)
27 case FmtMono: return 1;
28 case FmtStereo: return 2;
29 case FmtRear: return 2;
30 case FmtQuad: return 4;
31 case FmtX51: return 6;
32 case FmtX61: return 7;
33 case FmtX71: return 8;
34 case FmtBFormat2D: return (ambiorder*2) + 1;
35 case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
36 case FmtUHJ2: return 2;
37 case FmtUHJ3: return 3;
38 case FmtUHJ4: return 4;
39 case FmtSuperStereo: return 2;
41 return 0;