| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 // Remove all events starting at startTime. | 296 // Remove all events starting at startTime. |
| 297 for (unsigned i = 0; i < m_events.size(); ++i) { | 297 for (unsigned i = 0; i < m_events.size(); ++i) { |
| 298 if (m_events[i].time() >= startTime) { | 298 if (m_events[i].time() >= startTime) { |
| 299 m_events.remove(i, m_events.size() - i); | 299 m_events.remove(i, m_events.size() - i); |
| 300 break; | 300 break; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 float AudioParamTimeline::valueForContextTime(AbstractAudioContext* context, flo
at defaultValue, bool& hasValue) | 305 float AudioParamTimeline::valueForContextTime(AudioDestinationHandler& audioDest
ination, float defaultValue, bool& hasValue) |
| 306 { | 306 { |
| 307 ASSERT(context); | |
| 308 | |
| 309 { | 307 { |
| 310 MutexTryLocker tryLocker(m_eventsLock); | 308 MutexTryLocker tryLocker(m_eventsLock); |
| 311 if (!tryLocker.locked() || !context || !m_events.size() || context->curr
entTime() < m_events[0].time()) { | 309 if (!tryLocker.locked() || !m_events.size() || audioDestination.currentT
ime() < m_events[0].time()) { |
| 312 hasValue = false; | 310 hasValue = false; |
| 313 return defaultValue; | 311 return defaultValue; |
| 314 } | 312 } |
| 315 } | 313 } |
| 316 | 314 |
| 317 // Ask for just a single value. | 315 // Ask for just a single value. |
| 318 float value; | 316 float value; |
| 319 double sampleRate = context->sampleRate(); | 317 double sampleRate = audioDestination.sampleRate(); |
| 320 size_t startFrame = context->currentSampleFrame(); | 318 size_t startFrame = audioDestination.currentSampleFrame(); |
| 321 double controlRate = sampleRate / AudioHandler::ProcessingSizeInFrames; // o
ne parameter change per render quantum | 319 double controlRate = sampleRate / AudioHandler::ProcessingSizeInFrames; // o
ne parameter change per render quantum |
| 322 value = valuesForFrameRange(startFrame, startFrame + 1, defaultValue, &value
, 1, sampleRate, controlRate); | 320 value = valuesForFrameRange(startFrame, startFrame + 1, defaultValue, &value
, 1, sampleRate, controlRate); |
| 323 | 321 |
| 324 hasValue = true; | 322 hasValue = true; |
| 325 return value; | 323 return value; |
| 326 } | 324 } |
| 327 | 325 |
| 328 float AudioParamTimeline::valuesForFrameRange( | 326 float AudioParamTimeline::valuesForFrameRange( |
| 329 size_t startFrame, | 327 size_t startFrame, |
| 330 size_t endFrame, | 328 size_t endFrame, |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 for (; writeIndex < numberOfValues; ++writeIndex) | 813 for (; writeIndex < numberOfValues; ++writeIndex) |
| 816 values[writeIndex] = value; | 814 values[writeIndex] = value; |
| 817 | 815 |
| 818 // This value is used to set the .value attribute of the AudioParam. it sho
uld be the last | 816 // This value is used to set the .value attribute of the AudioParam. it sho
uld be the last |
| 819 // computed value. | 817 // computed value. |
| 820 return values[numberOfValues - 1]; | 818 return values[numberOfValues - 1]; |
| 821 } | 819 } |
| 822 | 820 |
| 823 } // namespace blink | 821 } // namespace blink |
| 824 | 822 |
| OLD | NEW |