Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp

Issue 1911133002: Remove connection from AudioParamHandler to AudioContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and Rename Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698