| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 PeriodicWave* PeriodicWave::create(float sampleRate, DOMFloat32Array* real, DOMF
loat32Array* imag) | 50 PeriodicWave* PeriodicWave::create(float sampleRate, DOMFloat32Array* real, DOMF
loat32Array* imag) |
| 51 { | 51 { |
| 52 bool isGood = real && imag && real->length() == imag->length(); | 52 bool isGood = real && imag && real->length() == imag->length(); |
| 53 ASSERT(isGood); | 53 ASSERT(isGood); |
| 54 if (isGood) { | 54 if (isGood) { |
| 55 PeriodicWave* periodicWave = new PeriodicWave(sampleRate); | 55 PeriodicWave* periodicWave = new PeriodicWave(sampleRate); |
| 56 size_t numberOfComponents = real->length(); | 56 size_t numberOfComponents = real->length(); |
| 57 periodicWave->createBandLimitedTables(real->data(), imag->data(), number
OfComponents); | 57 periodicWave->createBandLimitedTables(real->data(), imag->data(), number
OfComponents); |
| 58 return periodicWave; | 58 return periodicWave; |
| 59 } | 59 } |
| 60 return 0; | 60 return nullptr; |
| 61 } | 61 } |
| 62 | 62 |
| 63 PeriodicWave* PeriodicWave::createSine(float sampleRate) | 63 PeriodicWave* PeriodicWave::createSine(float sampleRate) |
| 64 { | 64 { |
| 65 PeriodicWave* periodicWave = new PeriodicWave(sampleRate); | 65 PeriodicWave* periodicWave = new PeriodicWave(sampleRate); |
| 66 periodicWave->generateBasicWaveform(OscillatorNode::SINE); | 66 periodicWave->generateBasicWaveform(OscillatorNode::SINE); |
| 67 return periodicWave; | 67 return periodicWave; |
| 68 } | 68 } |
| 69 | 69 |
| 70 PeriodicWave* PeriodicWave::createSquare(float sampleRate) | 70 PeriodicWave* PeriodicWave::createSquare(float sampleRate) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 realP[n] = 0; | 297 realP[n] = 0; |
| 298 imagP[n] = b; | 298 imagP[n] = b; |
| 299 } | 299 } |
| 300 | 300 |
| 301 createBandLimitedTables(realP, imagP, halfSize); | 301 createBandLimitedTables(realP, imagP, halfSize); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace blink | 304 } // namespace blink |
| 305 | 305 |
| 306 #endif // ENABLE(WEB_AUDIO) | 306 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |