diff options
author | MathiusD <ferymathieuy@gmail.com> | 2023-11-26 03:33:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-26 02:33:00 +0000 |
commit | c03603b58d4cf6a25d36bca00305970bc9f163b4 (patch) | |
tree | 5f6f2944daf11a43779e8a483c749b190d11fc55 /alc/alc.cpp | |
parent | 1f6d19fd4a4fec15da4181a40ed443174bb95384 (diff) |
Add query fonction in ALC_SOFT_system_events unreleased extension (#938)
* feat(ALC_SOFT_system_events): Add alcEventIsSupportedSOFT method in ALC_SOFT_system_events unreleased extension
The purpose of this addition (to my collection) are allow to retrieve which events are supported and if events are fully supported or if some case isn't managed for some reason
For exemple only some backends provide system events:
* pipewire -> Full support of extension
* wasapi -> Full support of extension
* pulseaudio -> Support of add and remove devices events only
* coreaudio -> Support of default device change only
* feat(ALC_SOFT_system_events): Fix typo in alext.h
Cf following review : https://github.com/kcat/openal-soft/pull/938#discussion_r1404509828
* feat(ALC_SOFT_system_events): Remove ALC_EVENT_NOT_SUPPORTED_SOFT token
Cf following discussions between this comment : https://github.com/kcat/openal-soft/pull/938#issuecomment-1825876452 to this comment : https://github.com/kcat/openal-soft/pull/938#issuecomment-1826419406
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 08ef0063..be41f278 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -69,6 +69,7 @@ #include "al/filter.h" #include "al/listener.h" #include "al/source.h" +#include "alc/events.h" #include "albit.h" #include "alconfig.h" #include "almalloc.h" @@ -3469,3 +3470,42 @@ FORCE_ALIGN ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, ResetDeviceParams(dev.get(), attribs); return ALC_TRUE; } + +/************************************************ + * ALC event query functions + ************************************************/ + +FORCE_ALIGN ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCenum deviceType) noexcept +{ + auto etype = alc::GetEventType(eventType); + if(!etype) + { + WARN("Invalid event type: 0x%04x\n", eventType); + alcSetError(nullptr, ALC_INVALID_ENUM); + return ALC_EVENT_NOT_SUPPORTED_SOFT; + } + switch(deviceType) + { + case al::to_underlying(alc::DeviceType::Playback): + { + if(!PlaybackFactory) + { + return ALC_EVENT_NOT_SUPPORTED_SOFT; + } + + auto supported = PlaybackFactory->queryEventSupport(*etype, BackendType::Playback); + return al::to_underlying(supported); + } + case al::to_underlying(alc::DeviceType::Capture): + { + if(!CaptureFactory) + { + return ALC_EVENT_NOT_SUPPORTED_SOFT; + } + + auto supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture); + return al::to_underlying(supported); + } + } + return ALC_EVENT_NOT_SUPPORTED_SOFT; +}
\ No newline at end of file |