AudioNode: thuộc tính numberOfInputs

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính numberOfInputs của giao diện AudioNode trả về số lượng đầu vào cấp tín hiệu cho nút. Các nút nguồn được định nghĩa là những nút có thuộc tính numberOfInputs bằng 0.

Giá trị

Một số nguyên ≥ 0.

Ví dụ

js
const audioCtx = new AudioContext();

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.numberOfInputs); // 0
console.log(gainNode.numberOfInputs); // 1
console.log(audioCtx.destination.numberOfInputs); // 1

Thông số kỹ thuật

Specification
Web Audio API
# dom-audionode-numberofinputs

Tương thích trình duyệt

Xem thêm