summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js
blob: 714e32dbb5c1d0fbe4d0ff2ae38deaed75b4b96e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * @class TimingInfoProcessor
 * @extends AudioWorkletProcessor
 *
 * This processor class is to test the timing information in AWGS.
 */
class TimingInfoProcessor extends AudioWorkletProcessor {
  constructor() {
    super();
    this.port.onmessage = this.echoMessage.bind(this);
  }

  echoMessage(event) {
    this.port.postMessage({
      currentTime: currentTime,
      currentFrame: currentFrame
    });
  }

  process() {
    return true;
  }
}

registerProcessor('timing-info-processor', TimingInfoProcessor);