aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
authorMathiusD <[email protected]>2023-11-26 03:33:00 +0100
committerGitHub <[email protected]>2023-11-26 02:33:00 +0000
commitc03603b58d4cf6a25d36bca00305970bc9f163b4 (patch)
tree5f6f2944daf11a43779e8a483c749b190d11fc55 /alc/backends
parent1f6d19fd4a4fec15da4181a40ed443174bb95384 (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/backends')
-rw-r--r--alc/backends/base.h5
-rw-r--r--alc/backends/coreaudio.cpp11
-rw-r--r--alc/backends/coreaudio.h2
-rw-r--r--alc/backends/pipewire.cpp17
-rw-r--r--alc/backends/pipewire.h2
-rw-r--r--alc/backends/pulseaudio.cpp14
-rw-r--r--alc/backends/pulseaudio.h2
-rw-r--r--alc/backends/wasapi.cpp17
-rw-r--r--alc/backends/wasapi.h2
9 files changed, 68 insertions, 4 deletions
diff --git a/alc/backends/base.h b/alc/backends/base.h
index a4079fe4..ea3b57a3 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 1684545b..eb4e5880 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 <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>
@@ -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 1252edde..6ea4307c 100644
--- a/alc/backends/coreaudio.h
+++ b/alc/backends/coreaudio.h
@@ -9,6 +9,8 @@ public:
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 6cfb31a4..d1a9d095 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 5f930239..5493684f 100644
--- a/alc/backends/pipewire.h
+++ b/alc/backends/pipewire.h
@@ -13,6 +13,8 @@ public:
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 e2cea8a8..23ed1415 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 6690fe8a..4752a891 100644
--- a/alc/backends/pulseaudio.h
+++ b/alc/backends/pulseaudio.h
@@ -9,6 +9,8 @@ public:
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 37151ef9..a4d6ea2f 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 bb2671ee..12fd95ef 100644
--- a/alc/backends/wasapi.h
+++ b/alc/backends/wasapi.h
@@ -9,6 +9,8 @@ public:
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;