diff options
author | Chris Robinson <[email protected]> | 2019-08-12 03:59:52 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-12 03:59:52 -0700 |
commit | 1aaf65abfecbde8548f90b1d0b0308b21bd0776d (patch) | |
tree | 767a9d1c72bd78ea572890286be92a866033f36e /alc/alu.cpp | |
parent | 50d16d2422febe2f4f56e7f29794778b10606b3a (diff) |
Add methods to get env vars as an optional
Diffstat (limited to 'alc/alu.cpp')
-rw-r--r-- | alc/alu.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 8cef4228..aebb2236 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -73,6 +73,7 @@ #include "mixer/defs.h" #include "opthelpers.h" #include "ringbuffer.h" +#include "strutils.h" #include "threads.h" #include "uhjfilter.h" #include "vecmat.h" @@ -87,18 +88,22 @@ using namespace std::placeholders; ALfloat InitConeScale() { ALfloat ret{1.0f}; - const char *str{getenv("__ALSOFT_HALF_ANGLE_CONES")}; - if(str && (strcasecmp(str, "true") == 0 || strtol(str, nullptr, 0) == 1)) - ret *= 0.5f; + if(auto optval = al::getenv("__ALSOFT_HALF_ANGLE_CONES")) + { + if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + ret *= 0.5f; + } return ret; } ALfloat InitZScale() { ALfloat ret{1.0f}; - const char *str{getenv("__ALSOFT_REVERSE_Z")}; - if(str && (strcasecmp(str, "true") == 0 || strtol(str, nullptr, 0) == 1)) - ret *= -1.0f; + if(auto optval = al::getenv("__ALSOFT_REVERSE_Z")) + { + if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + ret *= -1.0f; + } return ret; } |