summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-11-10 00:40:58 +0100
committerCarl Hetherington <cth@carlh.net>2022-11-13 00:12:26 +0100
commit5f9aff54d9b082ffa9a5635300c6acc219f714e8 (patch)
tree95de55d0e43a31c2347720a7f9a363182417fcf9
parent91731a7c64af332acfebe45570cefbb7f3f16b64 (diff)
Add PreviewSoundAPI to config.
-rw-r--r--src/lib/config.cc6
-rw-r--r--src/lib/config.h19
2 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 05e509251..70addc21d 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -152,6 +152,7 @@ Config::set_defaults ()
_nagged[i] = false;
}
_sound = true;
+ _sound_api = boost::none;
_sound_output = boost::none;
_last_kdm_write_type = KDM_WRITE_FLAT;
_last_dkdm_write_type = DKDM_WRITE_INTERNAL;
@@ -523,6 +524,7 @@ try
_jump_to_selected = f.optional_bool_child("JumpToSelected").get_value_or (true);
/* The variable was renamed but not the XML tag */
_sound = f.optional_bool_child("PreviewSound").get_value_or (true);
+ _sound_api = f.optional_string_child("PreviewSoundAPI");
_sound_output = f.optional_string_child("PreviewSoundOutput");
if (f.optional_string_child("CoverSheet")) {
_cover_sheet = f.optional_string_child("CoverSheet").get();
@@ -938,6 +940,10 @@ Config::write_config () const
}
/* [XML] PreviewSound 1 to use sound in the GUI preview and player, otherwise 0. */
root->add_child("PreviewSound")->add_child_text (_sound ? "1" : "0");
+ if (_sound_api) {
+ /* [XML:opt] PreviewSoundAPI ID of the audio API to use. */
+ root->add_child("PreviewSoundAPI")->add_child_text(_sound_api.get());
+ }
if (_sound_output) {
/* [XML:opt] PreviewSoundOutput Name of the audio output to use. */
root->add_child("PreviewSoundOutput")->add_child_text (_sound_output.get());
diff --git a/src/lib/config.h b/src/lib/config.h
index 463eec47e..a91d58e64 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -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,6 +911,19 @@ 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);
}
@@ -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;