🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
954 B

  1. #include "config.h"
  2. #include "buffer_storage.h"
  3. #include <stdint.h>
  4. uint BytesFromFmt(FmtType type) noexcept
  5. {
  6. switch(type)
  7. {
  8. case FmtUByte: return sizeof(uint8_t);
  9. case FmtShort: return sizeof(int16_t);
  10. case FmtFloat: return sizeof(float);
  11. case FmtDouble: return sizeof(double);
  12. case FmtMulaw: return sizeof(uint8_t);
  13. case FmtAlaw: return sizeof(uint8_t);
  14. }
  15. return 0;
  16. }
  17. uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
  18. {
  19. switch(chans)
  20. {
  21. case FmtMono: return 1;
  22. case FmtStereo: return 2;
  23. case FmtRear: return 2;
  24. case FmtQuad: return 4;
  25. case FmtX51: return 6;
  26. case FmtX61: return 7;
  27. case FmtX71: return 8;
  28. case FmtBFormat2D: return (ambiorder*2) + 1;
  29. case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
  30. case FmtUHJ2: return 2;
  31. case FmtUHJ3: return 3;
  32. case FmtUHJ4: return 4;
  33. case FmtSuperStereo: return 2;
  34. }
  35. return 0;
  36. }