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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ASSERT_NOT_REACHED(); | 111 ASSERT_NOT_REACHED(); |
112 } | 112 } |
113 | 113 |
114 bool OscillatorNode::setType(unsigned type) | 114 bool OscillatorNode::setType(unsigned type) |
115 { | 115 { |
116 PeriodicWave* periodicWave = 0; | 116 PeriodicWave* periodicWave = 0; |
117 float sampleRate = this->sampleRate(); | 117 float sampleRate = this->sampleRate(); |
118 | 118 |
119 switch (type) { | 119 switch (type) { |
120 case SINE: { | 120 case SINE: { |
| 121 #if !ENABLE(OILPAN) |
121 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createS
ine(sampleRate))); | 122 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createS
ine(sampleRate))); |
122 periodicWave = periodicWaveSine; | 123 periodicWave = periodicWaveSine; |
| 124 #else |
| 125 periodicWave = PeriodicWave::createSine(sampleRate); |
| 126 #endif |
123 break; | 127 break; |
124 } | 128 } |
125 case SQUARE: { | 129 case SQUARE: { |
| 130 #if !ENABLE(OILPAN) |
126 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSquare, (PeriodicWave::creat
eSquare(sampleRate))); | 131 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSquare, (PeriodicWave::creat
eSquare(sampleRate))); |
127 periodicWave = periodicWaveSquare; | 132 periodicWave = periodicWaveSquare; |
| 133 #else |
| 134 periodicWave = PeriodicWave::createSquare(sampleRate); |
| 135 #endif |
128 break; | 136 break; |
129 } | 137 } |
130 case SAWTOOTH: { | 138 case SAWTOOTH: { |
| 139 #if !ENABLE(OILPAN) |
131 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSawtooth, (PeriodicWave::cre
ateSawtooth(sampleRate))); | 140 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSawtooth, (PeriodicWave::cre
ateSawtooth(sampleRate))); |
132 periodicWave = periodicWaveSawtooth; | 141 periodicWave = periodicWaveSawtooth; |
| 142 #else |
| 143 periodicWave = PeriodicWave::createSawtooth(sampleRate); |
| 144 #endif |
133 break; | 145 break; |
134 } | 146 } |
135 case TRIANGLE: { | 147 case TRIANGLE: { |
| 148 #if !ENABLE(OILPAN) |
136 DEFINE_STATIC_REF(PeriodicWave, periodicWaveTriangle, (PeriodicWave::cre
ateTriangle(sampleRate))); | 149 DEFINE_STATIC_REF(PeriodicWave, periodicWaveTriangle, (PeriodicWave::cre
ateTriangle(sampleRate))); |
137 periodicWave = periodicWaveTriangle; | 150 periodicWave = periodicWaveTriangle; |
| 151 #else |
| 152 periodicWave = PeriodicWave::createTriangle(sampleRate); |
| 153 #endif |
138 break; | 154 break; |
139 } | 155 } |
140 case CUSTOM: | 156 case CUSTOM: |
141 default: | 157 default: |
142 // Return error for invalid types, including CUSTOM since setPeriodicWav
e() method must be | 158 // Return error for invalid types, including CUSTOM since setPeriodicWav
e() method must be |
143 // called explicitly. | 159 // called explicitly. |
144 return false; | 160 return false; |
145 } | 161 } |
146 | 162 |
147 setPeriodicWave(periodicWave); | 163 setPeriodicWave(periodicWave); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 355 } |
340 | 356 |
341 bool OscillatorNode::propagatesSilence() const | 357 bool OscillatorNode::propagatesSilence() const |
342 { | 358 { |
343 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); | 359 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); |
344 } | 360 } |
345 | 361 |
346 } // namespace WebCore | 362 } // namespace WebCore |
347 | 363 |
348 #endif // ENABLE(WEB_AUDIO) | 364 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |