1
|
|
|
# Copyright Pincer 2021-Present |
|
|
|
|
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 |
14
|
|
|
class AvailableDevices(APIObject): |
15
|
|
|
""" |
16
|
|
|
Represents an availabe device for voice settings |
17
|
|
|
|
|
|
|
|
18
|
|
|
:param id: |
19
|
|
|
id of the available device |
20
|
|
|
|
|
|
|
|
21
|
|
|
:param name: |
22
|
|
|
name of the available device |
23
|
|
|
""" |
24
|
|
|
|
25
|
|
|
id: str |
26
|
|
|
name: str |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
@dataclass |
30
|
|
|
class VoiceSettingsInput(APIObject): |
31
|
|
|
""" |
32
|
|
|
Represents a voice setting input object |
33
|
|
|
|
|
|
|
|
34
|
|
|
:param device_id: |
35
|
|
|
the device's id |
36
|
|
|
|
|
|
|
|
37
|
|
|
:param volume: |
38
|
|
|
input voice level (min: 0, max: 100) |
39
|
|
|
|
|
|
|
|
40
|
|
|
:param available_devices: |
41
|
|
|
array of read-only device objects containing id and name string keys |
42
|
|
|
""" |
43
|
|
|
|
44
|
|
|
device_id: str |
45
|
|
|
volume: float |
46
|
|
|
available_devices: List[AvailableDevices] |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
VoiceSettingsOutput = VoiceSettingsInput |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
class VoiceSettingsModeType(Enum): |
53
|
|
|
"""Represents a voice settings mode type""" |
54
|
|
|
|
55
|
|
|
PUSH_TO_TALK = auto() |
56
|
|
|
VOICE_ACTIVITY = auto() |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
class KeyTypes(IntEnum): |
60
|
|
|
"""Represents a key type""" |
61
|
|
|
|
62
|
|
|
KEYBOARD_KEY = 0 |
63
|
|
|
MOUSE_BUTTON = 1 |
64
|
|
|
KEYBOARD_MODIFIER_KEY = 2 |
65
|
|
|
GAMEPAD_BUTTON = 3 |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
@dataclass |
69
|
|
|
class ShortcutKeyCombo(APIObject): |
70
|
|
|
""" |
71
|
|
|
Represents a shortcut key combo for the voice mode settings from a user |
72
|
|
|
|
|
|
|
|
73
|
|
|
:param type: |
74
|
|
|
type of shortcut key combo |
75
|
|
|
|
|
|
|
|
76
|
|
|
:param code: |
77
|
|
|
key code |
78
|
|
|
|
|
|
|
|
79
|
|
|
:param name: |
80
|
|
|
key name |
81
|
|
|
""" |
82
|
|
|
|
83
|
|
|
type: KeyTypes |
84
|
|
|
code: int |
85
|
|
|
name: str |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
@dataclass |
89
|
|
|
class VoiceSettingsMode(APIObject): |
90
|
|
|
""" |
91
|
|
|
Represents the voice mode settings from a user |
92
|
|
|
|
|
|
|
|
93
|
|
|
:param type: |
94
|
|
|
voice setting mode type |
95
|
|
|
|
|
|
|
|
96
|
|
|
:param auto_threshold: |
97
|
|
|
voice activity threshold automatically sets its threshold |
98
|
|
|
|
|
|
|
|
99
|
|
|
:param threshold: |
100
|
|
|
threshold for voice activity (in dB) |
101
|
|
|
|
|
|
|
|
102
|
|
|
:param shortcut: |
103
|
|
|
shortcut key combos for PTT |
104
|
|
|
""" |
105
|
|
|
|
106
|
|
|
type: VoiceSettingsModeType |
107
|
|
|
auto_threshold: bool |
108
|
|
|
threshold: float |
109
|
|
|
shortcut: ShortcutKeyCombo |
110
|
|
|
delay: float |
111
|
|
|
|
112
|
|
|
|
113
|
|
|
@dataclass |
|
|
|
|
114
|
|
|
class VoiceSettingsUpdateEvent(APIObject): |
115
|
|
|
""" |
116
|
|
|
Represents a user's voice settings |
117
|
|
|
|
|
|
|
|
118
|
|
|
:param input: |
119
|
|
|
input settings |
120
|
|
|
|
121
|
|
|
:param output: |
122
|
|
|
output settings |
123
|
|
|
|
124
|
|
|
:param mode: |
125
|
|
|
voice mode settings |
126
|
|
|
|
127
|
|
|
:param automatic_gain_control: |
128
|
|
|
state of automatic gain control |
129
|
|
|
|
130
|
|
|
:param echo_cancellation: |
131
|
|
|
state of echo cancellation |
132
|
|
|
|
133
|
|
|
:param noise_suppression: |
134
|
|
|
state of noise suppression |
135
|
|
|
|
136
|
|
|
:param qos: |
137
|
|
|
state of voice quality of service |
138
|
|
|
|
139
|
|
|
:param silence_warning: |
140
|
|
|
state of silence warning notice |
141
|
|
|
|
142
|
|
|
:param deaf: |
143
|
|
|
state of self-deafen |
144
|
|
|
|
145
|
|
|
:param mute: |
146
|
|
|
state of self-mute |
147
|
|
|
""" |
148
|
|
|
|
149
|
|
|
input: VoiceSettingsInput |
150
|
|
|
output: VoiceSettingsOutput |
151
|
|
|
automatic_gain_control: bool |
152
|
|
|
echo_cancellation: bool |
153
|
|
|
noise_suppression: bool |
154
|
|
|
qos: bool |
155
|
|
|
silence_warning: bool |
156
|
|
|
deaf: bool |
157
|
|
|
mute: bool |
158
|
|
|
|