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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 | 183 |
184 void AudioNodeOutput::disconnectAllInputs() | 184 void AudioNodeOutput::disconnectAllInputs() |
185 { | 185 { |
186 ASSERT(context()->isGraphOwner()); | 186 ASSERT(context()->isGraphOwner()); |
187 | 187 |
188 // AudioNodeInput::disconnect() changes m_inputs by calling removeInput(). | 188 // AudioNodeInput::disconnect() changes m_inputs by calling removeInput(). |
189 while (!m_inputs.isEmpty()) | 189 while (!m_inputs.isEmpty()) |
190 m_inputs.begin()->key->disconnect(*this); | 190 m_inputs.begin()->key->disconnect(*this); |
191 } | 191 } |
192 | 192 |
193 void AudioNodeOutput::disconnectInput(AudioNodeInput& input) | |
194 { | |
195 ASSERT(context()->isGraphOwner() && isConnectedWithInput(input)); | |
196 input.disconnect(*this); | |
197 } | |
198 | |
199 void AudioNodeOutput::disconnectAudioParam(AudioParam& param) | |
200 { | |
201 ASSERT(context()->isGraphOwner() && isConnectedWithAudioParam(param)); | |
202 param.disconnect(*this); | |
203 } | |
204 | |
193 void AudioNodeOutput::addParam(AudioParam& param) | 205 void AudioNodeOutput::addParam(AudioParam& param) |
194 { | 206 { |
195 ASSERT(context()->isGraphOwner()); | 207 ASSERT(context()->isGraphOwner()); |
196 m_params.add(¶m); | 208 m_params.add(¶m); |
197 } | 209 } |
198 | 210 |
199 void AudioNodeOutput::removeParam(AudioParam& param) | 211 void AudioNodeOutput::removeParam(AudioParam& param) |
200 { | 212 { |
201 ASSERT(context()->isGraphOwner()); | 213 ASSERT(context()->isGraphOwner()); |
202 m_params.remove(¶m); | 214 m_params.remove(¶m); |
203 } | 215 } |
204 | 216 |
205 void AudioNodeOutput::disconnectAllParams() | 217 void AudioNodeOutput::disconnectAllParams() |
206 { | 218 { |
207 ASSERT(context()->isGraphOwner()); | 219 ASSERT(context()->isGraphOwner()); |
208 | 220 |
209 // AudioParam::disconnect() changes m_params by calling removeParam(). | 221 // AudioParam::disconnect() changes m_params by calling removeParam(). |
210 while (!m_params.isEmpty()) | 222 while (!m_params.isEmpty()) |
211 (*m_params.begin())->disconnect(*this); | 223 (*m_params.begin())->disconnect(*this); |
212 } | 224 } |
213 | 225 |
214 void AudioNodeOutput::disconnectAll() | 226 void AudioNodeOutput::disconnectAll() |
215 { | 227 { |
216 disconnectAllInputs(); | 228 disconnectAllInputs(); |
217 disconnectAllParams(); | 229 disconnectAllParams(); |
218 } | 230 } |
219 | 231 |
232 bool AudioNodeOutput::isConnectedWithInput(AudioNodeInput& input) | |
Raymond Toy
2015/02/11 21:31:18
ConnectedWithInput or ConnectedToInput? I think th
hongchan
2015/02/12 18:38:01
Done.
| |
233 { | |
234 ASSERT(context()->isGraphOwner()); | |
235 return m_inputs.contains(&input); | |
236 } | |
237 | |
238 bool AudioNodeOutput::isConnectedWithAudioParam(AudioParam& param) | |
239 { | |
240 ASSERT(context()->isGraphOwner()); | |
241 return m_params.contains(¶m); | |
242 } | |
243 | |
220 void AudioNodeOutput::disable() | 244 void AudioNodeOutput::disable() |
221 { | 245 { |
222 ASSERT(context()->isGraphOwner()); | 246 ASSERT(context()->isGraphOwner()); |
223 | 247 |
224 if (m_isEnabled) { | 248 if (m_isEnabled) { |
225 m_isEnabled = false; | 249 m_isEnabled = false; |
226 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) | 250 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) |
227 i->key->disable(*this); | 251 i->key->disable(*this); |
228 } | 252 } |
229 } | 253 } |
230 | 254 |
231 void AudioNodeOutput::enable() | 255 void AudioNodeOutput::enable() |
232 { | 256 { |
233 ASSERT(context()->isGraphOwner()); | 257 ASSERT(context()->isGraphOwner()); |
234 | 258 |
235 if (!m_isEnabled) { | 259 if (!m_isEnabled) { |
236 m_isEnabled = true; | 260 m_isEnabled = true; |
237 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) | 261 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) |
238 i->key->enable(*this); | 262 i->key->enable(*this); |
239 } | 263 } |
240 } | 264 } |
241 | 265 |
242 } // namespace blink | 266 } // namespace blink |
243 | 267 |
244 #endif // ENABLE(WEB_AUDIO) | 268 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |