webaudio

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Overview

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.

Index

Constants

View Source
const (
	CommandEnable          = "WebAudio.enable"
	CommandDisable         = "WebAudio.disable"
	CommandGetRealtimeData = "WebAudio.getRealtimeData"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioListener

type AudioListener struct {
	ListenerID GraphObjectID `json:"listenerId"`
	ContextID  GraphObjectID `json:"contextId"`
}

AudioListener protocol object for AudioListener.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-AudioListener

type AudioNode

type AudioNode struct {
	NodeID                GraphObjectID         `json:"nodeId"`
	ContextID             GraphObjectID         `json:"contextId"`
	NodeType              cdp.NodeType          `json:"nodeType"`
	NumberOfInputs        float64               `json:"numberOfInputs"`
	NumberOfOutputs       float64               `json:"numberOfOutputs"`
	ChannelCount          float64               `json:"channelCount"`
	ChannelCountMode      ChannelCountMode      `json:"channelCountMode"`
	ChannelInterpretation ChannelInterpretation `json:"channelInterpretation"`
}

AudioNode protocol object for AudioNode.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-AudioNode

type AudioParam

type AudioParam struct {
	ParamID      GraphObjectID  `json:"paramId"`
	NodeID       GraphObjectID  `json:"nodeId"`
	ContextID    GraphObjectID  `json:"contextId"`
	ParamType    ParamType      `json:"paramType"`
	Rate         AutomationRate `json:"rate"`
	DefaultValue float64        `json:"defaultValue"`
	MinValue     float64        `json:"minValue"`
	MaxValue     float64        `json:"maxValue"`
}

AudioParam protocol object for AudioParam.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-AudioParam

type AutomationRate

type AutomationRate string

AutomationRate enum of AudioParam::AutomationRate from the spec.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-AutomationRate

const (
	AutomationRateARate AutomationRate = "a-rate"
	AutomationRateKRate AutomationRate = "k-rate"
)

AutomationRate values.

func (AutomationRate) MarshalJSON

func (t AutomationRate) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (AutomationRate) String

func (t AutomationRate) String() string

String returns the AutomationRate as string value.

func (*AutomationRate) UnmarshalJSON

func (t *AutomationRate) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type BaseAudioContext

type BaseAudioContext struct {
	ContextID             GraphObjectID        `json:"contextId"`
	ContextType           ContextType          `json:"contextType"`
	ContextState          ContextState         `json:"contextState"`
	RealtimeData          *ContextRealtimeData `json:"realtimeData,omitempty"`
	CallbackBufferSize    float64              `json:"callbackBufferSize"`    // Platform-dependent callback buffer size.
	MaxOutputChannelCount float64              `json:"maxOutputChannelCount"` // Number of output channels supported by audio hardware in use.
	SampleRate            float64              `json:"sampleRate"`            // Context sample rate.
}

BaseAudioContext protocol object for BaseAudioContext.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-BaseAudioContext

type ChannelCountMode

type ChannelCountMode string

ChannelCountMode enum of AudioNode::ChannelCountMode from the spec.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ChannelCountMode

const (
	ChannelCountModeClampedMax ChannelCountMode = "clamped-max"
	ChannelCountModeExplicit   ChannelCountMode = "explicit"
	ChannelCountModeMax        ChannelCountMode = "max"
)

ChannelCountMode values.

func (ChannelCountMode) MarshalJSON

func (t ChannelCountMode) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ChannelCountMode) String

func (t ChannelCountMode) String() string

String returns the ChannelCountMode as string value.

func (*ChannelCountMode) UnmarshalJSON

func (t *ChannelCountMode) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type ChannelInterpretation

type ChannelInterpretation string

ChannelInterpretation enum of AudioNode::ChannelInterpretation from the spec.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ChannelInterpretation

const (
	ChannelInterpretationDiscrete ChannelInterpretation = "discrete"
	ChannelInterpretationSpeakers ChannelInterpretation = "speakers"
)

ChannelInterpretation values.

func (ChannelInterpretation) MarshalJSON

func (t ChannelInterpretation) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ChannelInterpretation) String

func (t ChannelInterpretation) String() string

