Support multiple audio APIs, allowing ALSA for Linux and ASIO for Windows (#2363).
[dcpomatic.git] / src / lib / config.h
index 9c3650f8d00af1d8cfb0f6f2b2ad1cf33136942a..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;
@@ -174,6 +179,10 @@ public:
                return _allow_96khz_audio;
        }
 
+       bool use_all_audio_channels () const {
+               return _use_all_audio_channels;
+       }
+
        bool show_experimental_audio_processors () const {
                return _show_experimental_audio_processors;
        }
@@ -432,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;
        }
@@ -582,6 +595,18 @@ public:
                return _auto_crop_threshold;
        }
 
+       boost::optional<std::string> last_release_notes_version () const {
+               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) {
@@ -613,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);
@@ -669,6 +698,10 @@ public:
                maybe_set (_allow_96khz_audio, a);
        }
 
+       void set_use_all_audio_channels (bool a) {
+               maybe_set (_use_all_audio_channels, a);
+       }
+
        void set_show_experimental_audio_processors (bool e) {
                maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
        }
@@ -878,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);
        }
@@ -894,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);
        }
@@ -1114,16 +1160,37 @@ public:
                maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
        }
 
+       void set_last_release_notes_version (std::string version) {
+               maybe_set (_last_release_notes_version, version);
+       }
+
+       void unset_last_release_notes_version() {
+               maybe_set(_last_release_notes_version, boost::optional<std::string>());
+       }
+
        ExportConfig& export_config() {
                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
@@ -1184,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 ();
@@ -1212,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 */
@@ -1230,6 +1301,7 @@ private:
        */
        bool _allow_any_container;
        bool _allow_96khz_audio;
+       bool _use_all_audio_channels;
        /** Offer the upmixers in the audio processor settings */
        bool _show_experimental_audio_processors;
        boost::optional<std::string> _language;
@@ -1302,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;
@@ -1340,6 +1413,9 @@ private:
        dcp::Formulation _default_kdm_type;
        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;