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

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

Issue 2420983002: AudioParams with automations must process timelines (Closed)
Patch Set: Fix paths. Created 3 years, 11 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 10 matching lines...) Expand all
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #include "modules/webaudio/GainNode.h" 26 #include "modules/webaudio/GainNode.h"
27 #include "modules/webaudio/AudioNodeInput.h" 27 #include "modules/webaudio/AudioNodeInput.h"
28 #include "modules/webaudio/AudioNodeOutput.h" 28 #include "modules/webaudio/AudioNodeOutput.h"
29 #include "modules/webaudio/GainOptions.h" 29 #include "modules/webaudio/GainOptions.h"
30 #include "platform/audio/AudioBus.h" 30 #include "platform/audio/AudioBus.h"
31 #include "platform/audio/AudioUtilities.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 GainHandler::GainHandler(AudioNode& node, 35 GainHandler::GainHandler(AudioNode& node,
35 float sampleRate, 36 float sampleRate,
36 AudioParamHandler& gain) 37 AudioParamHandler& gain)
37 : AudioHandler(NodeTypeGain, node, sampleRate), 38 : AudioHandler(NodeTypeGain, node, sampleRate),
38 m_lastGain(1.0), 39 m_lastGain(1.0),
39 m_gain(gain), 40 m_gain(gain),
40 m_sampleAccurateGainValues( 41 m_sampleAccurateGainValues(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // If the gain is 0 (and we've converged on dezippering), just zero the 89 // If the gain is 0 (and we've converged on dezippering), just zero the
89 // bus and set the silence hint. 90 // bus and set the silence hint.
90 outputBus->zero(); 91 outputBus->zero();
91 } else { 92 } else {
92 outputBus->copyWithGainFrom(*inputBus, &m_lastGain, m_gain->value()); 93 outputBus->copyWithGainFrom(*inputBus, &m_lastGain, m_gain->value());
93 } 94 }
94 } 95 }
95 } 96 }
96 } 97 }
97 98
99 void GainHandler::processOnlyAudioParams(size_t framesToProcess) {
100 DCHECK(context()->isAudioThread());
101 DCHECK_LE(framesToProcess, AudioUtilities::kRenderQuantumFrames);
102
103 float values[AudioUtilities::kRenderQuantumFrames];
104
105 m_gain->calculateSampleAccurateValues(values, framesToProcess);
106 }
107
98 // FIXME: this can go away when we do mixing with gain directly in summing 108 // FIXME: this can go away when we do mixing with gain directly in summing
99 // junction of AudioNodeInput 109 // junction of AudioNodeInput
100 // 110 //
101 // As soon as we know the channel count of our input, we can lazily initialize. 111 // As soon as we know the channel count of our input, we can lazily initialize.
102 // Sometimes this may be called more than once with different channel counts, in 112 // Sometimes this may be called more than once with different channel counts, in
103 // which case we must safely uninitialize and then re-initialize with the new 113 // which case we must safely uninitialize and then re-initialize with the new
104 // channel count. 114 // channel count.
105 void GainHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) { 115 void GainHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) {
106 DCHECK(context()->isAudioThread()); 116 DCHECK(context()->isAudioThread());
107 ASSERT(context()->isGraphOwner()); 117 ASSERT(context()->isGraphOwner());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 AudioParam* GainNode::gain() const { 178 AudioParam* GainNode::gain() const {
169 return m_gain; 179 return m_gain;
170 } 180 }
171 181
172 DEFINE_TRACE(GainNode) { 182 DEFINE_TRACE(GainNode) {
173 visitor->trace(m_gain); 183 visitor->trace(m_gain);
174 AudioNode::trace(visitor); 184 AudioNode::trace(visitor);
175 } 185 }
176 186
177 } // namespace blink 187 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/GainNode.h ('k') | third_party/WebKit/Source/modules/webaudio/PannerNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698