String returns the ChannelInterpretation as string value.

func (*ChannelInterpretation) UnmarshalJSON

func (t *ChannelInterpretation) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type ContextRealtimeData

type ContextRealtimeData struct {
	CurrentTime              float64 `json:"currentTime"`              // The current context time in second in BaseAudioContext.
	RenderCapacity           float64 `json:"renderCapacity"`           // The time spent on rendering graph divided by render quantum duration, and multiplied by 100. 100 means the audio renderer reached the full capacity and glitch may occur.
	CallbackIntervalMean     float64 `json:"callbackIntervalMean"`     // A running mean of callback interval.
	CallbackIntervalVariance float64 `json:"callbackIntervalVariance"` // A running variance of callback interval.
}

ContextRealtimeData fields in AudioContext that change in real-time.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ContextRealtimeData

type ContextState

type ContextState string

ContextState enum of AudioContextState from the spec.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ContextState

const (
	ContextStateSuspended ContextState = "suspended"
	ContextStateRunning   ContextState = "running"
	ContextStateClosed    ContextState = "closed"
)

ContextState values.

func (ContextState) MarshalJSON

func (t ContextState) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ContextState) String

func (t ContextState) String() string

String returns the ContextState as string value.

func (*ContextState) UnmarshalJSON

func (t *ContextState) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type ContextType

type ContextType string

ContextType enum of BaseAudioContext types.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ContextType

const (
	ContextTypeRealtime ContextType = "realtime"
	ContextTypeOffline  ContextType = "offline"
)

ContextType values.

func (ContextType) MarshalJSON

func (t ContextType) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ContextType) String

func (t ContextType) String() string

String returns the ContextType as string value.

func (*ContextType) UnmarshalJSON

func (t *ContextType) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type DisableParams

type DisableParams struct{}

DisableParams disables the WebAudio domain.

func Disable

func Disable() *DisableParams

Disable disables the WebAudio domain.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-disable

func (*DisableParams) Do

func (p *DisableParams) Do(ctx context.Context) (err error)

Do executes WebAudio.disable against the provided context.

type EnableParams

type EnableParams struct{}

EnableParams enables the WebAudio domain and starts sending context lifetime events.

func Enable

func Enable() *EnableParams

Enable enables the WebAudio domain and starts sending context lifetime events.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-enable

func (*EnableParams) Do

func (p *EnableParams) Do(ctx context.Context) (err error)

Do executes WebAudio.enable against the provided context.

type EventAudioListenerCreated

type EventAudioListenerCreated struct {
	Listener *AudioListener `json:"listener"`
}

EventAudioListenerCreated notifies that the construction of an AudioListener has finished.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioListenerCreated

type EventAudioListenerWillBeDestroyed

type EventAudioListenerWillBeDestroyed struct {
	ContextID  GraphObjectID `json:"contextId"`
	ListenerID GraphObjectID `json:"listenerId"`
}

EventAudioListenerWillBeDestroyed notifies that a new AudioListener has been created.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioListenerWillBeDestroyed

type EventAudioNodeCreated

type EventAudioNodeCreated struct {
	Node *AudioNode `json:"node"`
}

EventAudioNodeCreated notifies that a new AudioNode has been created.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioNodeCreated

type EventAudioNodeWillBeDestroyed

type EventAudioNodeWillBeDestroyed struct {
	ContextID GraphObjectID `json:"contextId"`
	NodeID    GraphObjectID `json:"nodeId"`
}

EventAudioNodeWillBeDestroyed notifies that an existing AudioNode has been destroyed.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioNodeWillBeDestroyed

type EventAudioParamCreated

type EventAudioParamCreated struct {
	Param *AudioParam `json:"param"`
}

EventAudioParamCreated notifies that a new AudioParam has been created.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioParamCreated

type EventAudioParamWillBeDestroyed

type EventAudioParamWillBeDestroyed struct {
	ContextID GraphObjectID `json:"contextId"`
	NodeID    GraphObjectID `json:"nodeId"`
	ParamID   GraphObjectID `json:"paramId"`
}

EventAudioParamWillBeDestroyed notifies that an existing AudioParam has been destroyed.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-audioParamWillBeDestroyed

