Utilities

struct SimpleObjectHolder

Simple holder used as return type for createSimpleObject().

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)

AudioObject hierarchie creation 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}.

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, std::chrono::nanoseconds 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