ai-dev-browser 0.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ai_dev_browser/__init__.py +110 -0
- ai_dev_browser/_cli.py +428 -0
- ai_dev_browser/_version.py +13 -0
- ai_dev_browser/cdp/__init__.py +6 -0
- ai_dev_browser/cdp/accessibility.py +668 -0
- ai_dev_browser/cdp/animation.py +494 -0
- ai_dev_browser/cdp/audits.py +1990 -0
- ai_dev_browser/cdp/autofill.py +292 -0
- ai_dev_browser/cdp/background_service.py +215 -0
- ai_dev_browser/cdp/bluetooth_emulation.py +626 -0
- ai_dev_browser/cdp/browser.py +821 -0
- ai_dev_browser/cdp/cache_storage.py +311 -0
- ai_dev_browser/cdp/cast.py +172 -0
- ai_dev_browser/cdp/console.py +107 -0
- ai_dev_browser/cdp/crash_report_context.py +55 -0
- ai_dev_browser/cdp/css.py +2710 -0
- ai_dev_browser/cdp/debugger.py +1405 -0
- ai_dev_browser/cdp/device_access.py +141 -0
- ai_dev_browser/cdp/device_orientation.py +45 -0
- ai_dev_browser/cdp/dom.py +2257 -0
- ai_dev_browser/cdp/dom_debugger.py +321 -0
- ai_dev_browser/cdp/dom_snapshot.py +876 -0
- ai_dev_browser/cdp/dom_storage.py +222 -0
- ai_dev_browser/cdp/emulation.py +1779 -0
- ai_dev_browser/cdp/event_breakpoints.py +56 -0
- ai_dev_browser/cdp/extensions.py +246 -0
- ai_dev_browser/cdp/fed_cm.py +283 -0
- ai_dev_browser/cdp/fetch.py +507 -0
- ai_dev_browser/cdp/file_system.py +115 -0
- ai_dev_browser/cdp/headless_experimental.py +115 -0
- ai_dev_browser/cdp/heap_profiler.py +401 -0
- ai_dev_browser/cdp/indexed_db.py +528 -0
- ai_dev_browser/cdp/input_.py +701 -0
- ai_dev_browser/cdp/inspector.py +95 -0
- ai_dev_browser/cdp/io.py +101 -0
- ai_dev_browser/cdp/layer_tree.py +464 -0
- ai_dev_browser/cdp/log.py +190 -0
- ai_dev_browser/cdp/media.py +313 -0
- ai_dev_browser/cdp/memory.py +305 -0
- ai_dev_browser/cdp/network.py +5317 -0
- ai_dev_browser/cdp/overlay.py +1468 -0
- ai_dev_browser/cdp/page.py +3970 -0
- ai_dev_browser/cdp/performance.py +124 -0
- ai_dev_browser/cdp/performance_timeline.py +200 -0
- ai_dev_browser/cdp/preload.py +575 -0
- ai_dev_browser/cdp/profiler.py +420 -0
- ai_dev_browser/cdp/pwa.py +278 -0
- ai_dev_browser/cdp/py.typed +0 -0
- ai_dev_browser/cdp/runtime.py +1589 -0
- ai_dev_browser/cdp/schema.py +50 -0
- ai_dev_browser/cdp/security.py +518 -0
- ai_dev_browser/cdp/service_worker.py +401 -0
- ai_dev_browser/cdp/smart_card_emulation.py +891 -0
- ai_dev_browser/cdp/storage.py +1573 -0
- ai_dev_browser/cdp/system_info.py +327 -0
- ai_dev_browser/cdp/target.py +822 -0
- ai_dev_browser/cdp/tethering.py +65 -0
- ai_dev_browser/cdp/tracing.py +377 -0
- ai_dev_browser/cdp/util.py +17 -0
- ai_dev_browser/cdp/web_audio.py +606 -0
- ai_dev_browser/cdp/web_authn.py +598 -0
- ai_dev_browser/cdp/web_mcp.py +219 -0
- ai_dev_browser/core/__init__.py +218 -0
- ai_dev_browser/core/_case.py +38 -0
- ai_dev_browser/core/_cf_template.py +84 -0
- ai_dev_browser/core/_element.py +431 -0
- ai_dev_browser/core/_tab.py +817 -0
- ai_dev_browser/core/_transport.py +362 -0
- ai_dev_browser/core/ax.py +605 -0
- ai_dev_browser/core/browser.py +323 -0
- ai_dev_browser/core/cdp.py +66 -0
- ai_dev_browser/core/chrome.py +253 -0
- ai_dev_browser/core/cloudflare.py +77 -0
- ai_dev_browser/core/config.py +95 -0
- ai_dev_browser/core/connection.py +403 -0
- ai_dev_browser/core/cookies.py +103 -0
- ai_dev_browser/core/dialog.py +165 -0
- ai_dev_browser/core/download.py +38 -0
- ai_dev_browser/core/elements.py +913 -0
- ai_dev_browser/core/human.py +612 -0
- ai_dev_browser/core/login.py +122 -0
- ai_dev_browser/core/mouse.py +140 -0
- ai_dev_browser/core/navigation.py +225 -0
- ai_dev_browser/core/overlays.py +148 -0
- ai_dev_browser/core/page.py +302 -0
- ai_dev_browser/core/port.py +465 -0
- ai_dev_browser/core/process.py +114 -0
- ai_dev_browser/core/snapshot.py +425 -0
- ai_dev_browser/core/storage.py +50 -0
- ai_dev_browser/core/tabs.py +125 -0
- ai_dev_browser/core/text_match.py +217 -0
- ai_dev_browser/core/window.py +84 -0
- ai_dev_browser/pool/__init__.py +34 -0
- ai_dev_browser/pool/job.py +140 -0
- ai_dev_browser/pool/persistence.py +154 -0
- ai_dev_browser/pool/pool.py +873 -0
- ai_dev_browser/pool/worker.py +171 -0
- ai_dev_browser/profile.py +107 -0
- ai_dev_browser/py.typed +0 -0
- ai_dev_browser/tools/__init__.py +9 -0
- ai_dev_browser/tools/_generate.py +209 -0
- ai_dev_browser/tools/browser_list.py +14 -0
- ai_dev_browser/tools/browser_start.py +14 -0
- ai_dev_browser/tools/browser_stop.py +14 -0
- ai_dev_browser/tools/cdp_send.py +14 -0
- ai_dev_browser/tools/click_by_html_id.py +14 -0
- ai_dev_browser/tools/click_by_ref.py +14 -0
- ai_dev_browser/tools/click_by_text.py +14 -0
- ai_dev_browser/tools/click_by_xpath.py +14 -0
- ai_dev_browser/tools/cloudflare_verify.py +14 -0
- ai_dev_browser/tools/cookies_list.py +14 -0
- ai_dev_browser/tools/cookies_load.py +14 -0
- ai_dev_browser/tools/cookies_save.py +14 -0
- ai_dev_browser/tools/dialog_respond.py +14 -0
- ai_dev_browser/tools/download.py +14 -0
- ai_dev_browser/tools/drag_by_ref.py +14 -0
- ai_dev_browser/tools/find_by_html_id.py +14 -0
- ai_dev_browser/tools/find_by_xpath.py +14 -0
- ai_dev_browser/tools/focus_by_ref.py +14 -0
- ai_dev_browser/tools/highlight_by_ref.py +14 -0
- ai_dev_browser/tools/hover_by_ref.py +14 -0
- ai_dev_browser/tools/html_by_ref.py +14 -0
- ai_dev_browser/tools/js_evaluate.py +14 -0
- ai_dev_browser/tools/login_interactive.py +14 -0
- ai_dev_browser/tools/mouse_click.py +14 -0
- ai_dev_browser/tools/mouse_drag.py +14 -0
- ai_dev_browser/tools/mouse_move.py +14 -0
- ai_dev_browser/tools/page_discover.py +14 -0
- ai_dev_browser/tools/page_emulate_focus.py +14 -0
- ai_dev_browser/tools/page_goto.py +14 -0
- ai_dev_browser/tools/page_html.py +14 -0
- ai_dev_browser/tools/page_info.py +14 -0
- ai_dev_browser/tools/page_reload.py +14 -0
- ai_dev_browser/tools/page_screenshot.py +14 -0
- ai_dev_browser/tools/page_scroll.py +14 -0
- ai_dev_browser/tools/page_wait_element.py +14 -0
- ai_dev_browser/tools/page_wait_ready.py +14 -0
- ai_dev_browser/tools/page_wait_url.py +14 -0
- ai_dev_browser/tools/screenshot_by_ref.py +14 -0
- ai_dev_browser/tools/select_by_ref.py +14 -0
- ai_dev_browser/tools/storage_get.py +14 -0
- ai_dev_browser/tools/storage_set.py +14 -0
- ai_dev_browser/tools/tab_close.py +14 -0
- ai_dev_browser/tools/tab_list.py +14 -0
- ai_dev_browser/tools/tab_new.py +14 -0
- ai_dev_browser/tools/tab_switch.py +14 -0
- ai_dev_browser/tools/type_by_ref.py +14 -0
- ai_dev_browser/tools/type_by_text.py +14 -0
- ai_dev_browser/tools/upload_by_ref.py +14 -0
- ai_dev_browser/tools/window_set.py +14 -0
- ai_dev_browser-0.5.3.dist-info/METADATA +177 -0
- ai_dev_browser-0.5.3.dist-info/RECORD +155 -0
- ai_dev_browser-0.5.3.dist-info/WHEEL +5 -0
- ai_dev_browser-0.5.3.dist-info/licenses/LICENSE +25 -0
- ai_dev_browser-0.5.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: WebAudio (experimental)
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class GraphObjectId(str):
|
|
16
|
+
'''
|
|
17
|
+
An unique ID for a graph object (AudioContext, AudioNode, AudioParam) in Web Audio API
|
|
18
|
+
'''
|
|
19
|
+
def to_json(self) -> str:
|
|
20
|
+
return self
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def from_json(cls, json: str) -> GraphObjectId:
|
|
24
|
+
return cls(json)
|
|
25
|
+
|
|
26
|
+
def __repr__(self):
|
|
27
|
+
return 'GraphObjectId({})'.format(super().__repr__())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ContextType(enum.Enum):
|
|
31
|
+
'''
|
|
32
|
+
Enum of BaseAudioContext types
|
|
33
|
+
'''
|
|
34
|
+
REALTIME = "realtime"
|
|
35
|
+
OFFLINE = "offline"
|
|
36
|
+
|
|
37
|
+
def to_json(self) -> str:
|
|
38
|
+
return self.value
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def from_json(cls, json: str) -> ContextType:
|
|
42
|
+
return cls(json)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ContextState(enum.Enum):
|
|
46
|
+
'''
|
|
47
|
+
Enum of AudioContextState from the spec
|
|
48
|
+
'''
|
|
49
|
+
SUSPENDED = "suspended"
|
|
50
|
+
RUNNING = "running"
|
|
51
|
+
CLOSED = "closed"
|
|
52
|
+
INTERRUPTED = "interrupted"
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
return self.value
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json: str) -> ContextState:
|
|
59
|
+
return cls(json)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class NodeType(str):
|
|
63
|
+
'''
|
|
64
|
+
Enum of AudioNode types
|
|
65
|
+
'''
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
return self
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json: str) -> NodeType:
|
|
71
|
+
return cls(json)
|
|
72
|
+
|
|
73
|
+
def __repr__(self):
|
|
74
|
+
return 'NodeType({})'.format(super().__repr__())
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ChannelCountMode(enum.Enum):
|
|
78
|
+
'''
|
|
79
|
+
Enum of AudioNode::ChannelCountMode from the spec
|
|
80
|
+
'''
|
|
81
|
+
CLAMPED_MAX = "clamped-max"
|
|
82
|
+
EXPLICIT = "explicit"
|
|
83
|
+
MAX_ = "max"
|
|
84
|
+
|
|
85
|
+
def to_json(self) -> str:
|
|
86
|
+
return self.value
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json: str) -> ChannelCountMode:
|
|
90
|
+
return cls(json)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ChannelInterpretation(enum.Enum):
|
|
94
|
+
'''
|
|
95
|
+
Enum of AudioNode::ChannelInterpretation from the spec
|
|
96
|
+
'''
|
|
97
|
+
DISCRETE = "discrete"
|
|
98
|
+
SPEAKERS = "speakers"
|
|
99
|
+
|
|
100
|
+
def to_json(self) -> str:
|
|
101
|
+
return self.value
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_json(cls, json: str) -> ChannelInterpretation:
|
|
105
|
+
return cls(json)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class ParamType(str):
|
|
109
|
+
'''
|
|
110
|
+
Enum of AudioParam types
|
|
111
|
+
'''
|
|
112
|
+
def to_json(self) -> str:
|
|
113
|
+
return self
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_json(cls, json: str) -> ParamType:
|
|
117
|
+
return cls(json)
|
|
118
|
+
|
|
119
|
+
def __repr__(self):
|
|
120
|
+
return 'ParamType({})'.format(super().__repr__())
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class AutomationRate(enum.Enum):
|
|
124
|
+
'''
|
|
125
|
+
Enum of AudioParam::AutomationRate from the spec
|
|
126
|
+
'''
|
|
127
|
+
A_RATE = "a-rate"
|
|
128
|
+
K_RATE = "k-rate"
|
|
129
|
+
|
|
130
|
+
def to_json(self) -> str:
|
|
131
|
+
return self.value
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_json(cls, json: str) -> AutomationRate:
|
|
135
|
+
return cls(json)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@dataclass
|
|
139
|
+
class ContextRealtimeData:
|
|
140
|
+
'''
|
|
141
|
+
Fields in AudioContext that change in real-time.
|
|
142
|
+
'''
|
|
143
|
+
#: The current context time in second in BaseAudioContext.
|
|
144
|
+
current_time: float
|
|
145
|
+
|
|
146
|
+
#: The time spent on rendering graph divided by render quantum duration,
|
|
147
|
+
#: and multiplied by 100. 100 means the audio renderer reached the full
|
|
148
|
+
#: capacity and glitch may occur.
|
|
149
|
+
render_capacity: float
|
|
150
|
+
|
|
151
|
+
#: A running mean of callback interval.
|
|
152
|
+
callback_interval_mean: float
|
|
153
|
+
|
|
154
|
+
#: A running variance of callback interval.
|
|
155
|
+
callback_interval_variance: float
|
|
156
|
+
|
|
157
|
+
def to_json(self) -> T_JSON_DICT:
|
|
158
|
+
json: T_JSON_DICT = dict()
|
|
159
|
+
json['currentTime'] = self.current_time
|
|
160
|
+
json['renderCapacity'] = self.render_capacity
|
|
161
|
+
json['callbackIntervalMean'] = self.callback_interval_mean
|
|
162
|
+
json['callbackIntervalVariance'] = self.callback_interval_variance
|
|
163
|
+
return json
|
|
164
|
+
|
|
165
|
+
@classmethod
|
|
166
|
+
def from_json(cls, json: T_JSON_DICT) -> ContextRealtimeData:
|
|
167
|
+
return cls(
|
|
168
|
+
current_time=float(json['currentTime']),
|
|
169
|
+
render_capacity=float(json['renderCapacity']),
|
|
170
|
+
callback_interval_mean=float(json['callbackIntervalMean']),
|
|
171
|
+
callback_interval_variance=float(json['callbackIntervalVariance']),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@dataclass
|
|
176
|
+
class BaseAudioContext:
|
|
177
|
+
'''
|
|
178
|
+
Protocol object for BaseAudioContext
|
|
179
|
+
'''
|
|
180
|
+
context_id: GraphObjectId
|
|
181
|
+
|
|
182
|
+
context_type: ContextType
|
|
183
|
+
|
|
184
|
+
context_state: ContextState
|
|
185
|
+
|
|
186
|
+
#: Platform-dependent callback buffer size.
|
|
187
|
+
callback_buffer_size: float
|
|
188
|
+
|
|
189
|
+
#: Number of output channels supported by audio hardware in use.
|
|
190
|
+
max_output_channel_count: float
|
|
191
|
+
|
|
192
|
+
#: Context sample rate.
|
|
193
|
+
sample_rate: float
|
|
194
|
+
|
|
195
|
+
realtime_data: typing.Optional[ContextRealtimeData] = None
|
|
196
|
+
|
|
197
|
+
def to_json(self) -> T_JSON_DICT:
|
|
198
|
+
json: T_JSON_DICT = dict()
|
|
199
|
+
json['contextId'] = self.context_id.to_json()
|
|
200
|
+
json['contextType'] = self.context_type.to_json()
|
|
201
|
+
json['contextState'] = self.context_state.to_json()
|
|
202
|
+
json['callbackBufferSize'] = self.callback_buffer_size
|
|
203
|
+
json['maxOutputChannelCount'] = self.max_output_channel_count
|
|
204
|
+
json['sampleRate'] = self.sample_rate
|
|
205
|
+
if self.realtime_data is not None:
|
|
206
|
+
json['realtimeData'] = self.realtime_data.to_json()
|
|
207
|
+
return json
|
|
208
|
+
|
|
209
|
+
@classmethod
|
|
210
|
+
def from_json(cls, json: T_JSON_DICT) -> BaseAudioContext:
|
|
211
|
+
return cls(
|
|
212
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
213
|
+
context_type=ContextType.from_json(json['contextType']),
|
|
214
|
+
context_state=ContextState.from_json(json['contextState']),
|
|
215
|
+
callback_buffer_size=float(json['callbackBufferSize']),
|
|
216
|
+
max_output_channel_count=float(json['maxOutputChannelCount']),
|
|
217
|
+
sample_rate=float(json['sampleRate']),
|
|
218
|
+
realtime_data=ContextRealtimeData.from_json(json['realtimeData']) if json.get('realtimeData', None) is not None else None,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@dataclass
|
|
223
|
+
class AudioListener:
|
|
224
|
+
'''
|
|
225
|
+
Protocol object for AudioListener
|
|
226
|
+
'''
|
|
227
|
+
listener_id: GraphObjectId
|
|
228
|
+
|
|
229
|
+
context_id: GraphObjectId
|
|
230
|
+
|
|
231
|
+
def to_json(self) -> T_JSON_DICT:
|
|
232
|
+
json: T_JSON_DICT = dict()
|
|
233
|
+
json['listenerId'] = self.listener_id.to_json()
|
|
234
|
+
json['contextId'] = self.context_id.to_json()
|
|
235
|
+
return json
|
|
236
|
+
|
|
237
|
+
@classmethod
|
|
238
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioListener:
|
|
239
|
+
return cls(
|
|
240
|
+
listener_id=GraphObjectId.from_json(json['listenerId']),
|
|
241
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@dataclass
|
|
246
|
+
class AudioNode:
|
|
247
|
+
'''
|
|
248
|
+
Protocol object for AudioNode
|
|
249
|
+
'''
|
|
250
|
+
node_id: GraphObjectId
|
|
251
|
+
|
|
252
|
+
context_id: GraphObjectId
|
|
253
|
+
|
|
254
|
+
node_type: NodeType
|
|
255
|
+
|
|
256
|
+
number_of_inputs: float
|
|
257
|
+
|
|
258
|
+
number_of_outputs: float
|
|
259
|
+
|
|
260
|
+
channel_count: float
|
|
261
|
+
|
|
262
|
+
channel_count_mode: ChannelCountMode
|
|
263
|
+
|
|
264
|
+
channel_interpretation: ChannelInterpretation
|
|
265
|
+
|
|
266
|
+
def to_json(self) -> T_JSON_DICT:
|
|
267
|
+
json: T_JSON_DICT = dict()
|
|
268
|
+
json['nodeId'] = self.node_id.to_json()
|
|
269
|
+
json['contextId'] = self.context_id.to_json()
|
|
270
|
+
json['nodeType'] = self.node_type.to_json()
|
|
271
|
+
json['numberOfInputs'] = self.number_of_inputs
|
|
272
|
+
json['numberOfOutputs'] = self.number_of_outputs
|
|
273
|
+
json['channelCount'] = self.channel_count
|
|
274
|
+
json['channelCountMode'] = self.channel_count_mode.to_json()
|
|
275
|
+
json['channelInterpretation'] = self.channel_interpretation.to_json()
|
|
276
|
+
return json
|
|
277
|
+
|
|
278
|
+
@classmethod
|
|
279
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioNode:
|
|
280
|
+
return cls(
|
|
281
|
+
node_id=GraphObjectId.from_json(json['nodeId']),
|
|
282
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
283
|
+
node_type=NodeType.from_json(json['nodeType']),
|
|
284
|
+
number_of_inputs=float(json['numberOfInputs']),
|
|
285
|
+
number_of_outputs=float(json['numberOfOutputs']),
|
|
286
|
+
channel_count=float(json['channelCount']),
|
|
287
|
+
channel_count_mode=ChannelCountMode.from_json(json['channelCountMode']),
|
|
288
|
+
channel_interpretation=ChannelInterpretation.from_json(json['channelInterpretation']),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@dataclass
|
|
293
|
+
class AudioParam:
|
|
294
|
+
'''
|
|
295
|
+
Protocol object for AudioParam
|
|
296
|
+
'''
|
|
297
|
+
param_id: GraphObjectId
|
|
298
|
+
|
|
299
|
+
node_id: GraphObjectId
|
|
300
|
+
|
|
301
|
+
context_id: GraphObjectId
|
|
302
|
+
|
|
303
|
+
param_type: ParamType
|
|
304
|
+
|
|
305
|
+
rate: AutomationRate
|
|
306
|
+
|
|
307
|
+
default_value: float
|
|
308
|
+
|
|
309
|
+
min_value: float
|
|
310
|
+
|
|
311
|
+
max_value: float
|
|
312
|
+
|
|
313
|
+
def to_json(self) -> T_JSON_DICT:
|
|
314
|
+
json: T_JSON_DICT = dict()
|
|
315
|
+
json['paramId'] = self.param_id.to_json()
|
|
316
|
+
json['nodeId'] = self.node_id.to_json()
|
|
317
|
+
json['contextId'] = self.context_id.to_json()
|
|
318
|
+
json['paramType'] = self.param_type.to_json()
|
|
319
|
+
json['rate'] = self.rate.to_json()
|
|
320
|
+
json['defaultValue'] = self.default_value
|
|
321
|
+
json['minValue'] = self.min_value
|
|
322
|
+
json['maxValue'] = self.max_value
|
|
323
|
+
return json
|
|
324
|
+
|
|
325
|
+
@classmethod
|
|
326
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioParam:
|
|
327
|
+
return cls(
|
|
328
|
+
param_id=GraphObjectId.from_json(json['paramId']),
|
|
329
|
+
node_id=GraphObjectId.from_json(json['nodeId']),
|
|
330
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
331
|
+
param_type=ParamType.from_json(json['paramType']),
|
|
332
|
+
rate=AutomationRate.from_json(json['rate']),
|
|
333
|
+
default_value=float(json['defaultValue']),
|
|
334
|
+
min_value=float(json['minValue']),
|
|
335
|
+
max_value=float(json['maxValue']),
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
340
|
+
'''
|
|
341
|
+
Enables the WebAudio domain and starts sending context lifetime events.
|
|
342
|
+
'''
|
|
343
|
+
cmd_dict: T_JSON_DICT = {
|
|
344
|
+
'method': 'WebAudio.enable',
|
|
345
|
+
}
|
|
346
|
+
json = yield cmd_dict
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
350
|
+
'''
|
|
351
|
+
Disables the WebAudio domain.
|
|
352
|
+
'''
|
|
353
|
+
cmd_dict: T_JSON_DICT = {
|
|
354
|
+
'method': 'WebAudio.disable',
|
|
355
|
+
}
|
|
356
|
+
json = yield cmd_dict
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def get_realtime_data(
|
|
360
|
+
context_id: GraphObjectId
|
|
361
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ContextRealtimeData]:
|
|
362
|
+
'''
|
|
363
|
+
Fetch the realtime data from the registered contexts.
|
|
364
|
+
|
|
365
|
+
:param context_id:
|
|
366
|
+
:returns:
|
|
367
|
+
'''
|
|
368
|
+
params: T_JSON_DICT = dict()
|
|
369
|
+
params['contextId'] = context_id.to_json()
|
|
370
|
+
cmd_dict: T_JSON_DICT = {
|
|
371
|
+
'method': 'WebAudio.getRealtimeData',
|
|
372
|
+
'params': params,
|
|
373
|
+
}
|
|
374
|
+
json = yield cmd_dict
|
|
375
|
+
return ContextRealtimeData.from_json(json['realtimeData'])
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
@event_class('WebAudio.contextCreated')
|
|
379
|
+
@dataclass
|
|
380
|
+
class ContextCreated:
|
|
381
|
+
'''
|
|
382
|
+
Notifies that a new BaseAudioContext has been created.
|
|
383
|
+
'''
|
|
384
|
+
context: BaseAudioContext
|
|
385
|
+
|
|
386
|
+
@classmethod
|
|
387
|
+
def from_json(cls, json: T_JSON_DICT) -> ContextCreated:
|
|
388
|
+
return cls(
|
|
389
|
+
context=BaseAudioContext.from_json(json['context'])
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
@event_class('WebAudio.contextWillBeDestroyed')
|
|
394
|
+
@dataclass
|
|
395
|
+
class ContextWillBeDestroyed:
|
|
396
|
+
'''
|
|
397
|
+
Notifies that an existing BaseAudioContext will be destroyed.
|
|
398
|
+
'''
|
|
399
|
+
context_id: GraphObjectId
|
|
400
|
+
|
|
401
|
+
@classmethod
|
|
402
|
+
def from_json(cls, json: T_JSON_DICT) -> ContextWillBeDestroyed:
|
|
403
|
+
return cls(
|
|
404
|
+
context_id=GraphObjectId.from_json(json['contextId'])
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
@event_class('WebAudio.contextChanged')
|
|
409
|
+
@dataclass
|
|
410
|
+
class ContextChanged:
|
|
411
|
+
'''
|
|
412
|
+
Notifies that existing BaseAudioContext has changed some properties (id stays the same)..
|
|
413
|
+
'''
|
|
414
|
+
context: BaseAudioContext
|
|
415
|
+
|
|
416
|
+
@classmethod
|
|
417
|
+
def from_json(cls, json: T_JSON_DICT) -> ContextChanged:
|
|
418
|
+
return cls(
|
|
419
|
+
context=BaseAudioContext.from_json(json['context'])
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
@event_class('WebAudio.audioListenerCreated')
|
|
424
|
+
@dataclass
|
|
425
|
+
class AudioListenerCreated:
|
|
426
|
+
'''
|
|
427
|
+
Notifies that the construction of an AudioListener has finished.
|
|
428
|
+
'''
|
|
429
|
+
listener: AudioListener
|
|
430
|
+
|
|
431
|
+
@classmethod
|
|
432
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioListenerCreated:
|
|
433
|
+
return cls(
|
|
434
|
+
listener=AudioListener.from_json(json['listener'])
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
@event_class('WebAudio.audioListenerWillBeDestroyed')
|
|
439
|
+
@dataclass
|
|
440
|
+
class AudioListenerWillBeDestroyed:
|
|
441
|
+
'''
|
|
442
|
+
Notifies that a new AudioListener has been created.
|
|
443
|
+
'''
|
|
444
|
+
context_id: GraphObjectId
|
|
445
|
+
listener_id: GraphObjectId
|
|
446
|
+
|
|
447
|
+
@classmethod
|
|
448
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioListenerWillBeDestroyed:
|
|
449
|
+
return cls(
|
|
450
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
451
|
+
listener_id=GraphObjectId.from_json(json['listenerId'])
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
@event_class('WebAudio.audioNodeCreated')
|
|
456
|
+
@dataclass
|
|
457
|
+
class AudioNodeCreated:
|
|
458
|
+
'''
|
|
459
|
+
Notifies that a new AudioNode has been created.
|
|
460
|
+
'''
|
|
461
|
+
node: AudioNode
|
|
462
|
+
|
|
463
|
+
@classmethod
|
|
464
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioNodeCreated:
|
|
465
|
+
return cls(
|
|
466
|
+
node=AudioNode.from_json(json['node'])
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
@event_class('WebAudio.audioNodeWillBeDestroyed')
|
|
471
|
+
@dataclass
|
|
472
|
+
class AudioNodeWillBeDestroyed:
|
|
473
|
+
'''
|
|
474
|
+
Notifies that an existing AudioNode has been destroyed.
|
|
475
|
+
'''
|
|
476
|
+
context_id: GraphObjectId
|
|
477
|
+
node_id: GraphObjectId
|
|
478
|
+
|
|
479
|
+
@classmethod
|
|
480
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioNodeWillBeDestroyed:
|
|
481
|
+
return cls(
|
|
482
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
483
|
+
node_id=GraphObjectId.from_json(json['nodeId'])
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
@event_class('WebAudio.audioParamCreated')
|
|
488
|
+
@dataclass
|
|
489
|
+
class AudioParamCreated:
|
|
490
|
+
'''
|
|
491
|
+
Notifies that a new AudioParam has been created.
|
|
492
|
+
'''
|
|
493
|
+
param: AudioParam
|
|
494
|
+
|
|
495
|
+
@classmethod
|
|
496
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioParamCreated:
|
|
497
|
+
return cls(
|
|
498
|
+
param=AudioParam.from_json(json['param'])
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
@event_class('WebAudio.audioParamWillBeDestroyed')
|
|
503
|
+
@dataclass
|
|
504
|
+
class AudioParamWillBeDestroyed:
|
|
505
|
+
'''
|
|
506
|
+
Notifies that an existing AudioParam has been destroyed.
|
|
507
|
+
'''
|
|
508
|
+
context_id: GraphObjectId
|
|
509
|
+
node_id: GraphObjectId
|
|
510
|
+
param_id: GraphObjectId
|
|
511
|
+
|
|
512
|
+
@classmethod
|
|
513
|
+
def from_json(cls, json: T_JSON_DICT) -> AudioParamWillBeDestroyed:
|
|
514
|
+
return cls(
|
|
515
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
516
|
+
node_id=GraphObjectId.from_json(json['nodeId']),
|
|
517
|
+
param_id=GraphObjectId.from_json(json['paramId'])
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
@event_class('WebAudio.nodesConnected')
|
|
522
|
+
@dataclass
|
|
523
|
+
class NodesConnected:
|
|
524
|
+
'''
|
|
525
|
+
Notifies that two AudioNodes are connected.
|
|
526
|
+
'''
|
|
527
|
+
context_id: GraphObjectId
|
|
528
|
+
source_id: GraphObjectId
|
|
529
|
+
destination_id: GraphObjectId
|
|
530
|
+
source_output_index: typing.Optional[float]
|
|
531
|
+
destination_input_index: typing.Optional[float]
|
|
532
|
+
|
|
533
|
+
@classmethod
|
|
534
|
+
def from_json(cls, json: T_JSON_DICT) -> NodesConnected:
|
|
535
|
+
return cls(
|
|
536
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
537
|
+
source_id=GraphObjectId.from_json(json['sourceId']),
|
|
538
|
+
destination_id=GraphObjectId.from_json(json['destinationId']),
|
|
539
|
+
source_output_index=float(json['sourceOutputIndex']) if json.get('sourceOutputIndex', None) is not None else None,
|
|
540
|
+
destination_input_index=float(json['destinationInputIndex']) if json.get('destinationInputIndex', None) is not None else None
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
@event_class('WebAudio.nodesDisconnected')
|
|
545
|
+
@dataclass
|
|
546
|
+
class NodesDisconnected:
|
|
547
|
+
'''
|
|
548
|
+
Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected.
|
|
549
|
+
'''
|
|
550
|
+
context_id: GraphObjectId
|
|
551
|
+
source_id: GraphObjectId
|
|
552
|
+
destination_id: GraphObjectId
|
|
553
|
+
source_output_index: typing.Optional[float]
|
|
554
|
+
destination_input_index: typing.Optional[float]
|
|
555
|
+
|
|
556
|
+
@classmethod
|
|
557
|
+
def from_json(cls, json: T_JSON_DICT) -> NodesDisconnected:
|
|
558
|
+
return cls(
|
|
559
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
560
|
+
source_id=GraphObjectId.from_json(json['sourceId']),
|
|
561
|
+
destination_id=GraphObjectId.from_json(json['destinationId']),
|
|
562
|
+
source_output_index=float(json['sourceOutputIndex']) if json.get('sourceOutputIndex', None) is not None else None,
|
|
563
|
+
destination_input_index=float(json['destinationInputIndex']) if json.get('destinationInputIndex', None) is not None else None
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
@event_class('WebAudio.nodeParamConnected')
|
|
568
|
+
@dataclass
|
|
569
|
+
class NodeParamConnected:
|
|
570
|
+
'''
|
|
571
|
+
Notifies that an AudioNode is connected to an AudioParam.
|
|
572
|
+
'''
|
|
573
|
+
context_id: GraphObjectId
|
|
574
|
+
source_id: GraphObjectId
|
|
575
|
+
destination_id: GraphObjectId
|
|
576
|
+
source_output_index: typing.Optional[float]
|
|
577
|
+
|
|
578
|
+
@classmethod
|
|
579
|
+
def from_json(cls, json: T_JSON_DICT) -> NodeParamConnected:
|
|
580
|
+
return cls(
|
|
581
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
582
|
+
source_id=GraphObjectId.from_json(json['sourceId']),
|
|
583
|
+
destination_id=GraphObjectId.from_json(json['destinationId']),
|
|
584
|
+
source_output_index=float(json['sourceOutputIndex']) if json.get('sourceOutputIndex', None) is not None else None
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
@event_class('WebAudio.nodeParamDisconnected')
|
|
589
|
+
@dataclass
|
|
590
|
+
class NodeParamDisconnected:
|
|
591
|
+
'''
|
|
592
|
+
Notifies that an AudioNode is disconnected to an AudioParam.
|
|
593
|
+
'''
|
|
594
|
+
context_id: GraphObjectId
|
|
595
|
+
source_id: GraphObjectId
|
|
596
|
+
destination_id: GraphObjectId
|
|
597
|
+
source_output_index: typing.Optional[float]
|
|
598
|
+
|
|
599
|
+
@classmethod
|
|
600
|
+
def from_json(cls, json: T_JSON_DICT) -> NodeParamDisconnected:
|
|
601
|
+
return cls(
|
|
602
|
+
context_id=GraphObjectId.from_json(json['contextId']),
|
|
603
|
+
source_id=GraphObjectId.from_json(json['sourceId']),
|
|
604
|
+
destination_id=GraphObjectId.from_json(json['destinationId']),
|
|
605
|
+
source_output_index=float(json['sourceOutputIndex']) if json.get('sourceOutputIndex', None) is not None else None
|
|
606
|
+
)
|