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

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

Issue 2839063003: Implement tail processing for AudioNodes (Closed)
Patch Set: Make declaration order consistent Created 3 years, 5 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // But don't remove the AnalyserNode if there are no inputs 165 // But don't remove the AnalyserNode if there are no inputs
166 // connected to the node. The node needs to be pulled so that the 166 // connected to the node. The node needs to be pulled so that the
167 // internal state is updated with the correct input signal (of 167 // internal state is updated with the correct input signal (of
168 // zeroes). 168 // zeroes).
169 if (number_of_input_connections && !need_automatic_pull_) { 169 if (number_of_input_connections && !need_automatic_pull_) {
170 Context()->GetDeferredTaskHandler().AddAutomaticPullNode(this); 170 Context()->GetDeferredTaskHandler().AddAutomaticPullNode(this);
171 need_automatic_pull_ = true; 171 need_automatic_pull_ = true;
172 } 172 }
173 } 173 }
174 } 174 }
175
176 bool AnalyserHandler::RequiresTailProcessing() const {
177 // Tail time is always non-zero so tail processing is required.
178 return true;
179 }
180
181 double AnalyserHandler::TailTime() const {
182 return 32768 / static_cast<double>(Context()->sampleRate());
183 };
175 // ---------------------------------------------------------------- 184 // ----------------------------------------------------------------
176 185
177 AnalyserNode::AnalyserNode(BaseAudioContext& context) 186 AnalyserNode::AnalyserNode(BaseAudioContext& context)
178 : AudioBasicInspectorNode(context) { 187 : AudioBasicInspectorNode(context) {
179 SetHandler(AnalyserHandler::Create(*this, context.sampleRate())); 188 SetHandler(AnalyserHandler::Create(*this, context.sampleRate()));
180 } 189 }
181 190
182 AnalyserNode* AnalyserNode::Create(BaseAudioContext& context, 191 AnalyserNode* AnalyserNode::Create(BaseAudioContext& context,
183 ExceptionState& exception_state) { 192 ExceptionState& exception_state) {
184 DCHECK(IsMainThread()); 193 DCHECK(IsMainThread());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 284
276 void AnalyserNode::getFloatTimeDomainData(NotShared<DOMFloat32Array> array) { 285 void AnalyserNode::getFloatTimeDomainData(NotShared<DOMFloat32Array> array) {
277 GetAnalyserHandler().GetFloatTimeDomainData(array.View()); 286 GetAnalyserHandler().GetFloatTimeDomainData(array.View());
278 } 287 }
279 288
280 void AnalyserNode::getByteTimeDomainData(NotShared<DOMUint8Array> array) { 289 void AnalyserNode::getByteTimeDomainData(NotShared<DOMUint8Array> array) {
281 GetAnalyserHandler().GetByteTimeDomainData(array.View()); 290 GetAnalyserHandler().GetByteTimeDomainData(array.View());
282 } 291 }
283 292
284 } // namespace blink 293 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698