summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/input-count-processor.js
blob: 6d53ba84c7a79aeb699e83df4aab81816559ddb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * @class CountProcessor
 * @extends AudioWorkletProcessor
 *
 * This processor class just looks at the number of input channels on the first
 * input and fills the first output channel with that value.
 */
class CountProcessor extends AudioWorkletProcessor {
  constructor() {
    super();
  }

  process(inputs, outputs, parameters) {
    let input = inputs[0];
    let output = outputs[0];
    output[0].fill(input.length);

    return true;
  }
}

registerProcessor('counter', CountProcessor);