| Index: chrome/test/data/extensions/api_test/tabs/basics/sinewave.js
|
| diff --git a/chrome/test/data/extensions/api_test/tabs/basics/sinewave.js b/chrome/test/data/extensions/api_test/tabs/basics/sinewave.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..771566b10c50f83d09afea060daa69eeff56c343
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/tabs/basics/sinewave.js
|
| @@ -0,0 +1,23 @@
|
| +var freqs = [200, 500, 1800];
|
| +var curTestIdx = 0;
|
| +if (!this.audioContext) {
|
| + this.audioContext = new AudioContext();
|
| + this.gainNode = this.audioContext.createGain();
|
| + this.gainNode.gain.value = 0.5;
|
| + this.gainNode.connect(this.audioContext.destination);
|
| +}
|
| +if (!this.oscillator ||
|
| + this.oscillator.frequency.value != freqs[curTestIdx]) {
|
| + // Note: We recreate the oscillator each time because this switches the
|
| + // audio frequency immediately. Re-using the same oscillator tends to take
|
| + // several hundred milliseconds to ramp-up/down the frequency.
|
| + if (this.oscillator) {
|
| + this.oscillator.stop();
|
| + this.oscillator.disconnect();
|
| + }
|
| + this.oscillator = this.audioContext.createOscillator();
|
| + this.oscillator.type = OscillatorNode.SINE;
|
| + this.oscillator.frequency.value = freqs[curTestIdx];
|
| + this.oscillator.connect(this.gainNode);
|
| + this.oscillator.start();
|
| +}
|
|
|