Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ jobs:
uses: lukka/get-cmake@latest

- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@v7
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgArguments: 'boost-variant boost-optional boost-format boost-functional boost-range boost-iterator boost-rational'
vcpkgTriplet: '${{ matrix.triplet }}'
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
vcpkgGitCommitId: '7ad236f60f5f7197e93c4d7f0807622f4899076d'
vcpkgGitCommitId: 'b46d9050a9d40d54d24cac3ef8d50402d421f598'

# Setup MSVC environment on windows, otherwise we get minsys2 / gcc
- uses: ilammy/msvc-dev-cmd@v1

- name: 'Install ubuntu dependencies'
if: matrix.os == 'ubuntu-latest'
Expand Down
49 changes: 42 additions & 7 deletions include/adm/document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,29 @@ namespace adm {
namespace detail {
extern template class ADM_EXPORT_TEMPLATE_METHODS
OptionalParameter<Version>;
extern template class ADM_EXPORT_TEMPLATE_METHODS
OptionalParameter<TagList>;
extern template class ADM_EXPORT_TEMPLATE_METHODS
OptionalParameter<ProfileList>;

using DocumentBase = HasParameters<OptionalParameter<Version>>;
using DocumentBase =
HasParameters<OptionalParameter<Version>, OptionalParameter<TagList>,
OptionalParameter<ProfileList>>;
} // namespace detail

/**
* @brief Class representation of a whole ADM document
*
* \rst
* +---------------+-----------------+----------------------------+
* | ADM Parameter | Parameter Type | Pattern Type |
* +===============+=================+============================+
* | version | :type:`Version` | :class:`OptionalParameter` |
* +---------------+-----------------+----------------------------+
* +---------------+---------------------+----------------------------+
* | ADM Parameter | Parameter Type | Pattern Type |
* +===============+=====================+============================+
* | version | :type:`Version` | :class:`OptionalParameter` |
* +---------------+---------------------+----------------------------+
* | tagList | :type:`TagList` | :class:`OptionalParameter` |
* +---------------+---------------------+----------------------------+
* | profileList | :type:`ProfileList` | :class:`OptionalParameter` |
* +---------------+---------------------+----------------------------+
* \endrst
*
* Note that:
Expand Down Expand Up @@ -86,6 +96,15 @@ namespace adm {
*
* References from and to the ADM element will automatically be removed
* too.
*
* Additional side effects:
* - removing an AudioProgramme, AudioContent, or AudioObject prunes
* TagGroup entries in tagList that reference the removed element
* - If the TagList becomes empty due to pruning, the list itself is
* removed as it is only valid when it contains 1 or more TagGroups
* - removing an AudioPackFormat or AudioObject also removes matching
* renderer/referenceLayout ID references in nested
* authoringInformation/loudnessMetadata structures.
*/
///@{
/// @brief Remove an AudioProgramme
Expand Down Expand Up @@ -236,6 +255,23 @@ namespace adm {
using detail::AddWrapperMethods<Document>::isDefault;
using detail::AddWrapperMethods<Document>::unset;

/**
* @brief Set the document's tagList.
*
* Each TagGroup's audioProgramme/audioContent/audioObject references are
* validated against the document:
* * if a referenced element already belongs to a *different* document,
* the document is left unmodified and `false` is returned;
* * if a referenced element is not yet attached to any document, it is
* added to this document (mirroring the auto-add behaviour of
* `Document::add(...)` for nested references);
* * elements already belonging to this document are left untouched.
*
* @return `true` on success, `false` if any reference belongs to another
* document.
*/
ADM_EXPORT bool set(TagList tagList);

private:
ADM_EXPORT Document();
ADM_EXPORT Document(const Document &) = default;
Expand Down Expand Up @@ -316,5 +352,4 @@ namespace adm {
typedef typename detail::ParameterTraits<Element>::tag Tag;
return getElements(Tag());
}

} // namespace adm
3 changes: 3 additions & 0 deletions include/adm/elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "adm/elements/audio_stream_format.hpp"
#include "adm/elements/audio_track_uid.hpp"
#include "adm/elements/profile_list.hpp"
#include "adm/elements/tag_list.hpp"

#include "adm/elements/audio_block_format_direct_speakers.hpp"
#include "adm/elements/audio_block_format_matrix.hpp"
Expand All @@ -48,6 +49,8 @@

#include "adm/elements/time.hpp"
#include "adm/elements/audio_programme_ref_screen.hpp"
#include "adm/elements/authoring_information.hpp"
#include "adm/elements/cartesian.hpp"
#include "adm/elements/channel_lock.hpp"
#include "adm/elements/dialogue.hpp"
#include "adm/elements/format_descriptor.hpp"
Expand Down
14 changes: 14 additions & 0 deletions include/adm/elements/audio_block_format_direct_speakers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace adm {
* +---------------------+------------------------------------+----------------------------+
* | initializeBlock | :type:`InitializeBlock` | :class:`OptionalParameter` |
* +---------------------+------------------------------------+----------------------------+
* | cartesian | :type:`Cartesian` | custom, see below |
* +---------------------+------------------------------------+----------------------------+
* | position | - :type:`SpeakerPosition` | :class:`VariantParameter` |
* | | - :type:`SphericalSpeakerPosition` | |
* | | - :type:`CartesianSpeakerPosition` | :class:`RequiredParameter` |
Expand All @@ -83,6 +85,11 @@ namespace adm {
* | speakerLabel | :type:`SpeakerLabels` | :class:`VectorParameter` |
* +---------------------+------------------------------------+----------------------------+
* \endrst
*
* ``cartesian`` and ``position`` attributes are linked; see
* :func:`void set(Cartesian)`, :func:`void set(SpeakerPosition)`,
* :func:`void set(CartesianSpeakerPosition)` and
* :func:`void set(SphericalSpeakerPosition)`.
*
* @warning not all methods are implemented for speakerLabel
*/
Expand Down Expand Up @@ -138,6 +145,8 @@ namespace adm {
ADM_EXPORT void set(Rtime rtime);
/// @brief Duration setter
ADM_EXPORT void set(Duration duration);
/// @brief Cartesian setter
ADM_EXPORT void set(Cartesian cartesian);
/// @brief CartesianSpeakerPosition setter
ADM_EXPORT void set(CartesianSpeakerPosition speakerPosition);
/// @brief SphericalSpeakerPosition setter
Expand Down Expand Up @@ -174,6 +183,7 @@ namespace adm {
ADM_EXPORT Duration get(detail::ParameterTraits<Duration>::tag) const;
ADM_EXPORT SpeakerLabels
get(detail::ParameterTraits<SpeakerLabels>::tag) const;
ADM_EXPORT Cartesian get(detail::ParameterTraits<Cartesian>::tag) const;
ADM_EXPORT CartesianSpeakerPosition
get(detail::ParameterTraits<CartesianSpeakerPosition>::tag) const;
ADM_EXPORT SphericalSpeakerPosition
Expand All @@ -183,6 +193,7 @@ namespace adm {
ADM_EXPORT bool has(detail::ParameterTraits<Rtime>::tag) const;
ADM_EXPORT bool has(detail::ParameterTraits<Duration>::tag) const;
ADM_EXPORT bool has(detail::ParameterTraits<SpeakerLabels>::tag) const;
ADM_EXPORT bool has(detail::ParameterTraits<Cartesian>::tag) const;
ADM_EXPORT bool has(
detail::ParameterTraits<CartesianSpeakerPosition>::tag) const;
ADM_EXPORT bool has(
Expand All @@ -192,15 +203,18 @@ namespace adm {
bool isDefault(Tag) const {
return false;
}
ADM_EXPORT bool isDefault(detail::ParameterTraits<Cartesian>::tag) const;

ADM_EXPORT void unset(detail::ParameterTraits<Rtime>::tag);
ADM_EXPORT void unset(detail::ParameterTraits<Duration>::tag);
ADM_EXPORT void unset(detail::ParameterTraits<SpeakerLabels>::tag);
ADM_EXPORT void unset(detail::ParameterTraits<Cartesian>::tag);

AudioBlockFormatId id_;
boost::optional<Rtime> rtime_;
boost::optional<Duration> duration_;
SpeakerLabels speakerLabels_;
boost::optional<Cartesian> cartesian_;
SpeakerPosition speakerPosition_;
};

Expand Down
5 changes: 0 additions & 5 deletions include/adm/elements/audio_block_format_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
namespace adm {

class Document;

/// @brief Tag for NamedType ::Cartesian
struct CartesianTag {};
/// @brief NamedType for cartesian parameter
using Cartesian = detail::NamedType<bool, CartesianTag>;
/// @brief Tag for NamedType ::Width
struct WidthTag {};
/// @brief NamedType for width parameter
Expand Down
2 changes: 1 addition & 1 deletion include/adm/elements/audio_channel_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ namespace adm {
return previous == 0u || current == previous.get() + 1u;
}
}

template <typename BlockFormat>
void AudioChannelFormat::assignId(BlockFormat &blockFormat,
BlockFormat *previousBlock) {
Expand Down
9 changes: 9 additions & 0 deletions include/adm/elements/audio_programme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "adm/elements/audio_content.hpp"
#include "adm/elements/audio_programme_id.hpp"
#include "adm/elements/audio_programme_ref_screen.hpp"
#include "adm/elements/authoring_information.hpp"
#include "adm/elements/loudness_metadata.hpp"
#include "adm/elements_fwd.hpp"
#include "adm/helper/element_range.hpp"
Expand Down Expand Up @@ -158,6 +159,8 @@ namespace adm {
ADM_EXPORT void set(MaxDuckingDepth depth);
/// @brief AudioProgrammeReferenceScreen setter
ADM_EXPORT void set(AudioProgrammeReferenceScreen refScreen);
/// @brief AuthoringInformation setter
ADM_EXPORT void set(AuthoringInformation authoringInformation);

/**
* @brief ADM parameter unset template
Expand Down Expand Up @@ -237,6 +240,8 @@ namespace adm {
get(detail::ParameterTraits<MaxDuckingDepth>::tag) const;
ADM_EXPORT AudioProgrammeReferenceScreen
get(detail::ParameterTraits<AudioProgrammeReferenceScreen>::tag) const;
ADM_EXPORT AuthoringInformation
get(detail::ParameterTraits<AuthoringInformation>::tag) const;

ADM_EXPORT bool has(detail::ParameterTraits<AudioProgrammeId>::tag) const;
ADM_EXPORT bool has(detail::ParameterTraits<AudioProgrammeName>::tag) const;
Expand All @@ -247,6 +252,8 @@ namespace adm {
ADM_EXPORT bool has(detail::ParameterTraits<MaxDuckingDepth>::tag) const;
ADM_EXPORT bool has(
detail::ParameterTraits<AudioProgrammeReferenceScreen>::tag) const;
ADM_EXPORT bool has(
detail::ParameterTraits<AuthoringInformation>::tag) const;

template <typename Tag>
bool isDefault(Tag) const {
Expand All @@ -261,6 +268,7 @@ namespace adm {
ADM_EXPORT void unset(detail::ParameterTraits<MaxDuckingDepth>::tag);
ADM_EXPORT void unset(
detail::ParameterTraits<AudioProgrammeReferenceScreen>::tag);
ADM_EXPORT void unset(detail::ParameterTraits<AuthoringInformation>::tag);

ADM_EXPORT ElementRange<const AudioContent> getReferences(
detail::ParameterTraits<AudioContent>::tag) const;
Expand All @@ -283,6 +291,7 @@ namespace adm {
std::vector<std::shared_ptr<AudioContent>> audioContents_;
boost::optional<MaxDuckingDepth> maxDuckingDepth_;
boost::optional<AudioProgrammeReferenceScreen> refScreen_;
boost::optional<AuthoringInformation> authoringInformation_;
};
///@}

Expand Down
45 changes: 38 additions & 7 deletions include/adm/elements/audio_programme_ref_screen.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
#pragma once
#include <ostream>
#include "adm/detail/auto_base.hpp"
#include "adm/detail/named_option_helper.hpp"
#include "adm/elements/coordinate_mode.hpp"
#include "adm/export.h"

namespace adm {

struct AudioProgrammeReferenceScreenTag {};

class AudioProgrammeReferenceScreen {
namespace detail {
using AudioProgrammeReferenceScreenBase =
HasParameters<OptionalParameter<CoordinateMode>>;
} // namespace detail

class AudioProgrammeReferenceScreen
: private detail::AudioProgrammeReferenceScreenBase,
private detail::AddWrapperMethods<AudioProgrammeReferenceScreen> {
public:
typedef AudioProgrammeReferenceScreenTag tag;
using tag = AudioProgrammeReferenceScreenTag;

template <typename... Parameters>
explicit AudioProgrammeReferenceScreen(Parameters... namedArgs) {
detail::setNamedOptionHelper(this, std::move(namedArgs)...);
}

using detail::AudioProgrammeReferenceScreenBase::set;
using detail::AddWrapperMethods<AudioProgrammeReferenceScreen>::get;
using detail::AddWrapperMethods<AudioProgrammeReferenceScreen>::has;
using detail::AddWrapperMethods<AudioProgrammeReferenceScreen>::isDefault;
using detail::AddWrapperMethods<AudioProgrammeReferenceScreen>::unset;

void print(std::ostream &os) const {
os << "(";
if (has<CoordinateMode>()) {
os << "coordinateMode=" << get<CoordinateMode>();
}
os << ")";
}

AudioProgrammeReferenceScreen() {}
private:
using detail::AudioProgrammeReferenceScreenBase::get;
using detail::AudioProgrammeReferenceScreenBase::has;
using detail::AudioProgrammeReferenceScreenBase::isDefault;
using detail::AudioProgrammeReferenceScreenBase::unset;

/**
* @brief Print overview to ostream
*/
void print(std::ostream &os) const { os << "()"; };
friend class detail::AddWrapperMethods<AudioProgrammeReferenceScreen>;
};

} // namespace adm
Loading
Loading