Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/sinewave.js

Issue 987583004: Add audible, muted to Tab, c.t.query, c.t.update, and c.t.onUpdated where relevant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch1
Patch Set: followups through message #33 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function enableSineWave() {
6 var freqs = [200, 500, 1800];
7 var curTestIdx = 0;
not at google - send to devlin 2015/06/01 20:33:57 am I missing something, or is curTestIdx never act
Jared Sohn 2015/06/02 08:54:38 Just a note on this: I didn't write most of this c
8 if (!this.audioContext) {
9 this.audioContext = new AudioContext();
not at google - send to devlin 2015/06/01 20:33:56 I'd rather not use |this| here. Trivia: it actuall
Jared Sohn 2015/06/02 08:54:38 Done.
10 this.gainNode = this.audioContext.createGain();
11 this.gainNode.gain.value = 0.5;
12 this.gainNode.connect(this.audioContext.destination);
13 }
14 if (!this.oscillator ||
15 this.oscillator.frequency.value != freqs[curTestIdx]) {
16 // Note: We recreate the oscillator each time because this switches the
17 // audio frequency immediately. Re-using the same oscillator tends to take
18 // several hundred milliseconds to ramp-up/down the frequency.
19 if (this.oscillator) {
20 this.oscillator.stop();
21 this.oscillator.disconnect();
22 }
23 this.oscillator = this.audioContext.createOscillator();
24 this.oscillator.type = OscillatorNode.SINE;
25 this.oscillator.frequency.value = freqs[curTestIdx];
26 this.oscillator.connect(this.gainNode);
27 this.oscillator.start();
28 }
29 }
30
31 function disableSineWave() {
32 this.oscillator.stop();
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698