aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-12 03:59:52 -0700
committerChris Robinson <[email protected]>2019-08-12 03:59:52 -0700
commit1aaf65abfecbde8548f90b1d0b0308b21bd0776d (patch)
tree767a9d1c72bd78ea572890286be92a866033f36e /alc/backends
parent50d16d2422febe2f4f56e7f29794778b10606b3a (diff)
Add methods to get env vars as an optional
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/pulseaudio.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index ca2ecb43..499a192f 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -40,6 +40,7 @@
#include "alexcpt.h"
#include "compat.h"
#include "dynload.h"
+#include "strutils.h"
#include <pulse/pulseaudio.h>
@@ -855,8 +856,8 @@ ALCenum PulsePlayback::open(const ALCchar *name)
if(!pulse_name)
{
- pulse_name = getenv("ALSOFT_PULSE_DEFAULT");
- if(pulse_name && !pulse_name[0]) pulse_name = nullptr;
+ static const auto defname = al::getenv("ALSOFT_PULSE_DEFAULT");
+ if(defname) pulse_name = defname->c_str();
}
TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)");
mStream = pulse_connect_stream(pulse_name, plock, mContext, flags, nullptr, &spec, nullptr,