Initial work on removing storage of subtitle times.
[dcpomatic.git] / src / lib / config.h
index 80dfb1dc94d1bfd4da1376b750bf4caa3ce0abd3..a574cc261a21793a34b8fd7e967aa2c3328b1f6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -67,6 +67,8 @@ public:
                USE_ANY_SERVERS,
                SERVERS,
                CINEMAS,
+               PREVIEW_SOUND,
+               PREVIEW_SOUND_OUTPUT,
                OTHER
        };
 
@@ -306,6 +308,14 @@ public:
                return _jump_to_selected;
        }
 
+       bool preview_sound () const {
+               return _preview_sound;
+       }
+
+       boost::optional<std::string> preview_sound_output () const {
+               return _preview_sound_output;
+       }
+
        /** @param n New number of local encoding threads */
        void set_num_local_encoding_threads (int n) {
                maybe_set (_num_local_encoding_threads, n);
@@ -521,6 +531,25 @@ public:
                maybe_set (_confirm_kdm_email, s);
        }
 
+       void set_preview_sound (bool s) {
+               maybe_set (_preview_sound, s, PREVIEW_SOUND);
+       }
+
+       void set_preview_sound_output (std::string o)
+       {
+               maybe_set (_preview_sound_output, o, PREVIEW_SOUND_OUTPUT);
+       }
+
+       void unset_preview_sound_output ()
+       {
+               if (!_preview_sound_output) {
+                       return;
+               }
+
+               _preview_sound_output = boost::none;
+               changed ();
+       }
+
        void set_kdm_container_name_format (dcp::NameFormat n) {
                maybe_set (_kdm_container_name_format, n);
        }
@@ -550,7 +579,7 @@ public:
 
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
-       /** Emitted if ::read() failed on an existing Config file.  There is nothing
+       /** Emitted if read() failed on an existing Config file.  There is nothing
            a listener can do about it: this is just for information.
        */
        static boost::signals2::signal<void ()> FailedToLoad;
@@ -582,12 +611,21 @@ private:
        boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
 
        template <class T>
-       void maybe_set (T& member, T new_value) {
+       void maybe_set (T& member, T new_value, Property prop = OTHER) {
                if (member == new_value) {
                        return;
                }
                member = new_value;
-               changed ();
+               changed (prop);
+       }
+
+       template <class T>
+       void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
+               if (member && member.get() == new_value) {
+                       return;
+               }
+               member = new_value;
+               changed (prop);
        }
 
        /** number of threads to use for J2K encoding on the local machine */
@@ -670,6 +708,9 @@ private:
        dcp::NameFormat _dcp_metadata_filename_format;
        dcp::NameFormat _dcp_asset_filename_format;
        bool _jump_to_selected;
+       bool _preview_sound;
+       /** name of a specific sound output stream to use for preview, or empty to use the default */
+       boost::optional<std::string> _preview_sound_output;
 
        /** Singleton instance, or 0 */
        static Config* _instance;