forked from chromedp/cdproto
/
webaudio.go
93 lines (78 loc) · 2.49 KB
/
webaudio.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Package webaudio provides the Chrome DevTools Protocol
// commands, types, and events for the WebAudio domain.
//
// This domain allows inspection of Web Audio API.
// https://webaudio.github.io/web-audio-api/.
//
// Generated by the cdproto-gen command.
package webaudio
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/seddonm1/cdproto/cdp"
)
// EnableParams enables the WebAudio domain and starts sending context
// lifetime events.
type EnableParams struct{}
// Enable enables the WebAudio domain and starts sending context lifetime
// events.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes WebAudio.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// DisableParams disables the WebAudio domain.
type DisableParams struct{}
// Disable disables the WebAudio domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes WebAudio.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// GetRealtimeDataParams fetch the realtime data from the registered
// contexts.
type GetRealtimeDataParams struct {
ContextID ContextID `json:"contextId"`
}
// GetRealtimeData fetch the realtime data from the registered contexts.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-getRealtimeData
//
// parameters:
// contextID
func GetRealtimeData(contextID ContextID) *GetRealtimeDataParams {
return &GetRealtimeDataParams{
ContextID: contextID,
}
}
// GetRealtimeDataReturns return values.
type GetRealtimeDataReturns struct {
RealtimeData *ContextRealtimeData `json:"realtimeData,omitempty"`
}
// Do executes WebAudio.getRealtimeData against the provided context.
//
// returns:
// realtimeData
func (p *GetRealtimeDataParams) Do(ctx context.Context) (realtimeData *ContextRealtimeData, err error) {
// execute
var res GetRealtimeDataReturns
err = cdp.Execute(ctx, CommandGetRealtimeData, p, &res)
if err != nil {
return nil, err
}
return res.RealtimeData, nil
}
// Command names.
const (
CommandEnable = "WebAudio.enable"
CommandDisable = "WebAudio.disable"
CommandGetRealtimeData = "WebAudio.getRealtimeData"
)