aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r--alc/alc.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index f18864ea..f3fcb00a 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2697,8 +2697,13 @@ START_API_FUNC
case ALC_ALL_DEVICES_SPECIFIER:
if(DeviceRef dev{VerifyDevice(Device)})
{
- std::lock_guard<std::mutex> _{dev->StateLock};
- value = dev->DeviceName.c_str();
+ if(dev->Type != DeviceType::Playback)
+ alcSetError(dev.get(), ALC_INVALID_ENUM);
+ else
+ {
+ std::lock_guard<std::mutex> _{dev->StateLock};
+ value = dev->DeviceName.c_str();
+ }
}
else
{
@@ -2709,7 +2714,15 @@ START_API_FUNC
case ALC_CAPTURE_DEVICE_SPECIFIER:
if(DeviceRef dev{VerifyDevice(Device)})
- value = dev->DeviceName.c_str();
+ {
+ if(dev->Type != DeviceType::Capture)
+ alcSetError(dev.get(), ALC_INVALID_ENUM);
+ else
+ {
+ std::lock_guard<std::mutex> _{dev->StateLock};
+ value = dev->DeviceName.c_str();
+ }
+ }
else
{
ProbeCaptureDeviceList();