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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 float timelineValue = m_timeline.valueForContextTime(context(), narrowPr
ecisionToFloat(m_value), hasValue); | 129 float timelineValue = m_timeline.valueForContextTime(context(), narrowPr
ecisionToFloat(m_value), hasValue); |
130 | 130 |
131 if (hasValue) | 131 if (hasValue) |
132 m_value = timelineValue; | 132 m_value = timelineValue; |
133 | 133 |
134 values[0] = narrowPrecisionToFloat(m_value); | 134 values[0] = narrowPrecisionToFloat(m_value); |
135 } | 135 } |
136 | 136 |
137 // Now sum all of the audio-rate connections together (unity-gain summing ju
nction). | 137 // Now sum all of the audio-rate connections together (unity-gain summing ju
nction). |
138 // Note that connections would normally be mono, but we mix down to mono if
necessary. | 138 // Note that connections would normally be mono, but we mix down to mono if
necessary. |
139 AudioBus summingBus(1, numberOfValues, false); | 139 RefPtr<AudioBus> summingBus = AudioBus::create(1, numberOfValues, false); |
140 summingBus.setChannelMemory(0, values, numberOfValues); | 140 summingBus->setChannelMemory(0, values, numberOfValues); |
141 | 141 |
142 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { | 142 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { |
143 AudioNodeOutput* output = renderingOutput(i); | 143 AudioNodeOutput* output = renderingOutput(i); |
144 ASSERT(output); | 144 ASSERT(output); |
145 | 145 |
146 // Render audio from this output. | 146 // Render audio from this output. |
147 AudioBus* connectionBus = output->pull(0, AudioNode::ProcessingSizeInFra
mes); | 147 AudioBus* connectionBus = output->pull(0, AudioNode::ProcessingSizeInFra
mes); |
148 | 148 |
149 // Sum, with unity-gain. | 149 // Sum, with unity-gain. |
150 summingBus.sumFrom(*connectionBus); | 150 summingBus->sumFrom(*connectionBus); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 void AudioParam::calculateTimelineValues(float* values, unsigned numberOfValues) | 154 void AudioParam::calculateTimelineValues(float* values, unsigned numberOfValues) |
155 { | 155 { |
156 // Calculate values for this render quantum. | 156 // Calculate values for this render quantum. |
157 // Normally numberOfValues will equal AudioNode::ProcessingSizeInFrames (the
render quantum size). | 157 // Normally numberOfValues will equal AudioNode::ProcessingSizeInFrames (the
render quantum size). |
158 double sampleRate = context()->sampleRate(); | 158 double sampleRate = context()->sampleRate(); |
159 double startTime = context()->currentTime(); | 159 double startTime = context()->currentTime(); |
160 double endTime = startTime + numberOfValues / sampleRate; | 160 double endTime = startTime + numberOfValues / sampleRate; |
(...skipping 30 matching lines...) Expand all Loading... |
191 if (m_outputs.contains(output)) { | 191 if (m_outputs.contains(output)) { |
192 m_outputs.remove(output); | 192 m_outputs.remove(output); |
193 changedOutputs(); | 193 changedOutputs(); |
194 output->removeParam(this); | 194 output->removeParam(this); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 } // namespace WebCore | 198 } // namespace WebCore |
199 | 199 |
200 #endif // ENABLE(WEB_AUDIO) | 200 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |