| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } else { | 60 } else { |
| 61 AudioBus* inputBus = input(0).bus(); | 61 AudioBus* inputBus = input(0).bus(); |
| 62 | 62 |
| 63 if (m_gain->hasSampleAccurateValues()) { | 63 if (m_gain->hasSampleAccurateValues()) { |
| 64 // Apply sample-accurate gain scaling for precise envelopes, grain w
indows, etc. | 64 // Apply sample-accurate gain scaling for precise envelopes, grain w
indows, etc. |
| 65 ASSERT(framesToProcess <= m_sampleAccurateGainValues.size()); | 65 ASSERT(framesToProcess <= m_sampleAccurateGainValues.size()); |
| 66 if (framesToProcess <= m_sampleAccurateGainValues.size()) { | 66 if (framesToProcess <= m_sampleAccurateGainValues.size()) { |
| 67 float* gainValues = m_sampleAccurateGainValues.data(); | 67 float* gainValues = m_sampleAccurateGainValues.data(); |
| 68 m_gain->calculateSampleAccurateValues(gainValues, framesToProces
s); | 68 m_gain->calculateSampleAccurateValues(gainValues, framesToProces
s); |
| 69 outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainV
alues, framesToProcess); | 69 outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainV
alues, framesToProcess); |
| 70 // Update m_lastGain so if the timeline ever ends, we get |
| 71 // consistent data for the smoothing below. (Without this, |
| 72 // m_lastGain was the last value before the timeline started |
| 73 // procesing. |
| 74 m_lastGain = gainValues[framesToProcess - 1]; |
| 70 } | 75 } |
| 71 } else { | 76 } else { |
| 72 // Apply the gain with de-zippering into the output bus. | 77 // Apply the gain with de-zippering into the output bus. |
| 73 if (!m_lastGain && m_lastGain == m_gain->value()) { | 78 if (!m_lastGain && m_lastGain == m_gain->value()) { |
| 74 // If the gain is 0 (and we've converged on dezippering), just z
ero the bus and set | 79 // If the gain is 0 (and we've converged on dezippering), just z
ero the bus and set |
| 75 // the silence hint. | 80 // the silence hint. |
| 76 outputBus->zero(); | 81 outputBus->zero(); |
| 77 } else { | 82 } else { |
| 78 outputBus->copyWithGainFrom(*inputBus, &m_lastGain, m_gain->valu
e()); | 83 outputBus->copyWithGainFrom(*inputBus, &m_lastGain, m_gain->valu
e()); |
| 79 } | 84 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 144 } |
| 140 | 145 |
| 141 DEFINE_TRACE(GainNode) | 146 DEFINE_TRACE(GainNode) |
| 142 { | 147 { |
| 143 visitor->trace(m_gain); | 148 visitor->trace(m_gain); |
| 144 AudioNode::trace(visitor); | 149 AudioNode::trace(visitor); |
| 145 } | 150 } |
| 146 | 151 |
| 147 } // namespace blink | 152 } // namespace blink |
| 148 | 153 |
| OLD | NEW |