Support multiple audio APIs, allowing ALSA for Linux and ASIO for Windows (#2363).
[dcpomatic.git] / src / lib / config.h
index 9e84a120b822755bf667e32b024ba16374bc9537..a91d58e641b5c9d5f89e8c0d57070eb50bb7b655 100644 (file)
@@ -86,6 +86,7 @@ public:
                CINEMAS,
                DKDM_RECIPIENTS,
                SOUND,
+               SOUND_API,
                SOUND_OUTPUT,
                PLAYER_CONTENT_DIRECTORY,
                PLAYER_PLAYLIST_DIRECTORY,
@@ -440,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;
        }
@@ -906,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);
        }
@@ -922,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);
        }
@@ -1356,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;