diff options
author | Chris Robinson <[email protected]> | 2019-06-30 12:00:10 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-30 16:40:08 -0700 |
commit | 51f53afe12719513b3736a1c73e7de98d7e301ca (patch) | |
tree | 00cb8385163adde88f41b21a322813e5cffec7db /Alc/backends | |
parent | 689f70ce6d6b27ea2ccf7463e79dfefe5ce35899 (diff) |
Use an optional for ConfigValueInt
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/portaudio.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/backends/portaudio.cpp b/Alc/backends/portaudio.cpp index 990fcbf6..5277f36b 100644 --- a/Alc/backends/portaudio.cpp +++ b/Alc/backends/portaudio.cpp @@ -129,9 +129,9 @@ ALCenum PortPlayback::open(const ALCchar *name) mUpdateSize = mDevice->UpdateSize; - mParams.device = -1; - if(!ConfigValueInt(nullptr, "port", "device", &mParams.device) || mParams.device < 0) - mParams.device = Pa_GetDefaultOutputDevice(); + auto devidopt = ConfigValueInt(nullptr, "port", "device"); + if(devidopt && *devidopt >= 0) mParams.device = *devidopt; + else mParams.device = Pa_GetDefaultOutputDevice(); mParams.suggestedLatency = mDevice->BufferSize / static_cast<double>(mDevice->Frequency); mParams.hostApiSpecificStreamInfo = nullptr; @@ -298,9 +298,9 @@ ALCenum PortCapture::open(const ALCchar *name) mRing = CreateRingBuffer(samples, frame_size, false); if(!mRing) return ALC_INVALID_VALUE; - mParams.device = -1; - if(!ConfigValueInt(nullptr, "port", "capture", &mParams.device) || mParams.device < 0) - mParams.device = Pa_GetDefaultInputDevice(); + auto devidopt = ConfigValueInt(nullptr, "port", "capture"); + if(devidopt && *devidopt >= 0) mParams.device = *devidopt; + else mParams.device = Pa_GetDefaultOutputDevice(); mParams.suggestedLatency = 0.0f; mParams.hostApiSpecificStreamInfo = nullptr; |