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

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

Issue 2599813002: Use double for time-related variables (Closed)
Patch Set: Created 3 years, 12 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 | « no previous file | 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } else if (nextEventType == ParamEvent::ExponentialRampToValue) { 723 } else if (nextEventType == ParamEvent::ExponentialRampToValue) {
724 if (value1 * value2 <= 0) { 724 if (value1 * value2 <= 0) {
725 // It's an error if value1 and value2 have opposite signs or if one of 725 // It's an error if value1 and value2 have opposite signs or if one of
726 // them is zero. Handle this by propagating the previous value, and 726 // them is zero. Handle this by propagating the previous value, and
727 // making it the default. 727 // making it the default.
728 value = value1; 728 value = value1;
729 729
730 for (; writeIndex < fillToFrame; ++writeIndex) 730 for (; writeIndex < fillToFrame; ++writeIndex)
731 values[writeIndex] = value; 731 values[writeIndex] = value;
732 } else { 732 } else {
733 float numSampleFrames = deltaTime * sampleRate; 733 double numSampleFrames = deltaTime * sampleRate;
734 // The value goes exponentially from value1 to value2 in a duration of 734 // The value goes exponentially from value1 to value2 in a duration of
735 // deltaTime seconds according to 735 // deltaTime seconds according to
736 // 736 //
737 // v(t) = v1*(v2/v1)^((t-t1)/(t2-t1)) 737 // v(t) = v1*(v2/v1)^((t-t1)/(t2-t1))
738 // 738 //
739 // Let c be currentFrame and F be the sampleRate. Then we want to 739 // Let c be currentFrame and F be the sampleRate. Then we want to
740 // sample v(t) at times t = (c + k)/F for k = 0, 1, ...: 740 // sample v(t) at times t = (c + k)/F for k = 0, 1, ...:
741 // 741 //
742 // v((c+k)/F) = v1*(v2/v1)^(((c/F+k/F)-t1)/(t2-t1)) 742 // v((c+k)/F) = v1*(v2/v1)^(((c/F+k/F)-t1)/(t2-t1))
743 // = v1*(v2/v1)^((c/F-t1)/(t2-t1)) 743 // = v1*(v2/v1)^((c/F-t1)/(t2-t1))
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 // propagate the last value to the end of the values buffer. 1096 // propagate the last value to the end of the values buffer.
1097 for (; writeIndex < numberOfValues; ++writeIndex) 1097 for (; writeIndex < numberOfValues; ++writeIndex)
1098 values[writeIndex] = value; 1098 values[writeIndex] = value;
1099 1099
1100 // This value is used to set the .value attribute of the AudioParam. it 1100 // This value is used to set the .value attribute of the AudioParam. it
1101 // should be the last computed value. 1101 // should be the last computed value.
1102 return values[numberOfValues - 1]; 1102 return values[numberOfValues - 1];
1103 } 1103 }
1104 1104
1105 } // namespace blink 1105 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698