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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ConvolverNode.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 Input(0).NumberOfChannels(), buffer_->numberOfChannels())); 157 Input(0).NumberOfChannels(), buffer_->numberOfChannels()));
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 AudioBuffer* ConvolverHandler::Buffer() { 162 AudioBuffer* ConvolverHandler::Buffer() {
163 DCHECK(IsMainThread()); 163 DCHECK(IsMainThread());
164 return buffer_.Get(); 164 return buffer_.Get();
165 } 165 }
166 166
167 bool ConvolverHandler::RequiresTailProcessing() const {
168 // Always return true even if the tail time and latency might both
169 // be zero.
170 return true;
171 }
172
167 double ConvolverHandler::TailTime() const { 173 double ConvolverHandler::TailTime() const {
168 MutexTryLocker try_locker(process_lock_); 174 MutexTryLocker try_locker(process_lock_);
169 if (try_locker.Locked()) 175 if (try_locker.Locked())
170 return reverb_ ? reverb_->ImpulseResponseLength() / 176 return reverb_ ? reverb_->ImpulseResponseLength() /
171 static_cast<double>(Context()->sampleRate()) 177 static_cast<double>(Context()->sampleRate())
172 : 0; 178 : 0;
173 // Since we don't want to block the Audio Device thread, we return a large 179 // Since we don't want to block the Audio Device thread, we return a large
174 // value instead of trying to acquire the lock. 180 // value instead of trying to acquire the lock.
175 return std::numeric_limits<double>::infinity(); 181 return std::numeric_limits<double>::infinity();
176 } 182 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 308
303 bool ConvolverNode::normalize() const { 309 bool ConvolverNode::normalize() const {
304 return GetConvolverHandler().Normalize(); 310 return GetConvolverHandler().Normalize();
305 } 311 }
306 312
307 void ConvolverNode::setNormalize(bool normalize) { 313 void ConvolverNode::setNormalize(bool normalize) {
308 GetConvolverHandler().SetNormalize(normalize); 314 GetConvolverHandler().SetNormalize(normalize);
309 } 315 }
310 316
311 } // namespace blink 317 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698