ConstantSourceNode()
构造函数创建新
ConstantSourceNode
object instance, representing an audio source which constantly outputs samples whose values are always the same.
var constantSourceNode = new ConstantSourceNode(context, options);
context
AudioContext
representing the audio context you want the node to be associated with.
选项
ConstantSourceOptions
dictionary object defining the properties you want the
ConstantSourceNode
to have:
offset
: A read-only
AudioParam
specifying the constant value generated by the source. The default is 1.0. The normal range is -1.0 to 1.0, but the value can be anywhere in the range from
-Infinity
to
+Infinity
.
In this example, an audio context is created, then a
ConstantSourceNode
is established with its
offset
initialized to 0.5.
let audioContext = new AudioContext();
let myConstantSource = new ConstantSourceNode(audioContext, { offset: 0.5 });
注意
: The new
ConstantSourceNode
created by the constructor has a
channelCount
of 2.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 音频 API
The definition of 'ConstantSourceNode: ConstantSourceNode' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ConstantSourceNode()
构造函数
|
Chrome 56 | Edge ≤79 | Firefox 52 | IE No | Opera 43 | Safari No | WebView Android 56 | Chrome Android 56 | Firefox Android 52 | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
完整支持
不支持
ConstantSourceNode
ConstantSourceNode()
AnalyserNode
AudioBuffer
AudioBufferSourceNode
AudioContext
AudioContextOptions
AudioDestinationNode
AudioListener
AudioNode
AudioNodeOptions
AudioParam
AudioProcessingEvent
AudioScheduledSourceNode
AudioWorklet
AudioWorkletGlobalScope
AudioWorkletNode
AudioWorkletProcessor
BaseAudioContext
BiquadFilterNode
ChannelMergerNode
ChannelSplitterNode
ConvolverNode
DelayNode
DynamicsCompressorNode
GainNode
IIRFilterNode
MediaElementAudioSourceNode
MediaStreamAudioDestinationNode
MediaStreamAudioSourceNode
OfflineAudioCompletionEvent
OfflineAudioContext
OscillatorNode
PannerNode
PeriodicWave
StereoPannerNode
WaveShaperNode