parsek-cdp 0.1.0__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.
- parsek_cdp/__init__.py +55 -0
- parsek_cdp/_logging.py +49 -0
- parsek_cdp/cdp/__init__.py +247 -0
- parsek_cdp/cdp/accessibility/__init__.py +15 -0
- parsek_cdp/cdp/accessibility/events.py +35 -0
- parsek_cdp/cdp/accessibility/functions.py +202 -0
- parsek_cdp/cdp/accessibility/types.py +235 -0
- parsek_cdp/cdp/animation/__init__.py +15 -0
- parsek_cdp/cdp/animation/events.py +52 -0
- parsek_cdp/cdp/animation/functions.py +140 -0
- parsek_cdp/cdp/animation/types.py +113 -0
- parsek_cdp/cdp/audits/__init__.py +15 -0
- parsek_cdp/cdp/audits/events.py +21 -0
- parsek_cdp/cdp/audits/functions.py +95 -0
- parsek_cdp/cdp/audits/types.py +1051 -0
- parsek_cdp/cdp/autofill/__init__.py +15 -0
- parsek_cdp/cdp/autofill/events.py +27 -0
- parsek_cdp/cdp/autofill/functions.py +64 -0
- parsek_cdp/cdp/autofill/types.py +108 -0
- parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
- parsek_cdp/cdp/backgroundservice/events.py +40 -0
- parsek_cdp/cdp/backgroundservice/functions.py +59 -0
- parsek_cdp/cdp/backgroundservice/types.py +63 -0
- parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
- parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
- parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
- parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
- parsek_cdp/cdp/browser/__init__.py +15 -0
- parsek_cdp/cdp/browser/events.py +46 -0
- parsek_cdp/cdp/browser/functions.py +350 -0
- parsek_cdp/cdp/browser/types.py +158 -0
- parsek_cdp/cdp/cachestorage/__init__.py +15 -0
- parsek_cdp/cdp/cachestorage/events.py +13 -0
- parsek_cdp/cdp/cachestorage/functions.py +126 -0
- parsek_cdp/cdp/cachestorage/types.py +89 -0
- parsek_cdp/cdp/cast/__init__.py +15 -0
- parsek_cdp/cdp/cast/events.py +38 -0
- parsek_cdp/cdp/cast/functions.py +77 -0
- parsek_cdp/cdp/cast/types.py +23 -0
- parsek_cdp/cdp/console/__init__.py +15 -0
- parsek_cdp/cdp/console/events.py +22 -0
- parsek_cdp/cdp/console/functions.py +36 -0
- parsek_cdp/cdp/console/types.py +30 -0
- parsek_cdp/cdp/css/__init__.py +15 -0
- parsek_cdp/cdp/css/events.py +79 -0
- parsek_cdp/cdp/css/functions.py +788 -0
- parsek_cdp/cdp/css/types.py +742 -0
- parsek_cdp/cdp/debugger/__init__.py +15 -0
- parsek_cdp/cdp/debugger/events.py +164 -0
- parsek_cdp/cdp/debugger/functions.py +663 -0
- parsek_cdp/cdp/debugger/types.py +171 -0
- parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
- parsek_cdp/cdp/deviceaccess/events.py +30 -0
- parsek_cdp/cdp/deviceaccess/functions.py +54 -0
- parsek_cdp/cdp/deviceaccess/types.py +28 -0
- parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
- parsek_cdp/cdp/deviceorientation/events.py +13 -0
- parsek_cdp/cdp/deviceorientation/functions.py +35 -0
- parsek_cdp/cdp/deviceorientation/types.py +10 -0
- parsek_cdp/cdp/dom/__init__.py +15 -0
- parsek_cdp/cdp/dom/events.py +228 -0
- parsek_cdp/cdp/dom/functions.py +1033 -0
- parsek_cdp/cdp/dom/types.py +293 -0
- parsek_cdp/cdp/domdebugger/__init__.py +15 -0
- parsek_cdp/cdp/domdebugger/events.py +13 -0
- parsek_cdp/cdp/domdebugger/functions.py +155 -0
- parsek_cdp/cdp/domdebugger/types.py +57 -0
- parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
- parsek_cdp/cdp/domsnapshot/events.py +13 -0
- parsek_cdp/cdp/domsnapshot/functions.py +111 -0
- parsek_cdp/cdp/domsnapshot/types.py +312 -0
- parsek_cdp/cdp/domstorage/__init__.py +15 -0
- parsek_cdp/cdp/domstorage/events.py +60 -0
- parsek_cdp/cdp/domstorage/functions.py +79 -0
- parsek_cdp/cdp/domstorage/types.py +30 -0
- parsek_cdp/cdp/emulation/__init__.py +15 -0
- parsek_cdp/cdp/emulation/events.py +17 -0
- parsek_cdp/cdp/emulation/functions.py +688 -0
- parsek_cdp/cdp/emulation/types.py +305 -0
- parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
- parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
- parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
- parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
- parsek_cdp/cdp/extensions/__init__.py +15 -0
- parsek_cdp/cdp/extensions/events.py +13 -0
- parsek_cdp/cdp/extensions/functions.py +118 -0
- parsek_cdp/cdp/extensions/types.py +19 -0
- parsek_cdp/cdp/fedcm/__init__.py +15 -0
- parsek_cdp/cdp/fedcm/events.py +45 -0
- parsek_cdp/cdp/fedcm/functions.py +93 -0
- parsek_cdp/cdp/fedcm/types.py +72 -0
- parsek_cdp/cdp/fetch/__init__.py +15 -0
- parsek_cdp/cdp/fetch/events.py +82 -0
- parsek_cdp/cdp/fetch/functions.py +215 -0
- parsek_cdp/cdp/fetch/types.py +81 -0
- parsek_cdp/cdp/filesystem/__init__.py +15 -0
- parsek_cdp/cdp/filesystem/events.py +13 -0
- parsek_cdp/cdp/filesystem/functions.py +36 -0
- parsek_cdp/cdp/filesystem/types.py +54 -0
- parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
- parsek_cdp/cdp/headlessexperimental/events.py +13 -0
- parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
- parsek_cdp/cdp/headlessexperimental/types.py +24 -0
- parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
- parsek_cdp/cdp/heapprofiler/events.py +65 -0
- parsek_cdp/cdp/heapprofiler/functions.py +193 -0
- parsek_cdp/cdp/heapprofiler/types.py +57 -0
- parsek_cdp/cdp/indexeddb/__init__.py +15 -0
- parsek_cdp/cdp/indexeddb/events.py +13 -0
- parsek_cdp/cdp/indexeddb/functions.py +232 -0
- parsek_cdp/cdp/indexeddb/types.py +120 -0
- parsek_cdp/cdp/input/__init__.py +15 -0
- parsek_cdp/cdp/input/events.py +25 -0
- parsek_cdp/cdp/input/functions.py +361 -0
- parsek_cdp/cdp/input/types.py +87 -0
- parsek_cdp/cdp/inspector/__init__.py +15 -0
- parsek_cdp/cdp/inspector/events.py +41 -0
- parsek_cdp/cdp/inspector/functions.py +27 -0
- parsek_cdp/cdp/inspector/types.py +10 -0
- parsek_cdp/cdp/io/__init__.py +15 -0
- parsek_cdp/cdp/io/events.py +13 -0
- parsek_cdp/cdp/io/functions.py +77 -0
- parsek_cdp/cdp/io/types.py +13 -0
- parsek_cdp/cdp/layertree/__init__.py +15 -0
- parsek_cdp/cdp/layertree/events.py +36 -0
- parsek_cdp/cdp/layertree/functions.py +178 -0
- parsek_cdp/cdp/layertree/types.py +104 -0
- parsek_cdp/cdp/log/__init__.py +15 -0
- parsek_cdp/cdp/log/events.py +22 -0
- parsek_cdp/cdp/log/functions.py +54 -0
- parsek_cdp/cdp/log/types.py +57 -0
- parsek_cdp/cdp/media/__init__.py +15 -0
- parsek_cdp/cdp/media/events.py +87 -0
- parsek_cdp/cdp/media/functions.py +27 -0
- parsek_cdp/cdp/media/types.py +101 -0
- parsek_cdp/cdp/memory/__init__.py +15 -0
- parsek_cdp/cdp/memory/events.py +13 -0
- parsek_cdp/cdp/memory/functions.py +164 -0
- parsek_cdp/cdp/memory/types.py +71 -0
- parsek_cdp/cdp/mixins/__init__.py +21 -0
- parsek_cdp/cdp/mixins/datatype.py +123 -0
- parsek_cdp/cdp/mixins/event.py +78 -0
- parsek_cdp/cdp/mixins/namespace.py +31 -0
- parsek_cdp/cdp/network/__init__.py +15 -0
- parsek_cdp/cdp/network/events.py +726 -0
- parsek_cdp/cdp/network/functions.py +734 -0
- parsek_cdp/cdp/network/types.py +1247 -0
- parsek_cdp/cdp/overlay/__init__.py +15 -0
- parsek_cdp/cdp/overlay/events.py +54 -0
- parsek_cdp/cdp/overlay/functions.py +407 -0
- parsek_cdp/cdp/overlay/types.py +328 -0
- parsek_cdp/cdp/page/__init__.py +15 -0
- parsek_cdp/cdp/page/events.py +416 -0
- parsek_cdp/cdp/page/functions.py +1081 -0
- parsek_cdp/cdp/page/types.py +1088 -0
- parsek_cdp/cdp/performance/__init__.py +15 -0
- parsek_cdp/cdp/performance/events.py +24 -0
- parsek_cdp/cdp/performance/functions.py +63 -0
- parsek_cdp/cdp/performance/types.py +22 -0
- parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
- parsek_cdp/cdp/performancetimeline/events.py +22 -0
- parsek_cdp/cdp/performancetimeline/functions.py +30 -0
- parsek_cdp/cdp/performancetimeline/types.py +85 -0
- parsek_cdp/cdp/preload/__init__.py +15 -0
- parsek_cdp/cdp/preload/events.py +116 -0
- parsek_cdp/cdp/preload/functions.py +25 -0
- parsek_cdp/cdp/preload/types.py +267 -0
- parsek_cdp/cdp/profiler/__init__.py +15 -0
- parsek_cdp/cdp/profiler/events.py +64 -0
- parsek_cdp/cdp/profiler/functions.py +134 -0
- parsek_cdp/cdp/profiler/types.py +105 -0
- parsek_cdp/cdp/pwa/__init__.py +15 -0
- parsek_cdp/cdp/pwa/events.py +13 -0
- parsek_cdp/cdp/pwa/functions.py +196 -0
- parsek_cdp/cdp/pwa/types.py +45 -0
- parsek_cdp/cdp/runtime/__init__.py +15 -0
- parsek_cdp/cdp/runtime/events.py +123 -0
- parsek_cdp/cdp/runtime/functions.py +552 -0
- parsek_cdp/cdp/runtime/types.py +319 -0
- parsek_cdp/cdp/schema/__init__.py +15 -0
- parsek_cdp/cdp/schema/events.py +13 -0
- parsek_cdp/cdp/schema/functions.py +32 -0
- parsek_cdp/cdp/schema/types.py +22 -0
- parsek_cdp/cdp/security/__init__.py +15 -0
- parsek_cdp/cdp/security/events.py +64 -0
- parsek_cdp/cdp/security/functions.py +66 -0
- parsek_cdp/cdp/security/types.py +168 -0
- parsek_cdp/cdp/serviceworker/__init__.py +15 -0
- parsek_cdp/cdp/serviceworker/events.py +43 -0
- parsek_cdp/cdp/serviceworker/functions.py +115 -0
- parsek_cdp/cdp/serviceworker/types.py +95 -0
- parsek_cdp/cdp/storage/__init__.py +15 -0
- parsek_cdp/cdp/storage/events.py +288 -0
- parsek_cdp/cdp/storage/functions.py +571 -0
- parsek_cdp/cdp/storage/types.py +656 -0
- parsek_cdp/cdp/systeminfo/__init__.py +15 -0
- parsek_cdp/cdp/systeminfo/events.py +13 -0
- parsek_cdp/cdp/systeminfo/functions.py +75 -0
- parsek_cdp/cdp/systeminfo/types.py +132 -0
- parsek_cdp/cdp/target/__init__.py +15 -0
- parsek_cdp/cdp/target/events.py +109 -0
- parsek_cdp/cdp/target/functions.py +424 -0
- parsek_cdp/cdp/target/types.py +83 -0
- parsek_cdp/cdp/tethering/__init__.py +15 -0
- parsek_cdp/cdp/tethering/events.py +22 -0
- parsek_cdp/cdp/tethering/functions.py +35 -0
- parsek_cdp/cdp/tethering/types.py +10 -0
- parsek_cdp/cdp/tracing/__init__.py +15 -0
- parsek_cdp/cdp/tracing/events.py +61 -0
- parsek_cdp/cdp/tracing/functions.py +119 -0
- parsek_cdp/cdp/tracing/types.py +81 -0
- parsek_cdp/cdp/webaudio/__init__.py +15 -0
- parsek_cdp/cdp/webaudio/events.py +184 -0
- parsek_cdp/cdp/webaudio/functions.py +51 -0
- parsek_cdp/cdp/webaudio/types.py +155 -0
- parsek_cdp/cdp/webauthn/__init__.py +15 -0
- parsek_cdp/cdp/webauthn/events.py +69 -0
- parsek_cdp/cdp/webauthn/functions.py +214 -0
- parsek_cdp/cdp/webauthn/types.py +96 -0
- parsek_cdp/core/__init__.py +18 -0
- parsek_cdp/core/browser.py +240 -0
- parsek_cdp/core/browser_context.py +58 -0
- parsek_cdp/core/element.py +405 -0
- parsek_cdp/core/feature.py +376 -0
- parsek_cdp/core/frame.py +351 -0
- parsek_cdp/core/pagable.py +175 -0
- parsek_cdp/core/page.py +163 -0
- parsek_cdp/core/target.py +490 -0
- parsek_cdp/features/__init__.py +14 -0
- parsek_cdp/features/request_listener/__init__.py +256 -0
- parsek_cdp/features/request_listener/events.py +48 -0
- parsek_cdp/features/request_listener/types.py +235 -0
- parsek_cdp/generate.py +642 -0
- parsek_cdp/parsek/__init__.py +18 -0
- parsek_cdp/parsek/events.py +38 -0
- parsek_cdp/parsek/types.py +36 -0
- parsek_cdp/py.typed +0 -0
- parsek_cdp-0.1.0.dist-info/METADATA +277 -0
- parsek_cdp-0.1.0.dist-info/RECORD +242 -0
- parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
- parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
- parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Events for the Tracing domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from .types import (
|
|
12
|
+
StreamCompression,
|
|
13
|
+
StreamFormat,
|
|
14
|
+
)
|
|
15
|
+
from ..io.types import StreamHandle as IO_StreamHandle
|
|
16
|
+
|
|
17
|
+
@register_event("Tracing.bufferUsage")
|
|
18
|
+
@dataclass
|
|
19
|
+
class BufferUsage(Event):
|
|
20
|
+
percent_full: Optional[float] = None
|
|
21
|
+
event_count: Optional[float] = None
|
|
22
|
+
value: Optional[float] = None
|
|
23
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
24
|
+
FieldMeta('percent_full', 'percentFull', True, 'primitive'),
|
|
25
|
+
FieldMeta('event_count', 'eventCount', True, 'primitive'),
|
|
26
|
+
FieldMeta('value', 'value', True, 'primitive'),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@register_event("Tracing.dataCollected")
|
|
31
|
+
@dataclass
|
|
32
|
+
class DataCollected(Event):
|
|
33
|
+
"""
|
|
34
|
+
Contains a bucket of collected trace events. When tracing is stopped collected events will be
|
|
35
|
+
sent as a sequence of dataCollected events followed by tracingComplete event.
|
|
36
|
+
"""
|
|
37
|
+
value: List[Dict[str, Any]]
|
|
38
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
39
|
+
FieldMeta('value', 'value', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@register_event("Tracing.tracingComplete")
|
|
44
|
+
@dataclass
|
|
45
|
+
class TracingComplete(Event):
|
|
46
|
+
"""
|
|
47
|
+
Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
|
48
|
+
delivered via dataCollected events.
|
|
49
|
+
"""
|
|
50
|
+
data_loss_occurred: bool
|
|
51
|
+
stream: Optional[IO_StreamHandle] = None
|
|
52
|
+
trace_format: Optional[StreamFormat] = None
|
|
53
|
+
stream_compression: Optional[StreamCompression] = None
|
|
54
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
55
|
+
FieldMeta('data_loss_occurred', 'dataLossOccurred', False, 'primitive'),
|
|
56
|
+
FieldMeta('stream', 'stream', True, 'primitive'),
|
|
57
|
+
FieldMeta('trace_format', 'traceFormat', True, 'enum', ref='Tracing.StreamFormat'),
|
|
58
|
+
FieldMeta('stream_compression', 'streamCompression', True, 'enum', ref='Tracing.StreamCompression'),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
__all__ = ["BufferUsage", "DataCollected", "TracingComplete"]
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Commands for the Tracing domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
MemoryDumpLevelOfDetail,
|
|
12
|
+
StreamCompression,
|
|
13
|
+
StreamFormat,
|
|
14
|
+
TraceConfig,
|
|
15
|
+
TracingBackend,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class GetCategoriesReturn(DataType):
|
|
20
|
+
"""Return value of :meth:`Tracing.get_categories`."""
|
|
21
|
+
categories: List[str]
|
|
22
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
23
|
+
FieldMeta('categories', 'categories', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class RequestMemoryDumpReturn(DataType):
|
|
29
|
+
"""Return value of :meth:`Tracing.request_memory_dump`."""
|
|
30
|
+
dump_guid: str
|
|
31
|
+
success: bool
|
|
32
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
33
|
+
FieldMeta('dump_guid', 'dumpGuid', False, 'primitive'),
|
|
34
|
+
FieldMeta('success', 'success', False, 'primitive'),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Tracing:
|
|
39
|
+
"""Commands of the Tracing domain, bound to a target."""
|
|
40
|
+
|
|
41
|
+
def __init__(self, target: Any) -> None:
|
|
42
|
+
self._target = target
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async def end(self) -> None:
|
|
46
|
+
"""Stop trace events collection."""
|
|
47
|
+
_params: Dict[str, Any] = {}
|
|
48
|
+
_result = await self._target.send('Tracing.end', _params)
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
async def get_categories(self) -> GetCategoriesReturn:
|
|
52
|
+
"""Gets supported tracing categories."""
|
|
53
|
+
_params: Dict[str, Any] = {}
|
|
54
|
+
_result = await self._target.send('Tracing.getCategories', _params)
|
|
55
|
+
return GetCategoriesReturn.from_json(_result)
|
|
56
|
+
|
|
57
|
+
async def record_clock_sync_marker(self, *, sync_id: str) -> None:
|
|
58
|
+
"""
|
|
59
|
+
Record a clock sync marker in the trace.
|
|
60
|
+
:param sync_id: The ID of this clock sync marker
|
|
61
|
+
"""
|
|
62
|
+
_params: Dict[str, Any] = {}
|
|
63
|
+
_params['syncId'] = encode(FieldMeta('', '', False, 'primitive'), sync_id)
|
|
64
|
+
_result = await self._target.send('Tracing.recordClockSyncMarker', _params)
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
async def request_memory_dump(self, *, deterministic: Optional[bool] = None, level_of_detail: Optional[MemoryDumpLevelOfDetail] = None) -> RequestMemoryDumpReturn:
|
|
68
|
+
"""
|
|
69
|
+
Request a global memory dump.
|
|
70
|
+
:param deterministic: Enables more deterministic results by forcing garbage collection
|
|
71
|
+
:param level_of_detail: Specifies level of details in memory dump. Defaults to "detailed".
|
|
72
|
+
"""
|
|
73
|
+
_params: Dict[str, Any] = {}
|
|
74
|
+
if deterministic is not None:
|
|
75
|
+
_params['deterministic'] = encode(FieldMeta('', '', False, 'primitive'), deterministic)
|
|
76
|
+
if level_of_detail is not None:
|
|
77
|
+
_params['levelOfDetail'] = encode(FieldMeta('', '', False, 'enum', ref='Tracing.MemoryDumpLevelOfDetail'), level_of_detail)
|
|
78
|
+
_result = await self._target.send('Tracing.requestMemoryDump', _params)
|
|
79
|
+
return RequestMemoryDumpReturn.from_json(_result)
|
|
80
|
+
|
|
81
|
+
async def start(self, *, categories: Optional[str] = None, options: Optional[str] = None, buffer_usage_reporting_interval: Optional[float] = None, transfer_mode: Optional[Literal['ReportEvents', 'ReturnAsStream']] = None, stream_format: Optional[StreamFormat] = None, stream_compression: Optional[StreamCompression] = None, trace_config: Optional[TraceConfig] = None, perfetto_config: Optional[str] = None, tracing_backend: Optional[TracingBackend] = None) -> None:
|
|
82
|
+
"""
|
|
83
|
+
Start trace events collection.
|
|
84
|
+
:param categories: Category/tag filter
|
|
85
|
+
:param options: Tracing options
|
|
86
|
+
:param buffer_usage_reporting_interval: If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
|
|
87
|
+
:param transfer_mode: Whether to report trace events as series of dataCollected events or to save trace to a
|
|
88
|
+
stream (defaults to `ReportEvents`).
|
|
89
|
+
:param stream_format: Trace data format to use. This only applies when using `ReturnAsStream`
|
|
90
|
+
transfer mode (defaults to `json`).
|
|
91
|
+
:param stream_compression: Compression format to use. This only applies when using `ReturnAsStream`
|
|
92
|
+
transfer mode (defaults to `none`)
|
|
93
|
+
:param trace_config:
|
|
94
|
+
:param perfetto_config: Base64-encoded serialized perfetto.protos.TraceConfig protobuf message
|
|
95
|
+
When specified, the parameters `categories`, `options`, `traceConfig`
|
|
96
|
+
are ignored. (Encoded as a base64 string when passed over JSON)
|
|
97
|
+
:param tracing_backend: Backend type (defaults to `auto`)
|
|
98
|
+
"""
|
|
99
|
+
_params: Dict[str, Any] = {}
|
|
100
|
+
if categories is not None:
|
|
101
|
+
_params['categories'] = encode(FieldMeta('', '', False, 'primitive'), categories)
|
|
102
|
+
if options is not None:
|
|
103
|
+
_params['options'] = encode(FieldMeta('', '', False, 'primitive'), options)
|
|
104
|
+
if buffer_usage_reporting_interval is not None:
|
|
105
|
+
_params['bufferUsageReportingInterval'] = encode(FieldMeta('', '', False, 'primitive'), buffer_usage_reporting_interval)
|
|
106
|
+
if transfer_mode is not None:
|
|
107
|
+
_params['transferMode'] = encode(FieldMeta('', '', False, 'primitive'), transfer_mode)
|
|
108
|
+
if stream_format is not None:
|
|
109
|
+
_params['streamFormat'] = encode(FieldMeta('', '', False, 'enum', ref='Tracing.StreamFormat'), stream_format)
|
|
110
|
+
if stream_compression is not None:
|
|
111
|
+
_params['streamCompression'] = encode(FieldMeta('', '', False, 'enum', ref='Tracing.StreamCompression'), stream_compression)
|
|
112
|
+
if trace_config is not None:
|
|
113
|
+
_params['traceConfig'] = encode(FieldMeta('', '', False, 'object', ref='Tracing.TraceConfig'), trace_config)
|
|
114
|
+
if perfetto_config is not None:
|
|
115
|
+
_params['perfettoConfig'] = encode(FieldMeta('', '', False, 'primitive'), perfetto_config)
|
|
116
|
+
if tracing_backend is not None:
|
|
117
|
+
_params['tracingBackend'] = encode(FieldMeta('', '', False, 'enum', ref='Tracing.TracingBackend'), tracing_backend)
|
|
118
|
+
_result = await self._target.send('Tracing.start', _params)
|
|
119
|
+
return None
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Custom types and enums for the Tracing domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type MemoryDumpConfig = Dict[str, Any] # Configuration for memory dump. Used only when "memory-infra" category is enabled.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@register("Tracing.TraceConfig")
|
|
15
|
+
@dataclass
|
|
16
|
+
class TraceConfig(DataType):
|
|
17
|
+
record_mode: Optional[Literal['recordUntilFull', 'recordContinuously', 'recordAsMuchAsPossible', 'echoToConsole']] = None
|
|
18
|
+
trace_buffer_size_in_kb: Optional[float] = None
|
|
19
|
+
enable_sampling: Optional[bool] = None
|
|
20
|
+
enable_systrace: Optional[bool] = None
|
|
21
|
+
enable_argument_filter: Optional[bool] = None
|
|
22
|
+
included_categories: Optional[List[str]] = None
|
|
23
|
+
excluded_categories: Optional[List[str]] = None
|
|
24
|
+
synthetic_delays: Optional[List[str]] = None
|
|
25
|
+
memory_dump_config: Optional[MemoryDumpConfig] = None
|
|
26
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
27
|
+
FieldMeta('record_mode', 'recordMode', True, 'primitive'),
|
|
28
|
+
FieldMeta('trace_buffer_size_in_kb', 'traceBufferSizeInKb', True, 'primitive'),
|
|
29
|
+
FieldMeta('enable_sampling', 'enableSampling', True, 'primitive'),
|
|
30
|
+
FieldMeta('enable_systrace', 'enableSystrace', True, 'primitive'),
|
|
31
|
+
FieldMeta('enable_argument_filter', 'enableArgumentFilter', True, 'primitive'),
|
|
32
|
+
FieldMeta('included_categories', 'includedCategories', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
33
|
+
FieldMeta('excluded_categories', 'excludedCategories', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
34
|
+
FieldMeta('synthetic_delays', 'syntheticDelays', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
35
|
+
FieldMeta('memory_dump_config', 'memoryDumpConfig', True, 'primitive'),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@register("Tracing.StreamFormat")
|
|
40
|
+
class StreamFormat(str, Enum):
|
|
41
|
+
"""
|
|
42
|
+
Data format of a trace. Can be either the legacy JSON format or the
|
|
43
|
+
protocol buffer format. Note that the JSON format will be deprecated soon.
|
|
44
|
+
"""
|
|
45
|
+
JSON = 'json'
|
|
46
|
+
PROTO = 'proto'
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@register("Tracing.StreamCompression")
|
|
50
|
+
class StreamCompression(str, Enum):
|
|
51
|
+
"""Compression type to use for traces returned via streams."""
|
|
52
|
+
NONE = 'none'
|
|
53
|
+
GZIP = 'gzip'
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@register("Tracing.MemoryDumpLevelOfDetail")
|
|
57
|
+
class MemoryDumpLevelOfDetail(str, Enum):
|
|
58
|
+
"""
|
|
59
|
+
Details exposed when memory request explicitly declared.
|
|
60
|
+
Keep consistent with memory_dump_request_args.h and
|
|
61
|
+
memory_instrumentation.mojom
|
|
62
|
+
"""
|
|
63
|
+
BACKGROUND = 'background'
|
|
64
|
+
LIGHT = 'light'
|
|
65
|
+
DETAILED = 'detailed'
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@register("Tracing.TracingBackend")
|
|
69
|
+
class TracingBackend(str, Enum):
|
|
70
|
+
"""
|
|
71
|
+
Backend type to use for tracing. `chrome` uses the Chrome-integrated
|
|
72
|
+
tracing service and is supported on all platforms. `system` is only
|
|
73
|
+
supported on Chrome OS and uses the Perfetto system tracing service.
|
|
74
|
+
`auto` chooses `system` when the perfettoConfig provided to Tracing.start
|
|
75
|
+
specifies at least one non-Chrome data source; otherwise uses `chrome`.
|
|
76
|
+
"""
|
|
77
|
+
AUTO = 'auto'
|
|
78
|
+
CHROME = 'chrome'
|
|
79
|
+
SYSTEM = 'system'
|
|
80
|
+
|
|
81
|
+
__all__ = ["MemoryDumpConfig", "MemoryDumpLevelOfDetail", "StreamCompression", "StreamFormat", "TraceConfig", "TracingBackend"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The WebAudio CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``WebAudio`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``WebAudio.SomeEvent`` /
|
|
5
|
+
``WebAudio.SomeType``); commands run on a target via ``page.cdp.WebAudio``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import WebAudio
|
|
9
|
+
from .events import * # noqa: F401,F403 -- expose events on the namespace
|
|
10
|
+
from .types import * # noqa: F401,F403 -- expose types on the namespace
|
|
11
|
+
|
|
12
|
+
#: Protocol domain name (used by features that declare ``domains=(WebAudio,)``).
|
|
13
|
+
DOMAIN = "WebAudio"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "WebAudio", "DOMAIN"]
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""Events for the WebAudio domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from .types import (
|
|
12
|
+
AudioListener,
|
|
13
|
+
AudioNode,
|
|
14
|
+
AudioParam,
|
|
15
|
+
BaseAudioContext,
|
|
16
|
+
GraphObjectId,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
@register_event("WebAudio.contextCreated")
|
|
20
|
+
@dataclass
|
|
21
|
+
class ContextCreated(Event):
|
|
22
|
+
"""Notifies that a new BaseAudioContext has been created."""
|
|
23
|
+
context: BaseAudioContext
|
|
24
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
25
|
+
FieldMeta('context', 'context', False, 'object', ref='WebAudio.BaseAudioContext'),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@register_event("WebAudio.contextWillBeDestroyed")
|
|
30
|
+
@dataclass
|
|
31
|
+
class ContextWillBeDestroyed(Event):
|
|
32
|
+
"""Notifies that an existing BaseAudioContext will be destroyed."""
|
|
33
|
+
context_id: GraphObjectId
|
|
34
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
35
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@register_event("WebAudio.contextChanged")
|
|
40
|
+
@dataclass
|
|
41
|
+
class ContextChanged(Event):
|
|
42
|
+
"""Notifies that existing BaseAudioContext has changed some properties (id stays the same).."""
|
|
43
|
+
context: BaseAudioContext
|
|
44
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
45
|
+
FieldMeta('context', 'context', False, 'object', ref='WebAudio.BaseAudioContext'),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@register_event("WebAudio.audioListenerCreated")
|
|
50
|
+
@dataclass
|
|
51
|
+
class AudioListenerCreated(Event):
|
|
52
|
+
"""Notifies that the construction of an AudioListener has finished."""
|
|
53
|
+
listener: AudioListener
|
|
54
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
55
|
+
FieldMeta('listener', 'listener', False, 'object', ref='WebAudio.AudioListener'),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@register_event("WebAudio.audioListenerWillBeDestroyed")
|
|
60
|
+
@dataclass
|
|
61
|
+
class AudioListenerWillBeDestroyed(Event):
|
|
62
|
+
"""Notifies that a new AudioListener has been created."""
|
|
63
|
+
context_id: GraphObjectId
|
|
64
|
+
listener_id: GraphObjectId
|
|
65
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
66
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
67
|
+
FieldMeta('listener_id', 'listenerId', False, 'primitive'),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@register_event("WebAudio.audioNodeCreated")
|
|
72
|
+
@dataclass
|
|
73
|
+
class AudioNodeCreated(Event):
|
|
74
|
+
"""Notifies that a new AudioNode has been created."""
|
|
75
|
+
node: AudioNode
|
|
76
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
77
|
+
FieldMeta('node', 'node', False, 'object', ref='WebAudio.AudioNode'),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@register_event("WebAudio.audioNodeWillBeDestroyed")
|
|
82
|
+
@dataclass
|
|
83
|
+
class AudioNodeWillBeDestroyed(Event):
|
|
84
|
+
"""Notifies that an existing AudioNode has been destroyed."""
|
|
85
|
+
context_id: GraphObjectId
|
|
86
|
+
node_id: GraphObjectId
|
|
87
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
88
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
89
|
+
FieldMeta('node_id', 'nodeId', False, 'primitive'),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@register_event("WebAudio.audioParamCreated")
|
|
94
|
+
@dataclass
|
|
95
|
+
class AudioParamCreated(Event):
|
|
96
|
+
"""Notifies that a new AudioParam has been created."""
|
|
97
|
+
param: AudioParam
|
|
98
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
99
|
+
FieldMeta('param', 'param', False, 'object', ref='WebAudio.AudioParam'),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@register_event("WebAudio.audioParamWillBeDestroyed")
|
|
104
|
+
@dataclass
|
|
105
|
+
class AudioParamWillBeDestroyed(Event):
|
|
106
|
+
"""Notifies that an existing AudioParam has been destroyed."""
|
|
107
|
+
context_id: GraphObjectId
|
|
108
|
+
node_id: GraphObjectId
|
|
109
|
+
param_id: GraphObjectId
|
|
110
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
111
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
112
|
+
FieldMeta('node_id', 'nodeId', False, 'primitive'),
|
|
113
|
+
FieldMeta('param_id', 'paramId', False, 'primitive'),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@register_event("WebAudio.nodesConnected")
|
|
118
|
+
@dataclass
|
|
119
|
+
class NodesConnected(Event):
|
|
120
|
+
"""Notifies that two AudioNodes are connected."""
|
|
121
|
+
context_id: GraphObjectId
|
|
122
|
+
source_id: GraphObjectId
|
|
123
|
+
destination_id: GraphObjectId
|
|
124
|
+
source_output_index: Optional[float] = None
|
|
125
|
+
destination_input_index: Optional[float] = None
|
|
126
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
127
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
128
|
+
FieldMeta('source_id', 'sourceId', False, 'primitive'),
|
|
129
|
+
FieldMeta('destination_id', 'destinationId', False, 'primitive'),
|
|
130
|
+
FieldMeta('source_output_index', 'sourceOutputIndex', True, 'primitive'),
|
|
131
|
+
FieldMeta('destination_input_index', 'destinationInputIndex', True, 'primitive'),
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@register_event("WebAudio.nodesDisconnected")
|
|
136
|
+
@dataclass
|
|
137
|
+
class NodesDisconnected(Event):
|
|
138
|
+
"""Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected."""
|
|
139
|
+
context_id: GraphObjectId
|
|
140
|
+
source_id: GraphObjectId
|
|
141
|
+
destination_id: GraphObjectId
|
|
142
|
+
source_output_index: Optional[float] = None
|
|
143
|
+
destination_input_index: Optional[float] = None
|
|
144
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
145
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
146
|
+
FieldMeta('source_id', 'sourceId', False, 'primitive'),
|
|
147
|
+
FieldMeta('destination_id', 'destinationId', False, 'primitive'),
|
|
148
|
+
FieldMeta('source_output_index', 'sourceOutputIndex', True, 'primitive'),
|
|
149
|
+
FieldMeta('destination_input_index', 'destinationInputIndex', True, 'primitive'),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@register_event("WebAudio.nodeParamConnected")
|
|
154
|
+
@dataclass
|
|
155
|
+
class NodeParamConnected(Event):
|
|
156
|
+
"""Notifies that an AudioNode is connected to an AudioParam."""
|
|
157
|
+
context_id: GraphObjectId
|
|
158
|
+
source_id: GraphObjectId
|
|
159
|
+
destination_id: GraphObjectId
|
|
160
|
+
source_output_index: Optional[float] = None
|
|
161
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
162
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
163
|
+
FieldMeta('source_id', 'sourceId', False, 'primitive'),
|
|
164
|
+
FieldMeta('destination_id', 'destinationId', False, 'primitive'),
|
|
165
|
+
FieldMeta('source_output_index', 'sourceOutputIndex', True, 'primitive'),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
@register_event("WebAudio.nodeParamDisconnected")
|
|
170
|
+
@dataclass
|
|
171
|
+
class NodeParamDisconnected(Event):
|
|
172
|
+
"""Notifies that an AudioNode is disconnected to an AudioParam."""
|
|
173
|
+
context_id: GraphObjectId
|
|
174
|
+
source_id: GraphObjectId
|
|
175
|
+
destination_id: GraphObjectId
|
|
176
|
+
source_output_index: Optional[float] = None
|
|
177
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
178
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
179
|
+
FieldMeta('source_id', 'sourceId', False, 'primitive'),
|
|
180
|
+
FieldMeta('destination_id', 'destinationId', False, 'primitive'),
|
|
181
|
+
FieldMeta('source_output_index', 'sourceOutputIndex', True, 'primitive'),
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
__all__ = ["AudioListenerCreated", "AudioListenerWillBeDestroyed", "AudioNodeCreated", "AudioNodeWillBeDestroyed", "AudioParamCreated", "AudioParamWillBeDestroyed", "ContextChanged", "ContextCreated", "ContextWillBeDestroyed", "NodeParamConnected", "NodeParamDisconnected", "NodesConnected", "NodesDisconnected"]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Commands for the WebAudio domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
ContextRealtimeData,
|
|
12
|
+
GraphObjectId,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class GetRealtimeDataReturn(DataType):
|
|
17
|
+
"""Return value of :meth:`WebAudio.get_realtime_data`."""
|
|
18
|
+
realtime_data: ContextRealtimeData
|
|
19
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
20
|
+
FieldMeta('realtime_data', 'realtimeData', False, 'object', ref='WebAudio.ContextRealtimeData'),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class WebAudio:
|
|
25
|
+
"""Commands of the WebAudio domain, bound to a target."""
|
|
26
|
+
|
|
27
|
+
def __init__(self, target: Any) -> None:
|
|
28
|
+
self._target = target
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def enable(self) -> None:
|
|
32
|
+
"""Enables the WebAudio domain and starts sending context lifetime events."""
|
|
33
|
+
_params: Dict[str, Any] = {}
|
|
34
|
+
_result = await self._target.send('WebAudio.enable', _params)
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
async def disable(self) -> None:
|
|
38
|
+
"""Disables the WebAudio domain."""
|
|
39
|
+
_params: Dict[str, Any] = {}
|
|
40
|
+
_result = await self._target.send('WebAudio.disable', _params)
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
async def get_realtime_data(self, *, context_id: GraphObjectId) -> GetRealtimeDataReturn:
|
|
44
|
+
"""
|
|
45
|
+
Fetch the realtime data from the registered contexts.
|
|
46
|
+
:param context_id:
|
|
47
|
+
"""
|
|
48
|
+
_params: Dict[str, Any] = {}
|
|
49
|
+
_params['contextId'] = encode(FieldMeta('', '', False, 'primitive'), context_id)
|
|
50
|
+
_result = await self._target.send('WebAudio.getRealtimeData', _params)
|
|
51
|
+
return GetRealtimeDataReturn.from_json(_result)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""Custom types and enums for the WebAudio domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type GraphObjectId = str # An unique ID for a graph object (AudioContext, AudioNode, AudioParam) in Web Audio API
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@register("WebAudio.ContextType")
|
|
15
|
+
class ContextType(str, Enum):
|
|
16
|
+
"""Enum of BaseAudioContext types"""
|
|
17
|
+
REALTIME = 'realtime'
|
|
18
|
+
OFFLINE = 'offline'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@register("WebAudio.ContextState")
|
|
22
|
+
class ContextState(str, Enum):
|
|
23
|
+
"""Enum of AudioContextState from the spec"""
|
|
24
|
+
SUSPENDED = 'suspended'
|
|
25
|
+
RUNNING = 'running'
|
|
26
|
+
CLOSED = 'closed'
|
|
27
|
+
INTERRUPTED = 'interrupted'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
type NodeType = str # Enum of AudioNode types
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@register("WebAudio.ChannelCountMode")
|
|
34
|
+
class ChannelCountMode(str, Enum):
|
|
35
|
+
"""Enum of AudioNode::ChannelCountMode from the spec"""
|
|
36
|
+
CLAMPED_MAX = 'clamped-max'
|
|
37
|
+
EXPLICIT = 'explicit'
|
|
38
|
+
MAX = 'max'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@register("WebAudio.ChannelInterpretation")
|
|
42
|
+
class ChannelInterpretation(str, Enum):
|
|
43
|
+
"""Enum of AudioNode::ChannelInterpretation from the spec"""
|
|
44
|
+
DISCRETE = 'discrete'
|
|
45
|
+
SPEAKERS = 'speakers'
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
type ParamType = str # Enum of AudioParam types
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@register("WebAudio.AutomationRate")
|
|
52
|
+
class AutomationRate(str, Enum):
|
|
53
|
+
"""Enum of AudioParam::AutomationRate from the spec"""
|
|
54
|
+
A_RATE = 'a-rate'
|
|
55
|
+
K_RATE = 'k-rate'
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@register("WebAudio.ContextRealtimeData")
|
|
59
|
+
@dataclass
|
|
60
|
+
class ContextRealtimeData(DataType):
|
|
61
|
+
"""Fields in AudioContext that change in real-time."""
|
|
62
|
+
current_time: float
|
|
63
|
+
render_capacity: float
|
|
64
|
+
callback_interval_mean: float
|
|
65
|
+
callback_interval_variance: float
|
|
66
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
67
|
+
FieldMeta('current_time', 'currentTime', False, 'primitive'),
|
|
68
|
+
FieldMeta('render_capacity', 'renderCapacity', False, 'primitive'),
|
|
69
|
+
FieldMeta('callback_interval_mean', 'callbackIntervalMean', False, 'primitive'),
|
|
70
|
+
FieldMeta('callback_interval_variance', 'callbackIntervalVariance', False, 'primitive'),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@register("WebAudio.BaseAudioContext")
|
|
75
|
+
@dataclass
|
|
76
|
+
class BaseAudioContext(DataType):
|
|
77
|
+
"""Protocol object for BaseAudioContext"""
|
|
78
|
+
context_id: GraphObjectId
|
|
79
|
+
context_type: ContextType
|
|
80
|
+
context_state: ContextState
|
|
81
|
+
callback_buffer_size: float
|
|
82
|
+
max_output_channel_count: float
|
|
83
|
+
sample_rate: float
|
|
84
|
+
realtime_data: Optional[ContextRealtimeData] = None
|
|
85
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
86
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
87
|
+
FieldMeta('context_type', 'contextType', False, 'enum', ref='WebAudio.ContextType'),
|
|
88
|
+
FieldMeta('context_state', 'contextState', False, 'enum', ref='WebAudio.ContextState'),
|
|
89
|
+
FieldMeta('callback_buffer_size', 'callbackBufferSize', False, 'primitive'),
|
|
90
|
+
FieldMeta('max_output_channel_count', 'maxOutputChannelCount', False, 'primitive'),
|
|
91
|
+
FieldMeta('sample_rate', 'sampleRate', False, 'primitive'),
|
|
92
|
+
FieldMeta('realtime_data', 'realtimeData', True, 'object', ref='WebAudio.ContextRealtimeData'),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@register("WebAudio.AudioListener")
|
|
97
|
+
@dataclass
|
|
98
|
+
class AudioListener(DataType):
|
|
99
|
+
"""Protocol object for AudioListener"""
|
|
100
|
+
listener_id: GraphObjectId
|
|
101
|
+
context_id: GraphObjectId
|
|
102
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
103
|
+
FieldMeta('listener_id', 'listenerId', False, 'primitive'),
|
|
104
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@register("WebAudio.AudioNode")
|
|
109
|
+
@dataclass
|
|
110
|
+
class AudioNode(DataType):
|
|
111
|
+
"""Protocol object for AudioNode"""
|
|
112
|
+
node_id: GraphObjectId
|
|
113
|
+
context_id: GraphObjectId
|
|
114
|
+
node_type: NodeType
|
|
115
|
+
number_of_inputs: float
|
|
116
|
+
number_of_outputs: float
|
|
117
|
+
channel_count: float
|
|
118
|
+
channel_count_mode: ChannelCountMode
|
|
119
|
+
channel_interpretation: ChannelInterpretation
|
|
120
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
121
|
+
FieldMeta('node_id', 'nodeId', False, 'primitive'),
|
|
122
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
123
|
+
FieldMeta('node_type', 'nodeType', False, 'primitive'),
|
|
124
|
+
FieldMeta('number_of_inputs', 'numberOfInputs', False, 'primitive'),
|
|
125
|
+
FieldMeta('number_of_outputs', 'numberOfOutputs', False, 'primitive'),
|
|
126
|
+
FieldMeta('channel_count', 'channelCount', False, 'primitive'),
|
|
127
|
+
FieldMeta('channel_count_mode', 'channelCountMode', False, 'enum', ref='WebAudio.ChannelCountMode'),
|
|
128
|
+
FieldMeta('channel_interpretation', 'channelInterpretation', False, 'enum', ref='WebAudio.ChannelInterpretation'),
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@register("WebAudio.AudioParam")
|
|
133
|
+
@dataclass
|
|
134
|
+
class AudioParam(DataType):
|
|
135
|
+
"""Protocol object for AudioParam"""
|
|
136
|
+
param_id: GraphObjectId
|
|
137
|
+
node_id: GraphObjectId
|
|
138
|
+
context_id: GraphObjectId
|
|
139
|
+
param_type: ParamType
|
|
140
|
+
rate: AutomationRate
|
|
141
|
+
default_value: float
|
|
142
|
+
min_value: float
|
|
143
|
+
max_value: float
|
|
144
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
145
|
+
FieldMeta('param_id', 'paramId', False, 'primitive'),
|
|
146
|
+
FieldMeta('node_id', 'nodeId', False, 'primitive'),
|
|
147
|
+
FieldMeta('context_id', 'contextId', False, 'primitive'),
|
|
148
|
+
FieldMeta('param_type', 'paramType', False, 'primitive'),
|
|
149
|
+
FieldMeta('rate', 'rate', False, 'enum', ref='WebAudio.AutomationRate'),
|
|
150
|
+
FieldMeta('default_value', 'defaultValue', False, 'primitive'),
|
|
151
|
+
FieldMeta('min_value', 'minValue', False, 'primitive'),
|
|
152
|
+
FieldMeta('max_value', 'maxValue', False, 'primitive'),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
__all__ = ["AudioListener", "AudioNode", "AudioParam", "AutomationRate", "BaseAudioContext", "ChannelCountMode", "ChannelInterpretation", "ContextRealtimeData", "ContextState", "ContextType", "GraphObjectId", "NodeType", "ParamType"]
|