--- title: AudioContext.destination slug: Web/API/BaseAudioContext/destination translation_of: Web/API/BaseAudioContext/destination original_slug: Web/API/AudioContext/destination ---
{{ APIRef("Web Audio API") }}
{{ domxref("AudioContext") }}的destination属性返回一个
{{ domxref("AudioDestinationNode") }}表示context中所有音频(节点)的最终目标节点,一般是音频渲染设备,比如扬声器。
var audioCtx = new AudioContext(); gainNode.connect(audioCtx.destination);
An {{ domxref("AudioDestinationNode") }}.
注意:想要完整的例子,可以去看看MDN Github repo的DEMO,比如panner-node
var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); // Older webkit/blink browsers require a prefix var oscillatorNode = audioCtx.createOscillator(); var gainNode = audioCtx.createGain(); oscillatorNode.connect(gainNode); gainNode.connect(audioCtx.destination);
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Audio API', '#widl-AudioContext-destination', 'destination')}} | {{Spec2('Web Audio API')}} |