Skip to content

Commit

Permalink
persist chosen audio device in config file #353
Browse files Browse the repository at this point in the history
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 <rkitover@gmail.com>
  • Loading branch information
rkitover committed Jan 24, 2019
1 parent d94d6d5 commit 4f90031
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/wx/guiinit.cpp
Expand Up @@ -1571,6 +1571,7 @@ static class SoundConfig_t : public wxEvtHandler {
if (newapi == lastapi)
return;

gopts.audio_dev = "";
FillDev(newapi);
}
} sound_config_handler;
Expand Down
1 change: 1 addition & 0 deletions src/wx/opts.cpp
Expand Up @@ -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),
Expand Down

0 comments on commit 4f90031

Please sign in to comment.