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

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

Issue 1377903002: Use frames instead of time for running AudioParam timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Sum, with unity-gain. 154 // Sum, with unity-gain.
155 summingBus->sumFrom(*connectionBus); 155 summingBus->sumFrom(*connectionBus);
156 } 156 }
157 } 157 }
158 158
159 void AudioParamHandler::calculateTimelineValues(float* values, unsigned numberOf Values) 159 void AudioParamHandler::calculateTimelineValues(float* values, unsigned numberOf Values)
160 { 160 {
161 // Calculate values for this render quantum. Normally numberOfValues will 161 // Calculate values for this render quantum. Normally numberOfValues will
162 // equal to AudioHandler::ProcessingSizeInFrames (the render quantum size). 162 // equal to AudioHandler::ProcessingSizeInFrames (the render quantum size).
163 double sampleRate = context()->sampleRate(); 163 double sampleRate = context()->sampleRate();
164 double startTime = context()->currentTime(); 164 size_t startFrame = context()->currentSampleFrame();
165 double endTime = startTime + numberOfValues / sampleRate; 165 size_t endFrame = startFrame + numberOfValues;
166 166
167 // Note we're running control rate at the sample-rate. 167 // Note we're running control rate at the sample-rate.
168 // Pass in the current value as default value. 168 // Pass in the current value as default value.
169 m_value = m_timeline.valuesForTimeRange(startTime, endTime, narrowPrecisionT oFloat(m_value), values, numberOfValues, sampleRate, sampleRate); 169 m_value = m_timeline.valuesForFrameRange(startFrame, endFrame, narrowPrecisi onToFloat(m_value), values, numberOfValues, sampleRate, sampleRate);
170 } 170 }
171 171
172 void AudioParamHandler::connect(AudioNodeOutput& output) 172 void AudioParamHandler::connect(AudioNodeOutput& output)
173 { 173 {
174 ASSERT(deferredTaskHandler().isGraphOwner()); 174 ASSERT(deferredTaskHandler().isGraphOwner());
175 175
176 if (m_outputs.contains(&output)) 176 if (m_outputs.contains(&output))
177 return; 177 return;
178 178
179 output.addParam(*this); 179 output.addParam(*this);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 void AudioParam::cancelScheduledValues(double startTime, ExceptionState& excepti onState) 253 void AudioParam::cancelScheduledValues(double startTime, ExceptionState& excepti onState)
254 { 254 {
255 handler().timeline().cancelScheduledValues(startTime, exceptionState); 255 handler().timeline().cancelScheduledValues(startTime, exceptionState);
256 } 256 }
257 257
258 } // namespace blink 258 } // namespace blink
259 259
260 #endif // ENABLE(WEB_AUDIO) 260 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698