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

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

Issue 2440583002: Use AudioUtilities::kRenderQuantumFrames everywhere (Closed)
Patch Set: Address review comments Created 4 years, 1 month 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
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 hasValue = false; 391 hasValue = false;
392 return defaultValue; 392 return defaultValue;
393 } 393 }
394 } 394 }
395 395
396 // Ask for just a single value. 396 // Ask for just a single value.
397 float value; 397 float value;
398 double sampleRate = audioDestination.sampleRate(); 398 double sampleRate = audioDestination.sampleRate();
399 size_t startFrame = audioDestination.currentSampleFrame(); 399 size_t startFrame = audioDestination.currentSampleFrame();
400 // One parameter change per render quantum. 400 // One parameter change per render quantum.
401 double controlRate = sampleRate / AudioHandler::ProcessingSizeInFrames; 401 double controlRate = sampleRate / AudioUtilities::kRenderQuantumFrames;
402 value = valuesForFrameRange(startFrame, startFrame + 1, defaultValue, &value, 402 value = valuesForFrameRange(startFrame, startFrame + 1, defaultValue, &value,
403 1, sampleRate, controlRate, minValue, maxValue); 403 1, sampleRate, controlRate, minValue, maxValue);
404 404
405 hasValue = true; 405 hasValue = true;
406 return value; 406 return value;
407 } 407 }
408 408
409 float AudioParamTimeline::valuesForFrameRange(size_t startFrame, 409 float AudioParamTimeline::valuesForFrameRange(size_t startFrame,
410 size_t endFrame, 410 size_t endFrame,
411 float defaultValue, 411 float defaultValue,
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 // propagate the last value to the end of the values buffer. 1047 // propagate the last value to the end of the values buffer.
1048 for (; writeIndex < numberOfValues; ++writeIndex) 1048 for (; writeIndex < numberOfValues; ++writeIndex)
1049 values[writeIndex] = value; 1049 values[writeIndex] = value;
1050 1050
1051 // This value is used to set the .value attribute of the AudioParam. it 1051 // This value is used to set the .value attribute of the AudioParam. it
1052 // should be the last computed value. 1052 // should be the last computed value.
1053 return values[numberOfValues - 1]; 1053 return values[numberOfValues - 1];
1054 } 1054 }
1055 1055
1056 } // namespace blink 1056 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698