From 80c6641a32de8192cf12cb6342ec1a8c93a2f340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20F=C3=A9ry?= Date: Fri, 24 Nov 2023 13:58:38 +0100 Subject: [PATCH 1/3] 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 --- alc/alc.cpp | 40 +++++++++++++++++++++++++++ alc/backends/base.h | 5 ++++ alc/backends/coreaudio.cpp | 11 +++++++- alc/backends/coreaudio.h | 2 ++ alc/backends/pipewire.cpp | 17 +++++++++++- alc/backends/pipewire.h | 2 ++ alc/backends/pulseaudio.cpp | 14 +++++++++- alc/backends/pulseaudio.h | 2 ++ alc/backends/wasapi.cpp | 17 +++++++++++- alc/backends/wasapi.h | 2 ++ alc/events.cpp | 26 ++++++++---------- alc/events.h | 9 ++++++ alc/export_list.h | 1 + include/AL/alext.h | 13 ++++++--- utils/openal-info.c | 55 +++++++++++++++++++++++++++++++++++++ 15 files changed, 194 insertions(+), 22 deletions(-) diff --git a/alc/alc.cpp b/alc/alc.cpp index 08ef006348..426bfd9798 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; + } + switch(deviceType) + { + case al::to_underlying(alc::DeviceType::Playback): + { + if(!PlaybackFactory) + { + return ALC_EVENT_NOT_SUPPORTED; + } + + 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; + } + + auto supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture); + return al::to_underlying(supported); + } + } + return ALC_EVENT_NOT_SUPPORTED; +} \ No newline at end of file diff --git a/alc/backends/base.h b/alc/backends/base.h index a4079fe420..ea3b57a3b7 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -11,6 +11,7 @@ #include "core/device.h" #include "core/except.h" +#include "alc/events.h" using uint = unsigned int; @@ -79,6 +80,10 @@ struct BackendFactory { virtual bool querySupport(BackendType type) = 0; + virtual alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) { + return alc::EventSupport::NoSupport; + } + virtual std::string probe(BackendType type) = 0; virtual BackendPtr createBackend(DeviceBase *device, BackendType type) = 0; diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 1684545b96..eb4e5880b7 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -39,7 +39,6 @@ #include "core/device.h" #include "core/logging.h" #include "ringbuffer.h" -#include "alc/events.h" #include #include @@ -1013,3 +1012,13 @@ BackendPtr CoreAudioBackendFactory::createBackend(DeviceBase *device, BackendTyp return BackendPtr{new CoreAudioCapture{device}}; return nullptr; } + +alc::EventSupport CoreAudioBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +{ + switch(eventType) { + case alc::EventType::DefaultDeviceChanged: { + return alc::EventSupport::FullSupport; + } + } + return alc::EventSupport::NoSupport; +} diff --git a/alc/backends/coreaudio.h b/alc/backends/coreaudio.h index 1252edde38..6ea4307c73 100644 --- a/alc/backends/coreaudio.h +++ b/alc/backends/coreaudio.h @@ -9,6 +9,8 @@ struct CoreAudioBackendFactory final : public BackendFactory { bool querySupport(BackendType type) override; + alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) override; + std::string probe(BackendType type) override; BackendPtr createBackend(DeviceBase *device, BackendType type) override; diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 6cfb31a427..d1a9d095df 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -40,7 +40,6 @@ #include "albit.h" #include "alc/alconfig.h" -#include "alc/events.h" #include "almalloc.h" #include "alnumeric.h" #include "alspan.h" @@ -2266,3 +2265,19 @@ BackendFactory &PipeWireBackendFactory::getFactory() static PipeWireBackendFactory factory{}; return factory; } + +alc::EventSupport PipeWireBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +{ + switch(eventType) { + case alc::EventType::DefaultDeviceChanged: { + return alc::EventSupport::FullSupport; + } + case alc::EventType::DeviceAdded: { + return alc::EventSupport::FullSupport; + } + case alc::EventType::DeviceRemoved: { + return alc::EventSupport::FullSupport; + } + } + return alc::EventSupport::NoSupport; +} \ No newline at end of file diff --git a/alc/backends/pipewire.h b/alc/backends/pipewire.h index 5f930239c6..5493684fe5 100644 --- a/alc/backends/pipewire.h +++ b/alc/backends/pipewire.h @@ -13,6 +13,8 @@ struct PipeWireBackendFactory final : public BackendFactory { bool querySupport(BackendType type) override; + alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) override; + std::string probe(BackendType type) override; BackendPtr createBackend(DeviceBase *device, BackendType type) override; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index e2cea8a8e5..23ed141568 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -41,7 +41,6 @@ #include "albit.h" #include "alc/alconfig.h" -#include "alc/events.h" #include "almalloc.h" #include "alnumeric.h" #include "alspan.h" @@ -1491,3 +1490,16 @@ BackendFactory &PulseBackendFactory::getFactory() static PulseBackendFactory factory{}; return factory; } + +alc::EventSupport PulseBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +{ + switch(eventType) { + case alc::EventType::DeviceAdded: { + return alc::EventSupport::FullSupport; + } + case alc::EventType::DeviceRemoved: { + return alc::EventSupport::FullSupport; + } + } + return alc::EventSupport::NoSupport; +} diff --git a/alc/backends/pulseaudio.h b/alc/backends/pulseaudio.h index 6690fe8a9f..4752a89176 100644 --- a/alc/backends/pulseaudio.h +++ b/alc/backends/pulseaudio.h @@ -9,6 +9,8 @@ class PulseBackendFactory final : public BackendFactory { bool querySupport(BackendType type) override; + alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) override; + std::string probe(BackendType type) override; BackendPtr createBackend(DeviceBase *device, BackendType type) override; diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 37151ef9d3..a4d6ea2fe4 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -60,7 +60,6 @@ #include "albit.h" #include "alc/alconfig.h" -#include "alc/events.h" #include "alnumeric.h" #include "alspan.h" #include "althrd_setname.h" @@ -2741,3 +2740,19 @@ BackendFactory &WasapiBackendFactory::getFactory() static WasapiBackendFactory factory{}; return factory; } + +alc::EventSupport WasapiBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +{ + switch(eventType) { + case alc::EventType::DefaultDeviceChanged: { + return alc::EventSupport::FullSupport; + } + case alc::EventType::DeviceAdded: { + return alc::EventSupport::FullSupport; + } + case alc::EventType::DeviceRemoved: { + return alc::EventSupport::FullSupport; + } + } + return alc::EventSupport::NoSupport; +} diff --git a/alc/backends/wasapi.h b/alc/backends/wasapi.h index bb2671ee84..12fd95ef6a 100644 --- a/alc/backends/wasapi.h +++ b/alc/backends/wasapi.h @@ -9,6 +9,8 @@ struct WasapiBackendFactory final : public BackendFactory { bool querySupport(BackendType type) override; + alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) override; + std::string probe(BackendType type) override; BackendPtr createBackend(DeviceBase *device, BackendType type) override; diff --git a/alc/events.cpp b/alc/events.cpp index a80faf8aa0..1010a33840 100644 --- a/alc/events.cpp +++ b/alc/events.cpp @@ -3,8 +3,6 @@ #include "events.h" -#include - #include "alspan.h" #include "core/logging.h" #include "device.h" @@ -12,17 +10,6 @@ namespace { -std::optional GetEventType(ALCenum type) -{ - switch(type) - { - case ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT: return alc::EventType::DefaultDeviceChanged; - case ALC_EVENT_TYPE_DEVICE_ADDED_SOFT: return alc::EventType::DeviceAdded; - case ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT: return alc::EventType::DeviceRemoved; - } - return std::nullopt; -} - ALCenum EnumFromEventType(const alc::EventType type) { switch(type) @@ -39,6 +26,17 @@ ALCenum EnumFromEventType(const alc::EventType type) namespace alc { +std::optional GetEventType(ALCenum type) +{ + switch(type) + { + case ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT: return alc::EventType::DefaultDeviceChanged; + case ALC_EVENT_TYPE_DEVICE_ADDED_SOFT: return alc::EventType::DeviceAdded; + case ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT: return alc::EventType::DeviceRemoved; + } + return std::nullopt; +} + void Event(EventType eventType, DeviceType deviceType, ALCdevice *device, std::string_view message) noexcept { auto eventlock = std::unique_lock{EventMutex}; @@ -73,7 +71,7 @@ FORCE_ALIGN ALCboolean ALC_APIENTRY alcEventControlSOFT(ALCsizei count, const AL alc::EventBitSet eventSet{0}; for(ALCenum type : al::span{events, static_cast(count)}) { - auto etype = GetEventType(type); + auto etype = alc::GetEventType(type); if(!etype) { WARN("Invalid event type: 0x%04x\n", type); diff --git a/alc/events.h b/alc/events.h index 4acc505df6..5fadca4c89 100644 --- a/alc/events.h +++ b/alc/events.h @@ -6,6 +6,7 @@ #include #include +#include #include @@ -19,6 +20,14 @@ enum class EventType : uint8_t { Count }; +std::optional GetEventType(ALCenum type); + +enum class EventSupport : ALCenum { + FullSupport = ALC_EVENT_SUPPORTED, + PartialSupport = ALC_EVENT_PARTIALLY_SUPPORTED, + NoSupport = ALC_EVENT_NOT_SUPPORTED, +}; + enum class DeviceType : ALCenum { Playback = ALC_PLAYBACK_DEVICE_SOFT, Capture = ALC_CAPTURE_DEVICE_SOFT, diff --git a/alc/export_list.h b/alc/export_list.h index 47b04a08de..c5af1ab059 100644 --- a/alc/export_list.h +++ b/alc/export_list.h @@ -56,6 +56,7 @@ inline const FuncExport alcFunctions[]{ DECL(alcReopenDeviceSOFT), + DECL(alcEventIsSupportedSOFT), DECL(alcEventControlSOFT), DECL(alcEventCallbackSOFT), diff --git a/include/AL/alext.h b/include/AL/alext.h index b99d6aacb8..a5ae19cccf 100644 --- a/include/AL/alext.h +++ b/include/AL/alext.h @@ -715,16 +715,21 @@ void AL_APIENTRY alGetObjectLabelEXT(ALenum identifier, ALuint name, ALsizei buf #ifndef ALC_SOFT_system_events #define ALC_SOFT_system_events -#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4 -#define ALC_CAPTURE_DEVICE_SOFT 0x19D5 +#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4 +#define ALC_CAPTURE_DEVICE_SOFT 0x19D5 #define ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT 0x19D6 -#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7 -#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8 +#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7 +#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8 +#define ALC_EVENT_SUPPORTED 0x19D9 +#define ALC_EVENT_PARTIALLY_SUPPORTED 0x19DA +#define ALC_EVENT_NOT_SUPPORTED 0x19DB typedef void (ALC_APIENTRY*ALCEVENTPROCTYPESOFT)(ALCenum eventType, ALCenum deviceType, ALCdevice *device, ALCsizei length, const ALCchar *message, void *userParam) ALC_API_NOEXCEPT17; +typedef ALCenum (ALC_APIENTRY*LPALCEVENTISSUPPORTEDSOFT)(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT17; typedef ALCboolean (ALC_APIENTRY*LPALCEVENTCONTROLSOFT)(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT17; typedef void (ALC_APIENTRY*LPALCEVENTCALLBACKSOFT)(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT17; #ifdef AL_ALEXT_PROTOTYPES +ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT; ALCboolean ALC_APIENTRY alcEventControlSOFT(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT; void ALC_APIENTRY alcEventCallbackSOFT(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT; #endif diff --git a/utils/openal-info.c b/utils/openal-info.c index 0af27422e6..706fed8d77 100644 --- a/utils/openal-info.c +++ b/utils/openal-info.c @@ -230,6 +230,60 @@ static void printModeInfo(ALCdevice *device) } } +static void printALCSOFTSystemEventIsSupportedResult(LPALCEVENTISSUPPORTEDSOFT alcEventIsSupportedSOFT, ALCenum eventType, ALCenum deviceType) +{ + if (alcEventIsSupportedSOFT == NULL) + { + printf("ERROR (alcEventIsSupportedSOFT missing)\n"); + return; + } + ALCenum supported = alcEventIsSupportedSOFT(eventType, deviceType); + if (supported == ALC_EVENT_SUPPORTED) + { + printf("SUPPORTED\n"); + } + else if (supported == ALC_EVENT_PARTIALLY_SUPPORTED) + { + printf("PARTIALLY SUPPORTED\n"); + } + else if (supported == ALC_EVENT_NOT_SUPPORTED) + { + printf("NOT SUPPORTED\n"); + } + else + { + printf("UNEXPECTED RETURN : %d\n", supported); + } +} + +static void printALC_SOFT_system_event(void) +{ + printf("ALC_SOFT_system_events:"); + if (alcIsExtensionPresent(NULL, "ALC_SOFT_system_events")) + { + static LPALCEVENTISSUPPORTEDSOFT alcEventIsSupportedSOFT; + alcEventIsSupportedSOFT = FUNCTION_CAST(LPALCEVENTISSUPPORTEDSOFT, alGetProcAddress("alcEventIsSupportedSOFT")); + printf(" Supported.\n"); + printf(" Events:\n"); + printf(" ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT for ALC_PLAYBACK_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT, ALC_PLAYBACK_DEVICE_SOFT); + printf(" ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT for ALC_CAPTURE_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT, ALC_CAPTURE_DEVICE_SOFT); + printf(" ALC_EVENT_TYPE_DEVICE_ADDED_SOFT for ALC_PLAYBACK_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEVICE_ADDED_SOFT, ALC_PLAYBACK_DEVICE_SOFT); + printf(" ALC_EVENT_TYPE_DEVICE_ADDED_SOFT for ALC_CAPTURE_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEVICE_ADDED_SOFT, ALC_CAPTURE_DEVICE_SOFT); + printf(" ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT for ALC_PLAYBACK_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT, ALC_PLAYBACK_DEVICE_SOFT); + printf(" ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT for ALC_CAPTURE_DEVICE_SOFT - "); + printALCSOFTSystemEventIsSupportedResult(alcEventIsSupportedSOFT, ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT, ALC_CAPTURE_DEVICE_SOFT); + } + else + { + printf(" Not supported.\n"); + } +} + static void printALInfo(void) { printf("OpenAL vendor string: %s\n", alGetString(AL_VENDOR)); @@ -435,6 +489,7 @@ int main(int argc, char *argv[]) } printALCInfo(device); printHRTFInfo(device); + printALC_SOFT_system_event(); context = alcCreateContext(device, NULL); if(!context || alcMakeContextCurrent(context) == ALC_FALSE) From 4aba47cc8f2f03c265843f8758e18df480ef2c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20F=C3=A9ry?= Date: Fri, 24 Nov 2023 18:13:36 +0100 Subject: [PATCH 2/3] feat(ALC_SOFT_system_events): Fix typo in alext.h Cf following review : https://github.com/kcat/openal-soft/pull/938#discussion_r1404509828 --- alc/alc.cpp | 8 ++++---- alc/events.h | 6 +++--- include/AL/alext.h | 14 +++++++------- utils/openal-info.c | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/alc/alc.cpp b/alc/alc.cpp index 426bfd9798..be41f27842 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -3482,7 +3482,7 @@ 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; + return ALC_EVENT_NOT_SUPPORTED_SOFT; } switch(deviceType) { @@ -3490,7 +3490,7 @@ FORCE_ALIGN ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCe { if(!PlaybackFactory) { - return ALC_EVENT_NOT_SUPPORTED; + return ALC_EVENT_NOT_SUPPORTED_SOFT; } auto supported = PlaybackFactory->queryEventSupport(*etype, BackendType::Playback); @@ -3500,12 +3500,12 @@ FORCE_ALIGN ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCe { if(!CaptureFactory) { - return ALC_EVENT_NOT_SUPPORTED; + return ALC_EVENT_NOT_SUPPORTED_SOFT; } auto supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture); return al::to_underlying(supported); } } - return ALC_EVENT_NOT_SUPPORTED; + return ALC_EVENT_NOT_SUPPORTED_SOFT; } \ No newline at end of file diff --git a/alc/events.h b/alc/events.h index 5fadca4c89..2a3b0918cb 100644 --- a/alc/events.h +++ b/alc/events.h @@ -23,9 +23,9 @@ enum class EventType : uint8_t { std::optional GetEventType(ALCenum type); enum class EventSupport : ALCenum { - FullSupport = ALC_EVENT_SUPPORTED, - PartialSupport = ALC_EVENT_PARTIALLY_SUPPORTED, - NoSupport = ALC_EVENT_NOT_SUPPORTED, + FullSupport = ALC_EVENT_SUPPORTED_SOFT, + PartialSupport = ALC_EVENT_PARTIALLY_SUPPORTED_SOFT, + NoSupport = ALC_EVENT_NOT_SUPPORTED_SOFT, }; enum class DeviceType : ALCenum { diff --git a/include/AL/alext.h b/include/AL/alext.h index a5ae19cccf..1e53687fff 100644 --- a/include/AL/alext.h +++ b/include/AL/alext.h @@ -715,14 +715,14 @@ void AL_APIENTRY alGetObjectLabelEXT(ALenum identifier, ALuint name, ALsizei buf #ifndef ALC_SOFT_system_events #define ALC_SOFT_system_events -#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4 -#define ALC_CAPTURE_DEVICE_SOFT 0x19D5 +#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4 +#define ALC_CAPTURE_DEVICE_SOFT 0x19D5 #define ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT 0x19D6 -#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7 -#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8 -#define ALC_EVENT_SUPPORTED 0x19D9 -#define ALC_EVENT_PARTIALLY_SUPPORTED 0x19DA -#define ALC_EVENT_NOT_SUPPORTED 0x19DB +#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7 +#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8 +#define ALC_EVENT_SUPPORTED_SOFT 0x19D9 +#define ALC_EVENT_PARTIALLY_SUPPORTED_SOFT 0x19DA +#define ALC_EVENT_NOT_SUPPORTED_SOFT 0x19DB typedef void (ALC_APIENTRY*ALCEVENTPROCTYPESOFT)(ALCenum eventType, ALCenum deviceType, ALCdevice *device, ALCsizei length, const ALCchar *message, void *userParam) ALC_API_NOEXCEPT17; typedef ALCenum (ALC_APIENTRY*LPALCEVENTISSUPPORTEDSOFT)(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT17; diff --git a/utils/openal-info.c b/utils/openal-info.c index 706fed8d77..a232e15eae 100644 --- a/utils/openal-info.c +++ b/utils/openal-info.c @@ -238,15 +238,15 @@ static void printALCSOFTSystemEventIsSupportedResult(LPALCEVENTISSUPPORTEDSOFT a return; } ALCenum supported = alcEventIsSupportedSOFT(eventType, deviceType); - if (supported == ALC_EVENT_SUPPORTED) + if (supported == ALC_EVENT_SUPPORTED_SOFT) { printf("SUPPORTED\n"); } - else if (supported == ALC_EVENT_PARTIALLY_SUPPORTED) + else if (supported == ALC_EVENT_PARTIALLY_SUPPORTED_SOFT) { printf("PARTIALLY SUPPORTED\n"); } - else if (supported == ALC_EVENT_NOT_SUPPORTED) + else if (supported == ALC_EVENT_NOT_SUPPORTED_SOFT) { printf("NOT SUPPORTED\n"); } From 5c177ad937698800e25543f996da5f29dc47f096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Sun, 26 Nov 2023 01:01:52 +0100 Subject: [PATCH 3/3] 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 --- alc/events.h | 1 - include/AL/alext.h | 3 +-- utils/openal-info.c | 6 +----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/alc/events.h b/alc/events.h index 2a3b0918cb..3f53ec7626 100644 --- a/alc/events.h +++ b/alc/events.h @@ -24,7 +24,6 @@ std::optional GetEventType(ALCenum type); enum class EventSupport : ALCenum { FullSupport = ALC_EVENT_SUPPORTED_SOFT, - PartialSupport = ALC_EVENT_PARTIALLY_SUPPORTED_SOFT, NoSupport = ALC_EVENT_NOT_SUPPORTED_SOFT, }; diff --git a/include/AL/alext.h b/include/AL/alext.h index 1e53687fff..c75e07702d 100644 --- a/include/AL/alext.h +++ b/include/AL/alext.h @@ -721,8 +721,7 @@ void AL_APIENTRY alGetObjectLabelEXT(ALenum identifier, ALuint name, ALsizei buf #define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7 #define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8 #define ALC_EVENT_SUPPORTED_SOFT 0x19D9 -#define ALC_EVENT_PARTIALLY_SUPPORTED_SOFT 0x19DA -#define ALC_EVENT_NOT_SUPPORTED_SOFT 0x19DB +#define ALC_EVENT_NOT_SUPPORTED_SOFT 0x19DA typedef void (ALC_APIENTRY*ALCEVENTPROCTYPESOFT)(ALCenum eventType, ALCenum deviceType, ALCdevice *device, ALCsizei length, const ALCchar *message, void *userParam) ALC_API_NOEXCEPT17; typedef ALCenum (ALC_APIENTRY*LPALCEVENTISSUPPORTEDSOFT)(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT17; diff --git a/utils/openal-info.c b/utils/openal-info.c index a232e15eae..11c492454f 100644 --- a/utils/openal-info.c +++ b/utils/openal-info.c @@ -242,17 +242,13 @@ static void printALCSOFTSystemEventIsSupportedResult(LPALCEVENTISSUPPORTEDSOFT a { printf("SUPPORTED\n"); } - else if (supported == ALC_EVENT_PARTIALLY_SUPPORTED_SOFT) - { - printf("PARTIALLY SUPPORTED\n"); - } else if (supported == ALC_EVENT_NOT_SUPPORTED_SOFT) { printf("NOT SUPPORTED\n"); } else { - printf("UNEXPECTED RETURN : %d\n", supported); + printf("UNEXPECTED VALUE : %d\n", supported); } }