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

Side by Side Diff: Source/modules/webaudio/AudioNodeOutput.cpp

Issue 349213007: WebAudio: Remove AudioNode::RefType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webaudio/delaynode-max-nondefault-delay.html Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioNodeOutput.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 propagateChannelCount(); 94 propagateChannelCount();
95 } 95 }
96 } 96 }
97 97
98 void AudioNodeOutput::propagateChannelCount() 98 void AudioNodeOutput::propagateChannelCount()
99 { 99 {
100 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 100 ASSERT(context()->isAudioThread() && context()->isGraphOwner());
101 101
102 if (isChannelCountKnown()) { 102 if (isChannelCountKnown()) {
103 // Announce to any nodes we're connected to that we changed our channel count for its input. 103 // Announce to any nodes we're connected to that we changed our channel count for its input.
104 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 104 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i)
105 AudioNodeInput* input = *i; 105 i->value->checkNumberOfChannelsForInput(i->key);
106 AudioNode* connectionNode = input->node();
107 connectionNode->checkNumberOfChannelsForInput(input);
108 }
109 } 106 }
110 } 107 }
111 108
112 AudioBus* AudioNodeOutput::pull(AudioBus* inPlaceBus, size_t framesToProcess) 109 AudioBus* AudioNodeOutput::pull(AudioBus* inPlaceBus, size_t framesToProcess)
113 { 110 {
114 ASSERT(context()->isAudioThread()); 111 ASSERT(context()->isAudioThread());
115 ASSERT(m_renderingFanOutCount > 0 || m_renderingParamFanOutCount > 0); 112 ASSERT(m_renderingFanOutCount > 0 || m_renderingParamFanOutCount > 0);
116 113
117 // Causes our AudioNode to process if it hasn't already for this render quan tum. 114 // Causes our AudioNode to process if it hasn't already for this render quan tum.
118 // We try to do in-place processing (using inPlaceBus) if at all possible, 115 // We try to do in-place processing (using inPlaceBus) if at all possible,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 149 }
153 150
154 void AudioNodeOutput::addInput(AudioNodeInput* input) 151 void AudioNodeOutput::addInput(AudioNodeInput* input)
155 { 152 {
156 ASSERT(context()->isGraphOwner()); 153 ASSERT(context()->isGraphOwner());
157 154
158 ASSERT(input); 155 ASSERT(input);
159 if (!input) 156 if (!input)
160 return; 157 return;
161 158
162 m_inputs.add(input); 159 m_inputs.add(input, input->node());
160 input->node()->makeConnection();
163 } 161 }
164 162
165 void AudioNodeOutput::removeInput(AudioNodeInput* input) 163 void AudioNodeOutput::removeInput(AudioNodeInput* input)
166 { 164 {
167 ASSERT(context()->isGraphOwner()); 165 ASSERT(context()->isGraphOwner());
168 166
169 ASSERT(input); 167 ASSERT(input);
170 if (!input) 168 if (!input)
171 return; 169 return;
172 170
171 input->node()->breakConnection();
173 m_inputs.remove(input); 172 m_inputs.remove(input);
174 } 173 }
175 174
176 void AudioNodeOutput::disconnectAllInputs() 175 void AudioNodeOutput::disconnectAllInputs()
177 { 176 {
178 ASSERT(context()->isGraphOwner()); 177 ASSERT(context()->isGraphOwner());
179 178
180 // AudioNodeInput::disconnect() changes m_inputs by calling removeInput(). 179 // AudioNodeInput::disconnect() changes m_inputs by calling removeInput().
181 while (!m_inputs.isEmpty()) { 180 while (!m_inputs.isEmpty())
182 AudioNodeInput* input = *m_inputs.begin(); 181 m_inputs.begin()->key->disconnect(this);
183 input->disconnect(this);
184 }
185 } 182 }
186 183
187 void AudioNodeOutput::addParam(AudioParam* param) 184 void AudioNodeOutput::addParam(AudioParam* param)
188 { 185 {
189 ASSERT(context()->isGraphOwner()); 186 ASSERT(context()->isGraphOwner());
190 187
191 ASSERT(param); 188 ASSERT(param);
192 if (!param) 189 if (!param)
193 return; 190 return;
194 191
(...skipping 26 matching lines...) Expand all
221 { 218 {
222 disconnectAllInputs(); 219 disconnectAllInputs();
223 disconnectAllParams(); 220 disconnectAllParams();
224 } 221 }
225 222
226 void AudioNodeOutput::disable() 223 void AudioNodeOutput::disable()
227 { 224 {
228 ASSERT(context()->isGraphOwner()); 225 ASSERT(context()->isGraphOwner());
229 226
230 if (m_isEnabled) { 227 if (m_isEnabled) {
231 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 228 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i)
232 AudioNodeInput* input = *i; 229 i->key->disable(this);
233 input->disable(this);
234 }
235 m_isEnabled = false; 230 m_isEnabled = false;
236 } 231 }
237 } 232 }
238 233
239 void AudioNodeOutput::enable() 234 void AudioNodeOutput::enable()
240 { 235 {
241 ASSERT(context()->isGraphOwner()); 236 ASSERT(context()->isGraphOwner());
242 237
243 if (!m_isEnabled) { 238 if (!m_isEnabled) {
244 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 239 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i)
245 AudioNodeInput* input = *i; 240 i->key->enable(this);
246 input->enable(this);
247 }
248 m_isEnabled = true; 241 m_isEnabled = true;
249 } 242 }
250 } 243 }
251 244
252 } // namespace WebCore 245 } // namespace WebCore
253 246
254 #endif // ENABLE(WEB_AUDIO) 247 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioNodeOutput.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698