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

Side by Side Diff: Source/modules/webaudio/OscillatorNode.cpp

Issue 209423006: WebAudio: Remove legacy support for numerical values for Oscillator types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void OscillatorNode::setType(const String& type) 100 void OscillatorNode::setType(const String& type)
101 { 101 {
102 if (type == "sine") 102 if (type == "sine")
103 setType(SINE); 103 setType(SINE);
104 else if (type == "square") 104 else if (type == "square")
105 setType(SQUARE); 105 setType(SQUARE);
106 else if (type == "sawtooth") 106 else if (type == "sawtooth")
107 setType(SAWTOOTH); 107 setType(SAWTOOTH);
108 else if (type == "triangle") 108 else if (type == "triangle")
109 setType(TRIANGLE); 109 setType(TRIANGLE);
110 else
111 ASSERT_NOT_REACHED();
112 } 110 }
113 111
114 bool OscillatorNode::setType(unsigned type) 112 bool OscillatorNode::setType(unsigned type)
115 { 113 {
116 PeriodicWave* periodicWave = 0; 114 PeriodicWave* periodicWave = 0;
117 float sampleRate = this->sampleRate(); 115 float sampleRate = this->sampleRate();
118 116
119 switch (type) { 117 switch (type) {
120 case SINE: { 118 case SINE: {
121 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createS ine(sampleRate))); 119 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createS ine(sampleRate)));
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 337 }
340 338
341 bool OscillatorNode::propagatesSilence() const 339 bool OscillatorNode::propagatesSilence() const
342 { 340 {
343 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); 341 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get();
344 } 342 }
345 343
346 } // namespace WebCore 344 } // namespace WebCore
347 345
348 #endif // ENABLE(WEB_AUDIO) 346 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698