Skip to content

Commit

Permalink
Apply ID gen optimisation in store serialiser and fix bug
Browse files Browse the repository at this point in the history
bug was type def "1" being used for both DS and HOA
  • Loading branch information
firthm01 committed Feb 6, 2024
1 parent aec32eb commit b48078c
Showing 1 changed file with 16 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,6 @@ using namespace ear::plugin;

namespace {

adm::AudioChannelFormatId genAudioChannelFormatId(int typedefinition, int value) {
std::stringstream ss;
ss << "AC_"
<< std::setw(4) << std::setfill('0') << std::hex << typedefinition
<< std::setw(4) << std::setfill('0') << std::hex << value;
return adm::parseAudioChannelFormatId(ss.str());
}

adm::AudioPackFormatId genAudioPackFormatId(int typedefinition,
int value) {
std::stringstream ss;
ss << "AP_" << std::setw(4) << std::setfill('0') << std::hex << typedefinition
<< std::setw(4) << std::setfill('0') << std::hex << value;
return adm::parseAudioPackFormatId(ss.str());
}

template <typename T>
std::string int_to_hex(T i, size_t size) {
std::stringstream stream;
stream << std::setfill('0') << std::setw(size) << std::hex << i;
return stream.str();
}

constexpr auto const ADM_DEFAULT_AZ = 0.0f;
constexpr auto const ADM_DEFAULT_EL = 0.0f;
// constexpr auto const ADM_DEFAULT_D = 0.f;
Expand Down Expand Up @@ -396,14 +373,25 @@ void ProgrammeStoreAdmSerializer::createTopLevelObject(

}
else if (metadata.has_hoa_metadata() || metadata.has_ds_metadata()) {
int pfIdVal = metadata.has_ds_metadata()
? metadata.ds_metadata().packformatidvalue()
: metadata.hoa_metadata().packformatidvalue();

adm::AudioPackFormatId audioPackFormatID;
if (metadata.has_ds_metadata()) {
// DS
audioPackFormatID = adm::AudioPackFormatId(
adm::TypeDefinition::DIRECT_SPEAKERS,
adm::AudioPackFormatIdValue(
metadata.ds_metadata().packformatidvalue()));
} else {
// HOA
audioPackFormatID = adm::AudioPackFormatId(
adm::TypeDefinition::HOA,
adm::AudioPackFormatIdValue(
metadata.hoa_metadata().packformatidvalue()));
}

auto presets = AdmPresetDefinitionsHelper::getSingleton();
auto objectHolder = presets->addPresetDefinitionObjectTo(
doc, metadata.name(), genAudioPackFormatId(1, pfIdVal));

doc, metadata.name(), audioPackFormatID);
setInteractivity(*objectHolder.audioObject, object);
setImportance(*objectHolder.audioObject, object);
content.addReference(objectHolder.audioObject);
Expand Down

0 comments on commit b48078c

Please sign in to comment.