pincer.objects.events.voice_settings   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 190
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 51
dl 0
loc 190
rs 10
c 0
b 0
f 0
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
from __future__ import annotations
5
6
from dataclasses import dataclass
7
from enum import Enum, IntEnum, auto
8
from typing import List
9
10
from ...utils.api_object import APIObject
11
12
13
@dataclass(repr=False)
14
class AvailableDevices(APIObject):
15
    """
16
    Represents an available device for voice settings
17
18
    Attributes
19
    ----------
20
    id : :class:`str`
21
        id of the available device
22
23
    name : :class:`str`
24
        name of the available device
25
    """
26
27
    id: str
28
    name: str
29
30
31
@dataclass(repr=False)
32
class VoiceSettingsInput(APIObject):
33
    """
34
    Represents a voice setting input object
35
36
    Attributes
37
    ----------
38
    device_id : :class:`str`
39
        the device's id
40
41
    volume : :class:`float`
42
        input voice level (min: 0, max: 100)
43
44
    available_devices : List[:class:`AvailableDevices`]
45
        array of read-only device objects containing id and name string keys
46
    """
47
48
    device_id: str
49
    volume: float
50
    available_devices: List[AvailableDevices]
51
52
53
@dataclass(repr=False)
54
class VoiceSettingsOutput(APIObject):
55
    """
56
    Represents a voice setting output object
57
58
    Attributes
59
    ----------
60
    device_id : :class:`str`
61
        the device's id
62
63
    volume : :class:`float`
64
        input voice level (min: 0, max: 100)
65
66
    available_devices : List[:class:`AvailableDevices`]
67
        array of read-only device objects containing id and name string keys
68
    """
69
70
    device_id: str
71
    volume: float
72
    available_devices: List[AvailableDevices]
73
74
75
class VoiceSettingsModeType(Enum):
76
    """Represents a voice settings mode type"""
77
78
    PUSH_TO_TALK = auto()
79
    VOICE_ACTIVITY = auto()
80
81
82
class KeyTypes(IntEnum):
83
    """Represents a key type"""
84
85
    KEYBOARD_KEY = 0
86
    MOUSE_BUTTON = 1
87
    KEYBOARD_MODIFIER_KEY = 2
88
    GAMEPAD_BUTTON = 3
89
90
91
@dataclass(repr=False)
92
class ShortcutKeyCombo(APIObject):
93
    """
94
    Represents a shortcut key combo for the voice mode settings from a user
95
96
    Attributes
97
    ----------
98
    type : :class:`KeyTypes`
99
        type of shortcut key combo
100
101
    code : :class:`str`
102
        key code
103
104
    name : :class:`str`
105
        key name
106
    """
107
108
    type: KeyTypes
109
    code: int
110
    name: str
111
112
113
@dataclass(repr=False)
114
class VoiceSettingsMode(APIObject):
115
    """
116
    Represents the voice mode settings from a user
117
118
    Attributes
119
    ----------
120
    type : :class:`VoiceSettingsModeType`
121
        voice setting mode type
122
123
    auto_threshold : :class:`bool`
124
        voice activity threshold automatically sets its threshold
125
126
    threshold : :class:`float`
127
        threshold for voice activity (in dB)
128
129
    shortcut : :class:`ShortcutKeyCombo`
130
        shortcut key combos for PTT
131
132
    delay : :class:`float`
133
        the PTT release delay (in ms) (min: 0, max: 2000)
134
    """
135
136
    type: VoiceSettingsModeType
137
    auto_threshold: bool
138
    threshold: float
139
    shortcut: ShortcutKeyCombo
140
    delay: float
141
142
143
@dataclass(repr=False)
144
class VoiceSettingsUpdateEvent(APIObject):
0 ignored issues
show
best-practice introduced by
Too many instance attributes (9/7)
Loading history...
145
    """
146
    Represents a user's voice settings
147
148
    Attributes
149
    ----------
150
    input : :class:`VoiceSettingsInput`
151
        input settings
152
153
    output : :class:`VoiceSettingsOutput`
154
        output settings
155
156
    mode : :class:`bool`
157
        voice mode settings
158
159
    automatic_gain_control : :class:`bool`
160
        state of automatic gain control
161
162
    echo_cancellation : :class:`bool`
163
        state of echo cancellation
164
165
    noise_suppression : :class:`bool`
166
        state of noise suppression
167
168
    qos : :class:`bool`
169
        state of voice quality of service
170
171
    silence_warning : :class:`bool`
172
        state of silence warning notice
173
174
    deaf : :class:`bool`
175
        state of self-deafen
176
177
    mute : :class:`bool`
178
        state of self-mute
179
    """
180
181
    input: VoiceSettingsInput
182
    output: VoiceSettingsOutput
183
    automatic_gain_control: bool
184
    echo_cancellation: bool
185
    noise_suppression: bool
186
    qos: bool
187
    silence_warning: bool
188
    deaf: bool
189
    mute: bool
190