OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 else if (type == "square") | 105 else if (type == "square") |
106 setType(SQUARE); | 106 setType(SQUARE); |
107 else if (type == "sawtooth") | 107 else if (type == "sawtooth") |
108 setType(SAWTOOTH); | 108 setType(SAWTOOTH); |
109 else if (type == "triangle") | 109 else if (type == "triangle") |
110 setType(TRIANGLE); | 110 setType(TRIANGLE); |
111 } | 111 } |
112 | 112 |
113 bool OscillatorNode::setType(unsigned type) | 113 bool OscillatorNode::setType(unsigned type) |
114 { | 114 { |
115 PeriodicWave* periodicWave = 0; | 115 PeriodicWave* periodicWave = nullptr; |
116 float sampleRate = this->sampleRate(); | 116 float sampleRate = this->sampleRate(); |
117 | 117 |
118 switch (type) { | 118 switch (type) { |
119 case SINE: { | 119 case SINE: { |
120 DEFINE_STATIC_LOCAL(Persistent<PeriodicWave>, periodicWaveSine, (Periodi
cWave::createSine(sampleRate))); | 120 DEFINE_STATIC_LOCAL(Persistent<PeriodicWave>, periodicWaveSine, (Periodi
cWave::createSine(sampleRate))); |
121 periodicWave = periodicWaveSine; | 121 periodicWave = periodicWaveSine; |
122 break; | 122 break; |
123 } | 123 } |
124 case SQUARE: { | 124 case SQUARE: { |
125 DEFINE_STATIC_LOCAL(Persistent<PeriodicWave>, periodicWaveSquare, (Perio
dicWave::createSquare(sampleRate))); | 125 DEFINE_STATIC_LOCAL(Persistent<PeriodicWave>, periodicWaveSquare, (Perio
dicWave::createSquare(sampleRate))); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 { | 346 { |
347 visitor->trace(m_frequency); | 347 visitor->trace(m_frequency); |
348 visitor->trace(m_detune); | 348 visitor->trace(m_detune); |
349 visitor->trace(m_periodicWave); | 349 visitor->trace(m_periodicWave); |
350 AudioScheduledSourceNode::trace(visitor); | 350 AudioScheduledSourceNode::trace(visitor); |
351 } | 351 } |
352 | 352 |
353 } // namespace blink | 353 } // namespace blink |
354 | 354 |
355 #endif // ENABLE(WEB_AUDIO) | 355 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |