Support loading as float or ADPCM in alplay
[openal-soft.git] / core / ambdec.h
blob7f7397817c1577295fd7967faa325f47e617692c
1 #ifndef CORE_AMBDEC_H
2 #define CORE_AMBDEC_H
4 #include <array>
5 #include <memory>
6 #include <string>
8 #include "aloptional.h"
9 #include "core/ambidefs.h"
11 /* Helpers to read .ambdec configuration files. */
13 enum class AmbDecScale {
14 Unset,
15 N3D,
16 SN3D,
17 FuMa,
19 struct AmbDecConf {
20 std::string Description;
21 int Version{0}; /* Must be 3 */
23 unsigned int ChanMask{0u};
24 unsigned int FreqBands{0u}; /* Must be 1 or 2 */
25 AmbDecScale CoeffScale{AmbDecScale::Unset};
27 float XOverFreq{0.0f};
28 float XOverRatio{0.0f};
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;
37 size_t NumSpeakers{0};
38 std::unique_ptr<SpeakerConf[]> Speakers;
40 using CoeffArray = std::array<float,MaxAmbiChannels>;
41 std::unique_ptr<CoeffArray[]> Matrix;
43 /* Unused when FreqBands == 1 */
44 float LFOrderGain[MaxAmbiOrder+1]{};
45 CoeffArray *LFMatrix;
47 float HFOrderGain[MaxAmbiOrder+1]{};
48 CoeffArray *HFMatrix;
50 ~AmbDecConf();
52 al::optional<std::string> load(const char *fname) noexcept;
55 #endif /* CORE_AMBDEC_H */