Class AudioNode
- Direct Known Subclasses:
AnalyserNode, AudioDestinationNode, AudioProcessorNode, AudioScheduledSourceNode, BiquadFilterNode, ChannelMergerNode, ChannelSplitterNode, ConvolverNode, DelayNode, DynamicsCompressorNode, GainNode, IIRFilterNode, MicrophoneSourceNode, PannerNode, StereoPannerNode, WaveShaperNode
A processing block of an audio graph, the Web Audio AudioNode.
Nodes are created by a context (context.createGain() and so on) and wired
with connect(AudioNode); audio is heard once a path reaches
BaseAudioContext.getDestination(). Each input mixes everything connected
to it to a channel count decided by getChannelCountMode(),
getChannelCount() and getChannelInterpretation(), following the
specification's mixing rules.
A cycle in the graph must contain a DelayNode; a cycle without one is
rendered as silence, as the specification requires. Every method may be
called from any thread; changes reach the renderer at its next render
quantum.
-
Method Summary
Modifier and TypeMethodDescriptionConnects output 0 to input 0 ofdestination.Connects an output of this node to an input ofdestination.voidconnect(AudioParam param) Connects output 0 to anAudioParam, whose value then has this output, mixed down to mono, added to it.voidconnect(AudioParam param, int output) Connects an output to anAudioParam.voidRemoves every outgoing connection.voiddisconnect(int output) Removes every connection from one output.voiddisconnect(AudioNode destination) Removes every connection todestination.voiddisconnect(AudioNode destination, int output, int input) Removes one connection.voiddisconnect(AudioParam param) Removes every connection toparam.intThe channel count inputs are mixed to, subject to the channel count mode.How the channel count of each input is decided.How channels are up-mixed and down-mixed.The context that created this node.intThe number of inputs.intThe number of outputs.voidsetChannelCount(int count) Sets the channel count.voidSets how the channel count of each input is decided.voidsetChannelInterpretation(ChannelInterpretation interpretation) Sets how channels are up-mixed and down-mixed.
-
Method Details
-
getContext
The context that created this node.
Returns
the context
-
getNumberOfInputs
public int getNumberOfInputs()The number of inputs.
Returns
0 for a source node
-
getNumberOfOutputs
public int getNumberOfOutputs()The number of outputs.
Returns
0 for the destination
-
getChannelCount
public int getChannelCount()The channel count inputs are mixed to, subject to the channel count mode.
Returns
the channel count
-
setChannelCount
public void setChannelCount(int count) Sets the channel count.
Parameters
count: 1 to 32, or less for nodes that restrict it
-
getChannelCountMode
How the channel count of each input is decided.
Returns
the mode
-
setChannelCountMode
Sets how the channel count of each input is decided.
Parameters
mode: the mode
-
getChannelInterpretation
How channels are up-mixed and down-mixed.
Returns
the interpretation
-
setChannelInterpretation
Sets how channels are up-mixed and down-mixed.
Parameters
interpretation: the interpretation
-
connect
-
connect
Connects an output of this node to an input of
destination. Connecting the same pair twice has no further effect.Parameters
-
destination: the node to feed -
output: the output of this node -
input: the input ofdestination
Returns
destination -
-
connect
Connects output 0 to an
AudioParam, whose value then has this output, mixed down to mono, added to it.Parameters
param: the parameter to modulate
-
connect
Connects an output to an
AudioParam.Parameters
-
param: the parameter to modulate -
output: the output of this node
-
-
disconnect
public void disconnect()Removes every outgoing connection. -
disconnect
public void disconnect(int output) Removes every connection from one output.
Parameters
output: the output of this node
-
disconnect
Removes every connection to
destination.Parameters
destination: the node to stop feeding
-
disconnect
Removes one connection.
Parameters
-
destination: the node fed -
output: the output of this node -
input: the input ofdestination
-
-
disconnect
Removes every connection to
param.Parameters
param: the parameter to stop modulating
-