| Index: third_party/WebKit/LayoutTests/webaudio/audioworklet/processors.js
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/audioworklet/processors.js b/third_party/WebKit/LayoutTests/webaudio/audioworklet/processors.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..175c09416cdc42fc08ebceaa4fb3e475db02b000
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/audioworklet/processors.js
|
| @@ -0,0 +1,56 @@
|
| +'use strict'
|
| +
|
| +registerProcessor('bypass', class Bypass extends AudioWorkletProcessor {
|
| + constructor () {
|
| + super();
|
| + }
|
| +
|
| + process (input, output) {
|
| + let inputChannelData = input.getChannelData(0);
|
| + let outputChannelData = output.getChannelData(0);
|
| + outputChannelData.set(inputChannelData);
|
| + }
|
| +});
|
| +
|
| +registerProcessor('noise', class Noise extends AudioWorkletProcessor {
|
| + static get parameterDescriptors () {
|
| + return [{
|
| + name: 'gain',
|
| + defaultValue: 0.25,
|
| + minValue: 0,
|
| + maxValue: 1
|
| + }];
|
| + }
|
| +
|
| + constructor () {
|
| + super();
|
| + }
|
| +
|
| + process (input, output) {
|
| + let inputChannelData = input.getChannelData(0);
|
| + let outputChannelData = output.getChannelData(0);
|
| + for (let i = 0; i < 128; ++i) {
|
| + outputChannelData[i] =
|
| + (inputChannelData[i] * 0.05) + (Math.random() * 0.95);
|
| + }
|
| + }
|
| +});
|
| +
|
| +registerProcessor('onepole', class OnePole extends AudioWorkletProcessor {
|
| + constructor () {
|
| + super();
|
| + let cutoffFrequency = 500;
|
| + this.b1 = Math.exp(-2 * Math.PI * cutoffFrequency / 48000);
|
| + this.a0 = 1.0 - this.b1;
|
| + this.z1 = 0;
|
| + }
|
| +
|
| + process (input, output) {
|
| + let inputChannelData = input.getChannelData(0);
|
| + let outputChannelData = output.getChannelData(0);
|
| + for (let i = 0; i < 128; ++i) {
|
| + this.z1 = inputChannelData[i] * this.a0 + this.z1 * this.b1;
|
| + outputChannelData[i] = this.z1;
|
| + }
|
| + }
|
| +});
|
|
|