summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/channel-count-processor.js
blob: 556459f46b3074f03578c53ba7b967387bab071b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * @class ChannelCountProcessor
 * @extends AudioWorkletProcessor
 */
class ChannelCountProcessor extends AudioWorkletProcessor {
  constructor(options) {
    super(options);
  }

  process(inputs, outputs) {
    this.port.postMessage({
      inputChannel: inputs[0].length,
      outputChannel: outputs[0].length
    });
    return false;
  }
}

registerProcessor('channel-count', ChannelCountProcessor);