Skip to content

Commit

Permalink
PulseAudioUtils: Put magic subscription mask numbers in an IntEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
infirit committed Oct 2, 2023
1 parent c89d8d3 commit 2639f55
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion blueman/main/PulseAudioUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ class EventType(IntEnum):
TYPE_MASK = 0x0030


# from enum pa_subscription_mask
class SubscriptionMask(IntEnum):
NULL = 0x0000,
SINK = 0x0001,
SOURCE = 0x0002,
INPUT = 0x0004,
SOURCE_OUTPUT = 0x0008,
MODULE = 0x0010,
CLIENT = 0x0020,
SAMPLE_CACHE = 0x0040,
SERVER = 0x0080,
CARD = 0x0200,
ALL = 0x02ff


class NullError(Exception):
pass

Expand Down Expand Up @@ -198,7 +213,7 @@ def pa_context_event(pa_context: c_void_p, self: "PulseAudioUtils") -> None:
if state == ContextState.READY:
self.connected = True
self.emit("connected")
mask = 0x0200 | 0x0010 # from enum pa_subscription_mask
mask = SubscriptionMask.CARD | SubscriptionMask.MODULE

self.simple_callback(lambda x: logging.info(x),
pa_context_subscribe,
Expand Down

0 comments on commit 2639f55

Please sign in to comment.