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