-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcommon_definition_helper.h
66 lines (54 loc) · 2.06 KB
/
common_definition_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <vector>
#include <map>
#include <memory>
#include <string>
#include <adm/adm.hpp>
class AdmCommonDefinitionHelper {
public:
AdmCommonDefinitionHelper();
~AdmCommonDefinitionHelper();
static std::shared_ptr<AdmCommonDefinitionHelper> getSingleton();
class ChannelFormatData {
public:
ChannelFormatData(std::shared_ptr<adm::AudioChannelFormat> acf, std::shared_ptr<adm::AudioPackFormat> fromPackFormat);
~ChannelFormatData();
int idValue{ 0 };
std::string fullId;
std::string name;
std::string niceName;
std::shared_ptr<adm::AudioChannelFormat> channelFormat;
std::shared_ptr<adm::AudioPackFormat> immediatePackFormat;
bool isLfe{ false };
std::vector<std::string> speakerLabels;
float azimuth{ 0.f };
float elevation{ 0.f };
float distance{ 1.f };
private:
std::string makeNiceSpeakerName(const std::vector<std::string>& speakerLabels);
};
struct PackFormatData {
int idValue{ 0 };
std::string fullId;
std::string name;
std::string niceName;
std::shared_ptr<adm::AudioPackFormat> packFormat;
std::vector<std::shared_ptr<ChannelFormatData>> relatedChannelFormats;
};
struct TypeDefinitionData {
int id{ 0 };
adm::TypeDescriptor typeDescriptor;
std::string name;
std::vector<std::shared_ptr<PackFormatData>> relatedPackFormats;
};
std::map<int, std::shared_ptr<TypeDefinitionData>> getElementRelationships();
std::shared_ptr<TypeDefinitionData> getTypeDefinitionData(int tdId);
std::shared_ptr<PackFormatData> getPackFormatData(int tdId, int pfId);
std::shared_ptr<ChannelFormatData> getChannelFormatData(int tdId, int pfId, int cfId);
private:
void populateElementRelationshipsFor(adm::TypeDescriptor);
void recursePackFormatsForChannelFormats(std::shared_ptr<adm::AudioPackFormat> fromPackFormat, std::shared_ptr<PackFormatData> forPackFormatData);
std::string makeNicePackFormatName(const std::string& originalName);
std::shared_ptr<adm::Document> admCommonDefinitions;
std::map<int, std::shared_ptr<TypeDefinitionData>> typeDefinitionDatas;
};