From 752e89a268e5ac334ce1e8d37abe4a3bca93ef14 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 7 Apr 2012 15:28:38 -0700 Subject: [PATCH] Add a setting to select the sound device name --- apps/openmw/mwsound/soundmanager.cpp | 15 ++++++++++++++- files/settings-default.cfg | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index eaa18e6dcd..a09a4b0563 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -7,6 +7,7 @@ #include #include +#include #include "../mwworld/environment.hpp" #include "../mwworld/world.hpp" @@ -64,7 +65,19 @@ namespace MWSound for(size_t i = 0;i < names.size();i++) std::cout <<" "<init(); + std::string devname = Settings::Manager::getString("device", "Sound"); + try + { + mOutput->init(devname); + } + catch(std::exception &e) + { + if(devname.empty()) + throw; + std::cout <<"Failed to open device \""<init(); + Settings::Manager::setString("device", "Sound", ""); + } } catch(std::exception &e) { diff --git a/files/settings-default.cfg b/files/settings-default.cfg index f616471cce..71637c326d 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -53,3 +53,7 @@ fog end factor = 1.0 [Terrain] # Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight num lights = 8 + +[Sound] +# Device name. Blank means default +device =