X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_mapping.h;h=b0b75ac063372c8f258dc235a6675f44ad2b8e81;hb=491daf8790f35611052d8954d5d74df275dcda18;hp=4f2cdb7f83f9c454d855d748c7ca70d193933405;hpb=d62877ae6c4e316e43f4052e4b9ba673610012cf;p=dcpomatic.git diff --git a/src/lib/audio_mapping.h b/src/lib/audio_mapping.h index 4f2cdb7f8..b0b75ac06 100644 --- a/src/lib/audio_mapping.h +++ b/src/lib/audio_mapping.h @@ -17,46 +17,53 @@ */ -#ifndef DVDOMATIC_AUDIO_MAPPING_H -#define DVDOMATIC_AUDIO_MAPPING_H +#ifndef DCPOMATIC_AUDIO_MAPPING_H +#define DCPOMATIC_AUDIO_MAPPING_H -#include -#include +#include #include #include -#include "audio_content.h" +namespace xmlpp { + class Node; +} + +namespace cxml { + class Node; +} + +/** A many-to-many mapping from some content channels to DCP channels. + * The number of content channels is set on construction and fixed, + * and then each of those content channels are mapped to each DCP channel + * by a linear gain. + */ class AudioMapping { public: - void as_xml (xmlpp::Node *) const; - void set_from_xml (ContentList const &, boost::shared_ptr); + AudioMapping (); + AudioMapping (int); + AudioMapping (boost::shared_ptr, int); + + /* Default copy constructor is fine */ - struct Channel { - Channel (boost::weak_ptr c, int i) - : content (c) - , index (i) - {} - - boost::weak_ptr content; - int index; - }; - - void add (Channel, libdcp::Channel); - - int dcp_channels () const; - std::list dcp_to_content (libdcp::Channel) const; - std::list > content_to_dcp () const { - return _content_to_dcp; - } + void as_xml (xmlpp::Node *) const; - std::list content_channels () const; - std::list content_to_dcp (Channel) const; + void make_default (); + void set (int, libdcp::Channel, float); + float get (int, libdcp::Channel) const; + + int content_channels () const { + return _content_channels; + } + + std::string digest () const; + private: - std::list > _content_to_dcp; + void setup (int); + + int _content_channels; + std::vector > _gain; }; -extern bool operator== (AudioMapping::Channel const &, AudioMapping::Channel const &); - #endif