2020-12-25 06:30:47 -08:00
|
|
|
#ifndef CORE_AMBDEC_H
|
|
|
|
#define CORE_AMBDEC_H
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2018-12-15 02:42:04 -08:00
|
|
|
#include <array>
|
2020-12-25 08:31:02 -08:00
|
|
|
#include <memory>
|
2018-11-03 19:51:23 -07:00
|
|
|
#include <string>
|
2016-03-14 09:04:03 -07:00
|
|
|
|
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;
|
2018-12-15 03:30:47 -08:00
|
|
|
int Version{0}; /* Must be 3 */
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2018-12-15 03:30:47 -08:00
|
|
|
unsigned int ChanMask{0u};
|
|
|
|
unsigned int FreqBands{0u}; /* Must be 1 or 2 */
|
|
|
|
AmbDecScale CoeffScale{};
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2018-12-15 03:30:47 -08: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;
|
2018-12-15 02:42:04 -08:00
|
|
|
float Distance{0.0f};
|
|
|
|
float Azimuth{0.0f};
|
|
|
|
float Elevation{0.0f};
|
2018-11-03 19:51:23 -07:00
|
|
|
std::string Connection;
|
2018-12-15 02:42:04 -08:00
|
|
|
};
|
2020-12-25 08:31:02 -08:00
|
|
|
size_t NumSpeakers{0};
|
|
|
|
std::unique_ptr<SpeakerConf[]> Speakers;
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2020-12-04 13:53:56 -08:00
|
|
|
using CoeffArray = std::array<float,MaxAmbiChannels>;
|
2020-12-25 08:31:02 -08:00
|
|
|
std::unique_ptr<CoeffArray[]> Matrix;
|
|
|
|
|
2016-03-14 09:04:03 -07:00
|
|
|
/* Unused when FreqBands == 1 */
|
2020-12-04 13:53:56 -08:00
|
|
|
float LFOrderGain[MaxAmbiOrder+1]{};
|
2020-12-25 08:31:02 -08:00
|
|
|
CoeffArray *LFMatrix;
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2020-12-04 13:53:56 -08:00
|
|
|
float HFOrderGain[MaxAmbiOrder+1]{};
|
2020-12-25 08:31:02 -08:00
|
|
|
CoeffArray *HFMatrix;
|
2016-03-14 09:04:03 -07:00
|
|
|
|
2018-11-11 20:40:37 -08:00
|
|
|
int 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 */
|