type EventContextChanged

type EventContextChanged struct {
	Context *BaseAudioContext `json:"context"`
}

EventContextChanged notifies that existing BaseAudioContext has changed some properties (id stays the same)..

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-contextChanged

type EventContextCreated

type EventContextCreated struct {
	Context *BaseAudioContext `json:"context"`
}

EventContextCreated notifies that a new BaseAudioContext has been created.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-contextCreated

type EventContextWillBeDestroyed

type EventContextWillBeDestroyed struct {
	ContextID GraphObjectID `json:"contextId"`
}

EventContextWillBeDestroyed notifies that an existing BaseAudioContext will be destroyed.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-contextWillBeDestroyed

type EventNodeParamConnected

type EventNodeParamConnected struct {
	ContextID         GraphObjectID `json:"contextId"`
	SourceID          GraphObjectID `json:"sourceId"`
	DestinationID     GraphObjectID `json:"destinationId"`
	SourceOutputIndex float64       `json:"sourceOutputIndex,omitempty"`
}

EventNodeParamConnected notifies that an AudioNode is connected to an AudioParam.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-nodeParamConnected

type EventNodeParamDisconnected

type EventNodeParamDisconnected struct {
	ContextID         GraphObjectID `json:"contextId"`
	SourceID          GraphObjectID `json:"sourceId"`
	DestinationID     GraphObjectID `json:"destinationId"`
	SourceOutputIndex float64       `json:"sourceOutputIndex,omitempty"`
}

EventNodeParamDisconnected notifies that an AudioNode is disconnected to an AudioParam.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-nodeParamDisconnected

type EventNodesConnected

type EventNodesConnected struct {
	ContextID             GraphObjectID `json:"contextId"`
	SourceID              GraphObjectID `json:"sourceId"`
	DestinationID         GraphObjectID `json:"destinationId"`
	SourceOutputIndex     float64       `json:"sourceOutputIndex,omitempty"`
	DestinationInputIndex float64       `json:"destinationInputIndex,omitempty"`
}

EventNodesConnected notifies that two AudioNodes are connected.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-nodesConnected

type EventNodesDisconnected

type EventNodesDisconnected struct {
	ContextID             GraphObjectID `json:"contextId"`
	SourceID              GraphObjectID `json:"sourceId"`
	DestinationID         GraphObjectID `json:"destinationId"`
	SourceOutputIndex     float64       `json:"sourceOutputIndex,omitempty"`
	DestinationInputIndex float64       `json:"destinationInputIndex,omitempty"`
}

EventNodesDisconnected notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#event-nodesDisconnected

type GetRealtimeDataParams

type GetRealtimeDataParams struct {
	ContextID GraphObjectID `json:"contextId"`
}

GetRealtimeDataParams fetch the realtime data from the registered contexts.

func GetRealtimeData

func GetRealtimeData(contextID GraphObjectID) *GetRealtimeDataParams

GetRealtimeData fetch the realtime data from the registered contexts.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-getRealtimeData

parameters:

contextID

func (*GetRealtimeDataParams) Do

func (p *GetRealtimeDataParams) Do(ctx context.Context) (realtimeData *ContextRealtimeData, err error)

Do executes WebAudio.getRealtimeData against the provided context.

returns:

realtimeData

type GetRealtimeDataReturns

type GetRealtimeDataReturns struct {
	RealtimeData *ContextRealtimeData `json:"realtimeData,omitempty"`
}

GetRealtimeDataReturns return values.

type GraphObjectID

type GraphObjectID string

GraphObjectID an unique ID for a graph object (AudioContext, AudioNode, AudioParam) in Web Audio API.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-GraphObjectId

func (GraphObjectID) String

func (t GraphObjectID) String() string

String returns the GraphObjectID as string value.

type NodeType

type NodeType string

NodeType enum of AudioNode types.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-NodeType

func (NodeType) String

func (t NodeType) String() string

String returns the NodeType as string value.

type ParamType

type ParamType string

ParamType enum of AudioParam types.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#type-ParamType

func (ParamType) String

func (t ParamType) String() string

String returns the ParamType as string value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL