aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/portaudio.cpp12
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;