openal-soft/core/ambdec.h

53 lines
1.1 KiB
C
Raw Normal View History

2020-12-25 06:30:47 -08:00
#ifndef CORE_AMBDEC_H
#define CORE_AMBDEC_H
2016-03-14 09:04:03 -07:00
#include <array>
#include <memory>
2018-11-03 19:51:23 -07:00
#include <string>
2016-03-14 09:04:03 -07:00
2020-12-25 09:26:24 -08:00
#include "aloptional.h"
2020-12-12 10:38:24 -08:00
#include "core/ambidefs.h"
2018-11-03 19:02:11 -07:00
2016-03-14 09:04:03 -07:00
/* Helpers to read .ambdec configuration files. */
2018-11-03 19:51:23 -07:00
enum class AmbDecScale {
N3D,
SN3D,
FuMa,
2016-03-14 09:04:03 -07:00
};
2018-11-03 19:51:23 -07:00
struct AmbDecConf {
std::string Description;
int Version{0}; /* Must be 3 */
2016-03-14 09:04:03 -07:00
unsigned int ChanMask{0u};
unsigned int FreqBands{0u}; /* Must be 1 or 2 */
AmbDecScale CoeffScale{};
2016-03-14 09:04:03 -07:00
float XOverFreq{0.0f};
float XOverRatio{0.0f};
2016-03-14 09:04:03 -07:00
2018-12-09 22:34:21 -08:00
struct SpeakerConf {
2018-11-03 19:51:23 -07:00
std::string Name;
float Distance{0.0f};
float Azimuth{0.0f};
float Elevation{0.0f};
2018-11-03 19:51:23 -07:00
std::string Connection;
};
size_t NumSpeakers{0};
std::unique_ptr<SpeakerConf[]> Speakers;
2016-03-14 09:04:03 -07:00
using CoeffArray = std::array<float,MaxAmbiChannels>;
std::unique_ptr<CoeffArray[]> Matrix;
2016-03-14 09:04:03 -07:00
/* Unused when FreqBands == 1 */
float LFOrderGain[MaxAmbiOrder+1]{};
CoeffArray *LFMatrix;
2016-03-14 09:04:03 -07:00
float HFOrderGain[MaxAmbiOrder+1]{};
CoeffArray *HFMatrix;
2016-03-14 09:04:03 -07:00
2020-12-25 09:26:24 -08:00
al::optional<std::string> load(const char *fname) noexcept;
2018-11-03 19:51:23 -07:00
};
2018-11-03 19:02:11 -07:00
2020-12-25 06:30:47 -08:00
#endif /* CORE_AMBDEC_H */