From 4f9003112dee651d94ab8e0f8b6141ea276add82 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 24 Jan 2019 03:14:23 -0800 Subject: [PATCH] persist chosen audio device in config file #353 Write `gopts.audio_dev` to the option `Sound/AudioDevice`. Clear `gopts.audio_dev` when resetting the driver, because we cannot assume anything about device enumeration order across sound drivers. Signed-off-by: Rafael Kitover --- src/wx/guiinit.cpp | 1 + src/wx/opts.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index afb1f0b0..c26d55dd 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -1571,6 +1571,7 @@ public: if (newapi == lastapi) return; + gopts.audio_dev = ""; FillDev(newapi); } } sound_config_handler; diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index 5391704c..d67c560c 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -261,6 +261,7 @@ opt_desc opts[] = { /// Sound ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal|directsound|xaudio2|faudio")), + STROPT("Sound/AudioDevice", "", wxTRANSLATE("Device ID of chosen audio device for chosen driver"), gopts.audio_dev), INTOPT("Sound/Buffers", "", wxTRANSLATE("Number of sound buffers"), gopts.audio_buffers, 2, 10), INTOPT("Sound/Enable", "", wxTRANSLATE("Bit mask of sound channels to enable"), gopts.sound_en, 0, 0x30f), INTOPT("Sound/GBAFiltering", "", wxTRANSLATE("GBA sound filtering (%)"), gopts.gba_sound_filter, 0, 100),