summaryrefslogtreecommitdiff
path: root/src/lib/config.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-11-09 22:06:48 +0100
committerCarl Hetherington <cth@carlh.net>2022-11-09 22:06:48 +0100
commit2b7a83a4bb3a7874444629987f992fbef78cde86 (patch)
tree708fde94b1e1ae97f7db9e819c56eede22478e32 /src/lib/config.cc
parent2efbbc57d55fec1244f4ac3db949f0e7f90ceda5 (diff)
Support multiple audio APIs, allowing ALSA for Linux and ASIO for Windows (#2363).
Diffstat (limited to 'src/lib/config.cc')
-rw-r--r--src/lib/config.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 6984c4064..c51f729b8 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 = optional<string> ();
_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 Name 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());