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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.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) 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 * 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 void WaveShaperDSPKernel::Reset() { 174 void WaveShaperDSPKernel::Reset() {
175 if (up_sampler_) { 175 if (up_sampler_) {
176 up_sampler_->Reset(); 176 up_sampler_->Reset();
177 down_sampler_->Reset(); 177 down_sampler_->Reset();
178 up_sampler2_->Reset(); 178 up_sampler2_->Reset();
179 down_sampler2_->Reset(); 179 down_sampler2_->Reset();
180 } 180 }
181 } 181 }
182 182
183 bool WaveShaperDSPKernel::RequiresTailProcessing() const {
184 // Always return true even if the tail time and latency might both
185 // be zero.
186 return true;
187 }
188
183 double WaveShaperDSPKernel::LatencyTime() const { 189 double WaveShaperDSPKernel::LatencyTime() const {
184 size_t latency_frames = 0; 190 size_t latency_frames = 0;
185 WaveShaperDSPKernel* kernel = const_cast<WaveShaperDSPKernel*>(this); 191 WaveShaperDSPKernel* kernel = const_cast<WaveShaperDSPKernel*>(this);
186 192
187 switch (kernel->GetWaveShaperProcessor()->Oversample()) { 193 switch (kernel->GetWaveShaperProcessor()->Oversample()) {
188 case WaveShaperProcessor::kOverSampleNone: 194 case WaveShaperProcessor::kOverSampleNone:
189 break; 195 break;
190 case WaveShaperProcessor::kOverSample2x: 196 case WaveShaperProcessor::kOverSample2x:
191 latency_frames += up_sampler_->LatencyFrames(); 197 latency_frames += up_sampler_->LatencyFrames();
192 latency_frames += down_sampler_->LatencyFrames(); 198 latency_frames += down_sampler_->LatencyFrames();
(...skipping 11 matching lines...) Expand all
204 break; 210 break;
205 } 211 }
206 default: 212 default:
207 NOTREACHED(); 213 NOTREACHED();
208 } 214 }
209 215
210 return static_cast<double>(latency_frames) / SampleRate(); 216 return static_cast<double>(latency_frames) / SampleRate();
211 } 217 }
212 218
213 } // namespace blink 219 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698