Support multiple audio APIs, allowing ALSA for Linux and ASIO for Windows (#2363).
[dcpomatic.git] / src / lib / config.h
index 8f1029910ec51822441e5331a07ce1b0d9d99320..a91d58e641b5c9d5f89e8c0d57070eb50bb7b655 100644 (file)
@@ -86,6 +86,7 @@ public:
                CINEMAS,
                DKDM_RECIPIENTS,
                SOUND,
+               SOUND_API,
                SOUND_OUTPUT,
                PLAYER_CONTENT_DIRECTORY,
                PLAYER_PLAYLIST_DIRECTORY,
@@ -130,6 +131,10 @@ public:
                return _tms_protocol;
        }
 
+       bool tms_passive() const {
+               return _tms_passive;
+       }
+
        /** @return The IP address of a TMS that we can copy DCPs to */
        std::string tms_ip () const {
                return _tms_ip;
@@ -436,6 +441,10 @@ public:
                return _cover_sheet;
        }
 
+       boost::optional<std::string> sound_api() const {
+               return _sound_api;
+       }
+
        boost::optional<std::string> sound_output () const {
                return _sound_output;
        }
@@ -590,6 +599,14 @@ public:
                return _last_release_notes_version;
        }
 
+       boost::optional<int> main_divider_sash_position() const {
+               return _main_divider_sash_position;
+       }
+
+       boost::optional<int> main_content_divider_sash_position() const {
+               return _main_content_divider_sash_position;
+       }
+
        /* SET (mostly) */
 
        void set_master_encoding_threads (int n) {
@@ -621,6 +638,10 @@ public:
                maybe_set (_tms_protocol, p);
        }
 
+       void set_tms_passive(bool passive) {
+               maybe_set(_tms_passive, passive);
+       }
+
        /** @param i IP address of a TMS that we can copy DCPs to */
        void set_tms_ip (std::string i) {
                maybe_set (_tms_ip, i);
@@ -890,10 +911,32 @@ public:
                maybe_set (_sound, s, SOUND);
        }
 
+       void set_sound_api(std::string api) {
+               maybe_set(_sound_api, api, SOUND_API);
+       }
+
+       void unset_sound_api() {
+               if (!_sound_api) {
+                       return;
+               }
+
+               _sound_api = boost::none;
+               changed(SOUND_API);
+       }
+
        void set_sound_output (std::string o) {
                maybe_set (_sound_output, o, SOUND_OUTPUT);
        }
 
+       void unset_sound_output() {
+               if (!_sound_output) {
+                       return;
+               }
+
+               _sound_output = boost::none;
+               changed(SOUND_OUTPUT);
+       }
+
        void set_last_player_load_directory (boost::filesystem::path d) {
                maybe_set (_last_player_load_directory, d);
        }
@@ -906,15 +949,6 @@ public:
                maybe_set (_last_dkdm_write_type, t);
        }
 
-       void unset_sound_output () {
-               if (!_sound_output) {
-                       return;
-               }
-
-               _sound_output = boost::none;
-               changed ();
-       }
-
        void set_kdm_container_name_format (dcp::NameFormat n) {
                maybe_set (_kdm_container_name_format, n);
        }
@@ -1138,12 +1172,25 @@ public:
                return _export;
        }
 
+       void set_main_divider_sash_position(int position) {
+               maybe_set(_main_divider_sash_position, position);
+       }
+
+       void set_main_content_divider_sash_position(int position) {
+               maybe_set(_main_content_divider_sash_position, position);
+       }
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** 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;
+       enum class LoadFailure {
+               CONFIG,
+               CINEMAS,
+               DKDM_RECIPIENTS
+       };
+       static boost::signals2::signal<void (LoadFailure)> FailedToLoad;
        /** Emitted if read() issued a warning which the user might want to know about */
        static boost::signals2::signal<void (std::string)> Warning;
        /** Emitted if there is a something wrong the contents of our config.  Handler can call
@@ -1204,6 +1251,9 @@ public:
 private:
        Config ();
        void read () override;
+       void read_config();
+       void read_cinemas();
+       void read_dkdm_recipients();
        void set_defaults ();
        void set_kdm_email_to_default ();
        void set_notification_email_to_default ();
@@ -1232,6 +1282,7 @@ private:
        std::vector<std::string> _servers;
        bool _only_servers_encode;
        FileTransferProtocol _tms_protocol;
+       bool _tms_passive;
        /** The IP address of a TMS that we can copy DCPs to */
        std::string _tms_ip;
        /** The path on a TMS that we should write DCPs to */
@@ -1323,6 +1374,7 @@ private:
        bool _jump_to_selected;
        bool _nagged[NAG_COUNT];
        bool _sound;
+       boost::optional<std::string> _sound_api;
        /** name of a specific sound output stream to use, or empty to use the default */
        boost::optional<std::string> _sound_output;
        std::string _cover_sheet;
@@ -1362,6 +1414,8 @@ private:
        RoughDuration _default_kdm_duration;
        double _auto_crop_threshold;
        boost::optional<std::string> _last_release_notes_version;
+       boost::optional<int> _main_divider_sash_position;
+       boost::optional<int> _main_content_divider_sash_position;
 
        ExportConfig _export;