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 14 matching lines...) Expand all Loading... |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #if ENABLE(WEB_AUDIO) | 27 #if ENABLE(WEB_AUDIO) |
28 | 28 |
29 #include "modules/webaudio/AudioNodeInput.h" | 29 #include "modules/webaudio/AudioNodeInput.h" |
30 | 30 |
31 #include "modules/webaudio/AudioContext.h" | 31 #include "modules/webaudio/AudioContext.h" |
32 #include "modules/webaudio/AudioNodeOutput.h" | 32 #include "modules/webaudio/AudioNodeOutput.h" |
33 #include <algorithm> | 33 #include <algorithm> |
34 | 34 |
35 using namespace std; | |
36 | |
37 namespace WebCore { | 35 namespace WebCore { |
38 | 36 |
39 inline AudioNodeInput::AudioNodeInput(AudioNode* node) | 37 inline AudioNodeInput::AudioNodeInput(AudioNode* node) |
40 : AudioSummingJunction(node->context()) | 38 : AudioSummingJunction(node->context()) |
41 , m_node(node) | 39 , m_node(node) |
42 { | 40 { |
43 // Set to mono by default. | 41 // Set to mono by default. |
44 m_internalSummingBus = AudioBus::create(1, AudioNode::ProcessingSizeInFrames
); | 42 m_internalSummingBus = AudioBus::create(1, AudioNode::ProcessingSizeInFrames
); |
45 } | 43 } |
46 | 44 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (mode == AudioNode::Explicit) | 155 if (mode == AudioNode::Explicit) |
158 return node()->channelCount(); | 156 return node()->channelCount(); |
159 | 157 |
160 // Find the number of channels of the connection with the largest number of
channels. | 158 // Find the number of channels of the connection with the largest number of
channels. |
161 unsigned maxChannels = 1; // one channel is the minimum allowed | 159 unsigned maxChannels = 1; // one channel is the minimum allowed |
162 | 160 |
163 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outpu
ts.end(); ++i) { | 161 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outpu
ts.end(); ++i) { |
164 AudioNodeOutput* output = *i; | 162 AudioNodeOutput* output = *i; |
165 // Use output()->numberOfChannels() instead of output->bus()->numberOfCh
annels(), | 163 // Use output()->numberOfChannels() instead of output->bus()->numberOfCh
annels(), |
166 // because the calling of AudioNodeOutput::bus() is not safe here. | 164 // because the calling of AudioNodeOutput::bus() is not safe here. |
167 maxChannels = max(maxChannels, output->numberOfChannels()); | 165 maxChannels = std::max(maxChannels, output->numberOfChannels()); |
168 } | 166 } |
169 | 167 |
170 if (mode == AudioNode::ClampedMax) | 168 if (mode == AudioNode::ClampedMax) |
171 maxChannels = min(maxChannels, static_cast<unsigned>(node()->channelCoun
t())); | 169 maxChannels = std::min(maxChannels, static_cast<unsigned>(node()->channe
lCount())); |
172 | 170 |
173 return maxChannels; | 171 return maxChannels; |
174 } | 172 } |
175 | 173 |
176 AudioBus* AudioNodeInput::bus() | 174 AudioBus* AudioNodeInput::bus() |
177 { | 175 { |
178 ASSERT(context()->isAudioThread()); | 176 ASSERT(context()->isAudioThread()); |
179 | 177 |
180 // Handle single connection specially to allow for in-place processing. | 178 // Handle single connection specially to allow for in-place processing. |
181 if (numberOfRenderingConnections() == 1 && node()->internalChannelCountMode(
) == AudioNode::Max) | 179 if (numberOfRenderingConnections() == 1 && node()->internalChannelCountMode(
) == AudioNode::Max) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 239 |
242 // Handle multiple connections case. | 240 // Handle multiple connections case. |
243 sumAllConnections(internalSummingBus, framesToProcess); | 241 sumAllConnections(internalSummingBus, framesToProcess); |
244 | 242 |
245 return internalSummingBus; | 243 return internalSummingBus; |
246 } | 244 } |
247 | 245 |
248 } // namespace WebCore | 246 } // namespace WebCore |
249 | 247 |
250 #endif // ENABLE(WEB_AUDIO) | 248 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |