🛠️🐜 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.

54 lines
1.1 KiB

  1. #ifndef CORE_AMBDEC_H
  2. #define CORE_AMBDEC_H
  3. #include <array>
  4. #include <memory>
  5. #include <string>
  6. #include "aloptional.h"
  7. #include "core/ambidefs.h"
  8. /* Helpers to read .ambdec configuration files. */
  9. enum class AmbDecScale {
  10. N3D,
  11. SN3D,
  12. FuMa,
  13. };
  14. struct AmbDecConf {
  15. std::string Description;
  16. int Version{0}; /* Must be 3 */
  17. unsigned int ChanMask{0u};
  18. unsigned int FreqBands{0u}; /* Must be 1 or 2 */
  19. AmbDecScale CoeffScale{};
  20. float XOverFreq{0.0f};
  21. float XOverRatio{0.0f};
  22. struct SpeakerConf {
  23. std::string Name;
  24. float Distance{0.0f};
  25. float Azimuth{0.0f};
  26. float Elevation{0.0f};
  27. std::string Connection;
  28. };
  29. size_t NumSpeakers{0};
  30. std::unique_ptr<SpeakerConf[]> Speakers;
  31. using CoeffArray = std::array<float,MaxAmbiChannels>;
  32. std::unique_ptr<CoeffArray[]> Matrix;
  33. /* Unused when FreqBands == 1 */
  34. float LFOrderGain[MaxAmbiOrder+1]{};
  35. CoeffArray *LFMatrix;
  36. float HFOrderGain[MaxAmbiOrder+1]{};
  37. CoeffArray *HFMatrix;
  38. ~AmbDecConf();
  39. al::optional<std::string> load(const char *fname) noexcept;
  40. };
  41. #endif /* CORE_AMBDEC_H */