Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/GainNode.cpp

Issue 2033503004: Avoid slow AudioParam automation path when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp ('k') | third_party/WebKit/Source/platform/audio/Biquad.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698