Utilities

Object Creation

struct adm::SimpleObjectHolder

Simple holder used as return type for createSimpleObject() and addSimpleObjectTo().

Gives access to all elements created by createSimpleObject(). This exists basically to give quick and convenient direct access to the elements after creation.

Public Members

std::shared_ptr<AudioObject> audioObject
std::shared_ptr<AudioPackFormat> audioPackFormat
std::shared_ptr<AudioChannelFormat> audioChannelFormat
std::shared_ptr<AudioStreamFormat> audioStreamFormat
std::shared_ptr<AudioTrackFormat> audioTrackFormat
std::shared_ptr<AudioTrackUid> audioTrackUid
SimpleObjectHolder adm::createSimpleObject(const std::string &name)

Create AudioObject hierarchie for single TypeDefinition::OBJECTS-type element.

Creates an AudioObject including referenced AudioPackFormat and AudioChannelFormat of type TypeDefinition::OBJECTS, as well an AudioTrackUid, the referenced AudioTrackFormat and AudioStreamFormat of type FormatDefinition::PCM.

Parameters

name – Name that will be used for the created Audio{Object,PackFormat,ChannelFormat}.

SimpleObjectHolder adm::addSimpleObjectTo(std::shared_ptr<Document> document, const std::string &name)

Create and add AudioObject hierarchie for single TypeDefinition::OBJECTS-type element.

same as createSimpleObject, but the elements are automatically added to the given document

struct adm::SimpleCommonDefinitionsObjectHolder

Simple holder used as return type for addSimpleCommonDefinitionsObjectTo().

Gives access to all elements created by addSimpleCommonDefinitionsObjectTo(). This exists basically to give quick and convenient direct access to the elements after creation.

Public Members

std::shared_ptr<AudioObject> audioObject
std::map<std::string, std::shared_ptr<AudioTrackUid>> audioTrackUids

a mapping from the short speaker label (e.g. M+000) to the audioTrackUid

SimpleCommonDefinitionsObjectHolder adm::addSimpleCommonDefinitionsObjectTo(std::shared_ptr<Document> document, const std::string &name, const std::string &speakerLayout)

Create and add AudioObject with common definitions direct speakers channel bed to document.

Creates an AudioObject and corresponding AudioTrackUids and connects it to the common definition ADM elements for the given speaker layout. The created ADM elements are added to the given document.

See

adm::audioPackFormatLookupTable

Note

The document must already have the common definition elements added.

Parameters
  • document – The document where the AudioObject and the AudioTrackUids should be added to and whose common definition ADM elements should be used.

  • name – Name that will be used for the created AudioObject.

  • speakerLayout – Speaker layout which will be created. For possible values

SimpleCommonDefinitionsObjectHolder adm::addTailoredCommonDefinitionsObjectTo(std::shared_ptr<Document> document, const std::string &name, const adm::AudioPackFormatId packFormatId, const std::vector<adm::AudioTrackFormatId> &trackFormatIds, const std::vector<std::string> &speakerLabels)

Create and add AudioObject with common definitions direct speakers channel bed to document with a given channel order.

Creates an AudioObject and corresponding AudioTrackUids and connects it to the common definition ADM elements for the given speaker layout. The created ADM elements are added to the given document.

Note

The document must already have the common definition elements added.

Parameters
  • document – The document where the AudioObject and the AudioTrackUids should be added to and whose common definition ADM elements should be used.

  • name – Name that will be used for the created AudioObject.

  • packFormatIdAudioPackFormatId of the given layout.

  • trackFormatIds – AudioTrackFormatIds of all the speakers in the layout.

  • speakerLabels – Labels of all the speakers in the layout.

audioBlockFormat timing fixes

void adm::updateBlockFormatDurations(std::shared_ptr<Document> document)

Set or update durations of all AudioBlockFormats

This function provides essentially the same functionality as adm::updateBlockFormatDurations(std::shared_ptr<Document>, std::chrono::nanoseconds), with the only difference that the duration of the AudioProgramme will be to determine the lifetime of AudioObjects.

See

void updateBlockFormatDurations(std::shared_ptr<Document>, std::chrono::nanoseconds)

Parameters

document – The document to update, durations will be adapted in-place.

void adm::updateBlockFormatDurations(std::shared_ptr<Document> document, const Time &fileLength)

Set or update durations of all AudioBlockFormats

If an AudioChannelFormat has multiple AudioBlockFormats, all of them should have an rtime and a duration.

As these durations might be linked to the duration of referencing AudioObjects, the length of the parent AudioProgramme and/or the length of a BW64 file, it is hard or impossible to set the correct duration during AudioBlockFormat creation.

This utility function will update the AudioBlockFormat durations to match the lifetime of the referencing AudioObject(s) or, if not set, the length of the audio file given by fileLength.

An exception will be raised if there’s any ambiguity in the resulting duration, for example due to multiple AudioObjects with different durations referencing the same AudioChannelFormat. Differences between the duration of an AudioProgramme and fileLength will also be considered an error. If one of those error conditions is met (and an exception is raised), the adm::Document will remain unchanged.

See

void updateBlockFormatDurations(std::shared_ptr<Document>)

Parameters
  • document – The document to update, durations will be adapted in-place.

  • fileLength – The length of the BW64 audio file