aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-06-30 16:15:15 -0700
committerChris Robinson <[email protected]>2019-06-30 16:40:08 -0700
commit3658dafdcbbd114caaf81cb27cf6ccc07045b0aa (patch)
tree01065f3aeb473a8b65aee6032e718cbe1e62eb9f /Alc/panning.cpp
parentdb026454f28f93fe7c38dc84a79813a59afeb1d0 (diff)
Use an optional for ConfigValueStr
Diffstat (limited to 'Alc/panning.cpp')
-rw-r--r--Alc/panning.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index 864d7f28..aa290821 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -553,9 +553,9 @@ void InitHrtfPanning(ALCdevice *device)
*/
device->mRenderMode = HrtfRender;
ALsizei ambi_order{1};
- const char *mode;
- if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "hrtf-mode", &mode))
+ if(auto modeopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "hrtf-mode"))
{
+ const char *mode{modeopt->c_str()};
if(strcasecmp(mode, "basic") == 0)
{
ERR("HRTF mode \"%s\" deprecated, substituting \"%s\"\n", mode, "ambi2");
@@ -783,11 +783,10 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr
AmbDecConf conf{};
if(layout)
{
- const char *fname;
- if(ConfigValueStr(devname, "decoder", layout, &fname))
+ if(auto decopt = ConfigValueStr(devname, "decoder", layout))
{
- if(!conf.load(fname))
- ERR("Failed to load layout file %s\n", fname);
+ if(!conf.load(decopt->c_str()))
+ ERR("Failed to load layout file %s\n", decopt->c_str());
else if(conf.Speakers.size() > MAX_OUTPUT_CHANNELS)
ERR("Unsupported speaker count %zu (max %d)\n", conf.Speakers.size(),
MAX_OUTPUT_CHANNELS);
@@ -814,9 +813,9 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr
bool headphones{device->IsHeadphones != AL_FALSE};
if(device->Type != Loopback)
{
- const char *mode;
- if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-mode", &mode))
+ if(auto modeopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-mode"))
{
+ const char *mode{modeopt->c_str()};
if(strcasecmp(mode, "headphones") == 0)
headphones = true;
else if(strcasecmp(mode, "speakers") == 0)
@@ -916,9 +915,9 @@ no_hrtf:
}
}
- const char *mode;
- if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-encoding", &mode))
+ if(auto encopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-encoding"))
{
+ const char *mode{encopt->c_str()};
if(strcasecmp(mode, "uhj") == 0)
device->mRenderMode = NormalRender;
else if(strcasecmp(mode, "panpot") != 0)