From 2a27a2ca5ea0f6b6b8fff065212959ea60021647 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 25 Nov 2023 18:58:00 -0800 Subject: Fix some unused parameter and unhandled enum warnings --- alc/alc.cpp | 35 +++++++++++++++-------------------- alc/backends/base.h | 5 ++--- alc/backends/coreaudio.cpp | 15 ++++++++++----- alc/backends/pipewire.cpp | 23 +++++++++++------------ alc/backends/pulseaudio.cpp | 18 ++++++++++-------- alc/backends/wasapi.cpp | 25 ++++++++++++++----------- 6 files changed, 62 insertions(+), 59 deletions(-) diff --git a/alc/alc.cpp b/alc/alc.cpp index be41f278..6017e743 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -3484,28 +3484,23 @@ FORCE_ALIGN ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCe alcSetError(nullptr, ALC_INVALID_ENUM); return ALC_EVENT_NOT_SUPPORTED_SOFT; } + + auto supported = alc::EventSupport::NoSupport; switch(deviceType) { - case al::to_underlying(alc::DeviceType::Playback): - { - if(!PlaybackFactory) - { - return ALC_EVENT_NOT_SUPPORTED_SOFT; - } + case ALC_PLAYBACK_DEVICE_SOFT: + if(PlaybackFactory) + supported = PlaybackFactory->queryEventSupport(*etype, BackendType::Playback); + break; - 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; - } + case ALC_CAPTURE_DEVICE_SOFT: + if(CaptureFactory) + supported = CaptureFactory->queryEventSupport(*etype, BackendType::Capture); + break; - auto 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); } - return ALC_EVENT_NOT_SUPPORTED_SOFT; -} \ No newline at end of file + return al::to_underlying(supported); +} diff --git a/alc/backends/base.h b/alc/backends/base.h index ea3b57a3..eea0d238 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -80,9 +80,8 @@ struct BackendFactory { virtual bool querySupport(BackendType type) = 0; - virtual alc::EventSupport queryEventSupport(alc::EventType eventType, BackendType type) { - return alc::EventSupport::NoSupport; - } + virtual alc::EventSupport queryEventSupport(alc::EventType, BackendType) + { return alc::EventSupport::NoSupport; } virtual std::string probe(BackendType type) = 0; diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index eb4e5880..16b0781e 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -1013,12 +1013,17 @@ BackendPtr CoreAudioBackendFactory::createBackend(DeviceBase *device, BackendTyp return nullptr; } -alc::EventSupport CoreAudioBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +alc::EventSupport CoreAudioBackendFactory::queryEventSupport(alc::EventType eventType, BackendType) { - switch(eventType) { - case alc::EventType::DefaultDeviceChanged: { - return alc::EventSupport::FullSupport; - } + switch(eventType) + { + case alc::EventType::DefaultDeviceChanged: + return alc::EventSupport::FullSupport; + + case alc::EventType::DeviceAdded: + case alc::EventType::DeviceRemoved: + case alc::EventType::Count: + break; } return alc::EventSupport::NoSupport; } diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index d1a9d095..6a001d7a 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -2266,18 +2266,17 @@ BackendFactory &PipeWireBackendFactory::getFactory() return factory; } -alc::EventSupport PipeWireBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +alc::EventSupport PipeWireBackendFactory::queryEventSupport(alc::EventType eventType, BackendType) { - 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; - } + switch(eventType) + { + case alc::EventType::DefaultDeviceChanged: + case alc::EventType::DeviceAdded: + case alc::EventType::DeviceRemoved: + return alc::EventSupport::FullSupport; + + case alc::EventType::Count: + break; } return alc::EventSupport::NoSupport; -} \ No newline at end of file +} diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 23ed1415..bebc182d 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -1491,15 +1491,17 @@ BackendFactory &PulseBackendFactory::getFactory() return factory; } -alc::EventSupport PulseBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +alc::EventSupport PulseBackendFactory::queryEventSupport(alc::EventType eventType, BackendType) { - switch(eventType) { - case alc::EventType::DeviceAdded: { - return alc::EventSupport::FullSupport; - } - case alc::EventType::DeviceRemoved: { - return alc::EventSupport::FullSupport; - } + switch(eventType) + { + case alc::EventType::DeviceAdded: + case alc::EventType::DeviceRemoved: + return alc::EventSupport::FullSupport; + + case alc::EventType::DefaultDeviceChanged: + case alc::EventType::Count: + break; } return alc::EventSupport::NoSupport; } diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index a4d6ea2f..3ee98457 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -2741,18 +2741,21 @@ BackendFactory &WasapiBackendFactory::getFactory() return factory; } -alc::EventSupport WasapiBackendFactory::queryEventSupport(alc::EventType eventType, BackendType type) +alc::EventSupport WasapiBackendFactory::queryEventSupport(alc::EventType eventType, BackendType) { - 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; - } + switch(eventType) + { + case alc::EventType::DefaultDeviceChanged: + return alc::EventSupport::FullSupport; + + case alc::EventType::DeviceAdded: + case alc::EventType::DeviceRemoved: +#if !defined(ALSOFT_UWP) + return alc::EventSupport::FullSupport; +#endif + + case alc::EventType::Count: + break; } return alc::EventSupport::NoSupport; } -- cgit v1.2.3