Skip to content

Commit

Permalink
Improve speaker labeling. Support custom CFs.
Browse files Browse the repository at this point in the history
  • Loading branch information
firthm01 committed Nov 11, 2023
1 parent d8a0655 commit fb7a6b7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ class ChannelMeterLayout : public Component {
if (pfData) {
for (int i = 0; i < pfData->relatedChannelFormats.size(); ++i) {
auto cfData = pfData->relatedChannelFormats[i];
std::string label;
if (cfData->legacySpeakerLabel.has_value()) {
label = cfData->legacySpeakerLabel.value();
} else if (cfData->ituLabel.has_value()) {
label = cfData->ituLabel.value();
}
auto label = cfData->getBestSpeakerLabel();
speakerLevels_.push_back(std::make_unique<SpeakerLevel>(label));
speakerLevels_.back()->getLevelMeter()->setMeter(levelMeter_, i);
if (i < 6) {
Expand Down
8 changes: 1 addition & 7 deletions shared/components/speaker_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ void SpeakerLayer::paint(Graphics& g) {
layer = Layer::upper;
}
if (layer == layer_) {
std::string label;
if (cfData->legacySpeakerLabel.has_value()) {
label = cfData->legacySpeakerLabel.value();
}
else if (cfData->ituLabel.has_value()) {
label = cfData->ituLabel.value();
}
auto label = cfData->getBestSpeakerLabel();
if (cfData->elevation >= 90.f) {
drawVoiceOfGod(g, label);
}
Expand Down
11 changes: 11 additions & 0 deletions shared/helper/adm_preset_definitions_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ bool AdmPresetDefinitionsHelper::ChannelFormatData::isCommonDefinition()
return idValue <= 0x0FFF;
}

std::string AdmPresetDefinitionsHelper::ChannelFormatData::getBestSpeakerLabel()
{
if (legacySpeakerLabel.has_value())
return legacySpeakerLabel.value();
if (ituLabel.has_value())
return ituLabel.value();
if (speakerLabels.size() > 0)
return speakerLabels[0];
return name;
}

void AdmPresetDefinitionsHelper::ChannelFormatData::setItuLabels()
{
for (auto const& speakerLabel : speakerLabels) {
Expand Down
1 change: 1 addition & 0 deletions shared/helper/adm_preset_definitions_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class AdmPresetDefinitionsHelper {
float distance{ 1.f };

bool isCommonDefinition();
std::string getBestSpeakerLabel();

private:
void setItuLabels();
Expand Down
6 changes: 4 additions & 2 deletions shared/helper/supplementary_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,17 @@ R"5UPPL3M3N74RY(
<!-- audioPackFormat_18 in MPEG-H ADM Profile 1.0.0 -->
<audioChannelFormat audioChannelFormatID="AC_00011001" audioChannelFormatName="Left back surround" typeLabel="0001" typeDefinition="DirectSpeakers">
<audioBlockFormat audioBlockFormatID="AB_00011001_00000001">
<speakerLabel>CH_M_L150</speakerLabel>
<!-- speakerLabel "CH_M_L150" -->
<speakerLabel>L150</speakerLabel>
<position coordinate="azimuth">150.0</position>
<position coordinate="elevation">0.0</position>
<position coordinate="distance">1.0</position>
</audioBlockFormat>
</audioChannelFormat>
<audioChannelFormat audioChannelFormatID="AC_00011002" audioChannelFormatName="Right back surround" typeLabel="0001" typeDefinition="DirectSpeakers">
<audioBlockFormat audioBlockFormatID="AB_00011002_00000001">
<speakerLabel>CH_M_R150</speakerLabel>
<!-- speakerLabel "CH_M_R150" -->
<speakerLabel>R150</speakerLabel>
<position coordinate="azimuth">-150.0</position>
<position coordinate="elevation">0.0</position>
<position coordinate="distance">1.0</position>
Expand Down

0 comments on commit fb7a6b7

Please sign in to comment.