| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 float AudioParamHandler::finalValue() | 210 float AudioParamHandler::finalValue() |
| 211 { | 211 { |
| 212 float value = intrinsicValue(); | 212 float value = intrinsicValue(); |
| 213 calculateFinalValues(&value, 1, false); | 213 calculateFinalValues(&value, 1, false); |
| 214 return value; | 214 return value; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void AudioParamHandler::calculateSampleAccurateValues(float* values, unsigned nu
mberOfValues) | 217 void AudioParamHandler::calculateSampleAccurateValues(float* values, unsigned nu
mberOfValues) |
| 218 { | 218 { |
| 219 bool isSafe = deferredTaskHandler().isAudioThread() && values && numberOfVal
ues; | 219 bool isSafe = deferredTaskHandler().isAudioThread() && values && numberOfVal
ues; |
| 220 ASSERT(isSafe); | 220 DCHECK(isSafe); |
| 221 if (!isSafe) | 221 if (!isSafe) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 calculateFinalValues(values, numberOfValues, true); | 224 calculateFinalValues(values, numberOfValues, true); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void AudioParamHandler::calculateFinalValues(float* values, unsigned numberOfVal
ues, bool sampleAccurate) | 227 void AudioParamHandler::calculateFinalValues(float* values, unsigned numberOfVal
ues, bool sampleAccurate) |
| 228 { | 228 { |
| 229 bool isGood = deferredTaskHandler().isAudioThread() && values && numberOfVal
ues; | 229 bool isGood = deferredTaskHandler().isAudioThread() && values && numberOfVal
ues; |
| 230 ASSERT(isGood); | 230 DCHECK(isGood); |
| 231 if (!isGood) | 231 if (!isGood) |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 // The calculated result will be the "intrinsic" value summed with all audio
-rate connections. | 234 // The calculated result will be the "intrinsic" value summed with all audio
-rate connections. |
| 235 | 235 |
| 236 if (sampleAccurate) { | 236 if (sampleAccurate) { |
| 237 // Calculate sample-accurate (a-rate) intrinsic values. | 237 // Calculate sample-accurate (a-rate) intrinsic values. |
| 238 calculateTimelineValues(values, numberOfValues); | 238 calculateTimelineValues(values, numberOfValues); |
| 239 } else { | 239 } else { |
| 240 // Calculate control-rate (k-rate) intrinsic value. | 240 // Calculate control-rate (k-rate) intrinsic value. |
| 241 bool hasValue; | 241 bool hasValue; |
| 242 float value = intrinsicValue(); | 242 float value = intrinsicValue(); |
| 243 float timelineValue = m_timeline.valueForContextTime(destinationHandler(
), value, hasValue, minValue(), maxValue()); | 243 float timelineValue = m_timeline.valueForContextTime(destinationHandler(
), value, hasValue, minValue(), maxValue()); |
| 244 | 244 |
| 245 if (hasValue) | 245 if (hasValue) |
| 246 value = timelineValue; | 246 value = timelineValue; |
| 247 | 247 |
| 248 values[0] = value; | 248 values[0] = value; |
| 249 setIntrinsicValue(value); | 249 setIntrinsicValue(value); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Now sum all of the audio-rate connections together (unity-gain summing ju
nction). | 252 // Now sum all of the audio-rate connections together (unity-gain summing ju
nction). |
| 253 // Note that connections would normally be mono, but we mix down to mono if
necessary. | 253 // Note that connections would normally be mono, but we mix down to mono if
necessary. |
| 254 RefPtr<AudioBus> summingBus = AudioBus::create(1, numberOfValues, false); | 254 RefPtr<AudioBus> summingBus = AudioBus::create(1, numberOfValues, false); |
| 255 summingBus->setChannelMemory(0, values, numberOfValues); | 255 summingBus->setChannelMemory(0, values, numberOfValues); |
| 256 | 256 |
| 257 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { | 257 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { |
| 258 AudioNodeOutput* output = renderingOutput(i); | 258 AudioNodeOutput* output = renderingOutput(i); |
| 259 ASSERT(output); | 259 DCHECK(output); |
| 260 | 260 |
| 261 // Render audio from this output. | 261 // Render audio from this output. |
| 262 AudioBus* connectionBus = output->pull(0, AudioHandler::ProcessingSizeIn
Frames); | 262 AudioBus* connectionBus = output->pull(0, AudioHandler::ProcessingSizeIn
Frames); |
| 263 | 263 |
| 264 // Sum, with unity-gain. | 264 // Sum, with unity-gain. |
| 265 summingBus->sumFrom(*connectionBus); | 265 summingBus->sumFrom(*connectionBus); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 void AudioParamHandler::calculateTimelineValues(float* values, unsigned numberOf
Values) | 269 void AudioParamHandler::calculateTimelineValues(float* values, unsigned numberOf
Values) |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState&
exceptionState) | 500 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState&
exceptionState) |
| 501 { | 501 { |
| 502 handler().timeline().cancelScheduledValues(startTime, exceptionState); | 502 handler().timeline().cancelScheduledValues(startTime, exceptionState); |
| 503 return this; | 503 return this; |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace blink | 506 } // namespace blink |
| 507 | 507 |
| OLD | NEW |