aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/pulseaudio.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-05-31 22:11:15 -0700
committerChris Robinson <[email protected]>2023-06-01 06:33:41 -0700
commitedc20c87d3cd37608e8fa50556d718cd32755f3d (patch)
treeca712a140ff79a21ba2c49d5c13b686c9679a143 /alc/backends/pulseaudio.cpp
parentd684c7617f2e13572b1c3f9a933a23e1f0e32d49 (diff)
Specify the device type for the event callback
Diffstat (limited to 'alc/backends/pulseaudio.cpp')
-rw-r--r--alc/backends/pulseaudio.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 16a2450f..8c6cc4d3 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -452,11 +452,13 @@ struct MainloopUniqueLock : public std::unique_lock<PulseMainloop> {
if(eventFacility == PA_SUBSCRIPTION_EVENT_SINK
|| eventFacility == PA_SUBSCRIPTION_EVENT_SOURCE)
{
+ const auto deviceType = (eventFacility == PA_SUBSCRIPTION_EVENT_SINK)
+ ? alc::DeviceType::Playback : alc::DeviceType::Capture;
const auto eventType = (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK);
if(eventType == PA_SUBSCRIPTION_EVENT_NEW)
- alc::Event(alc::EventType::DeviceAdded, "Device added");
+ alc::Event(alc::EventType::DeviceAdded, deviceType, "Device added");
else if(eventType == PA_SUBSCRIPTION_EVENT_REMOVE)
- alc::Event(alc::EventType::DeviceRemoved, "Device removed");
+ alc::Event(alc::EventType::DeviceRemoved, deviceType, "Device removed");
}
};
pa_context_set_subscribe_callback(mutex()->mContext, handler, nullptr);