Skip to content

Commit

Permalink
Return ALC_FALSE on error from alcEventIsSupportedSOFT
Browse files Browse the repository at this point in the history
This helps distinguish invalid inputs that set an ALC error on the null device,
from normal "not supported" responses.
  • Loading branch information
kcat committed Sep 25, 2024
1 parent a81d399 commit 36f2a1c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions alc/alc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3618,25 +3618,25 @@ FORCE_ALIGN ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCe
{
WARN("Invalid event type: 0x%04x\n", eventType);
alcSetError(nullptr, ALC_INVALID_ENUM);
return ALC_EVENT_NOT_SUPPORTED_SOFT;
return ALC_FALSE;
}

auto supported = alc::EventSupport::NoSupport;
switch(deviceType)
{
case ALC_PLAYBACK_DEVICE_SOFT:
if(PlaybackFactory)
supported = PlaybackFactory->queryEventSupport(*etype, BackendType::Playback);
break;
case ALC_PLAYBACK_DEVICE_SOFT:
if(PlaybackFactory)
supported = PlaybackFactory->queryEventSupport(*etype, BackendType::Playback);
return al::to_underlying(supported);

case ALC_CAPTURE_DEVICE_SOFT:
if(CaptureFactory)
supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture);
break;
case ALC_CAPTURE_DEVICE_SOFT:
if(CaptureFactory)
supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture);
return al::to_underlying(supported);

default:
WARN("Invalid device type: 0x%04x\n", deviceType);
alcSetError(nullptr, ALC_INVALID_ENUM);
default:
WARN("Invalid device type: 0x%04x\n", deviceType);
alcSetError(nullptr, ALC_INVALID_ENUM);
}
return al::to_underlying(supported);
return ALC_FALSE;
}

1 comment on commit 36f2a1c

@MathiusD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea !

Please sign in to comment.