| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void WaveShaperDSPKernel::processCurve(const float* source, float* destination,
size_t framesToProcess) | 71 void WaveShaperDSPKernel::processCurve(const float* source, float* destination,
size_t framesToProcess) |
| 72 { | 72 { |
| 73 ASSERT(source); | 73 ASSERT(source); |
| 74 ASSERT(destination); | 74 ASSERT(destination); |
| 75 ASSERT(getWaveShaperProcessor()); | 75 ASSERT(getWaveShaperProcessor()); |
| 76 | 76 |
| 77 DOMFloat32Array* curve = getWaveShaperProcessor()->curve(); | 77 Vector<float>* curve = getWaveShaperProcessor()->curve(); |
| 78 if (!curve) { | 78 if (!curve) { |
| 79 // Act as "straight wire" pass-through if no curve is set. | 79 // Act as "straight wire" pass-through if no curve is set. |
| 80 memcpy(destination, source, sizeof(float) * framesToProcess); | 80 memcpy(destination, source, sizeof(float) * framesToProcess); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 | 83 |
| 84 float* curveData = curve->data(); | 84 float* curveData = curve->data(); |
| 85 int curveLength = curve->length(); | 85 int curveLength = curve->size(); |
| 86 | 86 |
| 87 ASSERT(curveData); | 87 ASSERT(curveData); |
| 88 | 88 |
| 89 if (!curveData || !curveLength) { | 89 if (!curveData || !curveLength) { |
| 90 memcpy(destination, source, sizeof(float) * framesToProcess); | 90 memcpy(destination, source, sizeof(float) * framesToProcess); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Apply waveshaping curve. | 94 // Apply waveshaping curve. |
| 95 for (unsigned i = 0; i < framesToProcess; ++i) { | 95 for (unsigned i = 0; i < framesToProcess; ++i) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 default: | 197 default: |
| 198 ASSERT_NOT_REACHED(); | 198 ASSERT_NOT_REACHED(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 return static_cast<double>(latencyFrames) / sampleRate(); | 201 return static_cast<double>(latencyFrames) / sampleRate(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace blink | 204 } // namespace blink |
| 205 | 205 |
| OLD | NEW |