From ebc37c4c9b86147e01b94fbd8970cf0fc8a4658d Mon Sep 17 00:00:00 2001 From: Erik Reider Date: Mon, 30 Aug 2021 00:25:14 +0200 Subject: [PATCH] Fixed --dry-print-both not working --- src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d9f2bd8..fc75118 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -125,19 +125,24 @@ void getRunning(EventType eventType, Data *data, pa_context *context) { void subscribe_callback(pa_context *, pa_subscription_event_type_t type, uint32_t, void *userdata) { Data *data = (Data *)userdata; - bool isBoth = data->subscriptionType == SUBSCRIPTION_TYPE_IDLE; + EventType eventType; switch (type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) { case PA_SUBSCRIPTION_EVENT_SINK: - data->eventCalled = isBoth ? EVENT_TYPE_IDLE : EVENT_TYPE_DRY_SINK; - pa_threaded_mainloop_signal(data->mainloop, 0); + eventType = EVENT_TYPE_DRY_SINK; break; case PA_SUBSCRIPTION_EVENT_SOURCE: - data->eventCalled = isBoth ? EVENT_TYPE_IDLE : EVENT_TYPE_DRY_SOURCE; - pa_threaded_mainloop_signal(data->mainloop, 0); + eventType = EVENT_TYPE_DRY_SOURCE; break; default: return; } + if(data->subscriptionType == SUBSCRIPTION_TYPE_IDLE) { + eventType = EVENT_TYPE_IDLE; + } else if(data->subscriptionType == SUBSCRIPTION_TYPE_DRY_BOTH) { + eventType = EVENT_TYPE_DRY_BOTH; + } + data->eventCalled = eventType; + pa_threaded_mainloop_signal(data->mainloop, 0); } void context_state_callback(pa_context *c, void *userdata) {