Merge master.
[dcpomatic.git] / src / lib / audio_mapping.h
index 9a507b550e958a8d0928adf2f1a9733eb79db708..a76d83a370f703dceded47e1d5aff6e90cd472e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
+/** @file  src/lib/audio_mapping.h
+ *  @brief AudioMapping class.
+ */
+
 #ifndef DCPOMATIC_AUDIO_MAPPING_H
 #define DCPOMATIC_AUDIO_MAPPING_H
 
-#include <list>
-#include <libdcp/types.h>
+#include <vector>
 #include <boost/shared_ptr.hpp>
+#include <dcp/types.h>
+#include <libcxml/cxml.h>
 
 namespace xmlpp {
        class Node;
@@ -32,39 +37,40 @@ namespace cxml {
        class Node;
 }
 
-/** A many-to-many mapping from some content channels to DCP channels.
+/** @class AudioMapping.
+ *  @brief 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 can be mapped to zero or
- *  more DCP channels.
+ *  and then each of those content channels are mapped to each DCP channel
+ *  by a linear gain.
  */
 class AudioMapping
 {
 public:
        AudioMapping ();
-       AudioMapping (int);
-       AudioMapping (boost::shared_ptr<const cxml::Node>);
+       AudioMapping (int channels);
+       AudioMapping (cxml::ConstNodePtr, int);
 
        /* Default copy constructor is fine */
        
        void as_xml (xmlpp::Node *) const;
 
-       void add (int, libdcp::Channel);
        void make_default ();
 
-       std::list<int> dcp_to_content (libdcp::Channel) const;
-       std::list<std::pair<int, libdcp::Channel> > content_to_dcp () const {
-               return _content_to_dcp;
-       }
+       void set (int, dcp::Channel, float);
+       float get (int, dcp::Channel) const;
 
        int content_channels () const {
                return _content_channels;
        }
-       
-       std::list<libdcp::Channel> content_to_dcp (int) const;
 
+       std::string digest () const;
+       
 private:
+       void setup (int);
+       
        int _content_channels;
-       std::list<std::pair<int, libdcp::Channel> > _content_to_dcp;
+       std::vector<std::vector<float> > _gain;
 };
 
 #endif