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

Side by Side Diff: third_party/WebKit/Source/platform/audio/HRTFPanner.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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // We are assuming that the inherent smoothing in the HRTF processing is good 343 // We are assuming that the inherent smoothing in the HRTF processing is good
344 // enough, and we don't want to increase the complexity of the HRTF panner by 344 // enough, and we don't want to increase the complexity of the HRTF panner by
345 // 15-20 times. (We need to compute one output sample for each possibly 345 // 15-20 times. (We need to compute one output sample for each possibly
346 // different impulse response. That N^2. Previously, we used an FFT to do 346 // different impulse response. That N^2. Previously, we used an FFT to do
347 // them all at once for a complexity of N/log2(N). Hence, N/log2(N) times 347 // them all at once for a complexity of N/log2(N). Hence, N/log2(N) times
348 // more complex.) 348 // more complex.)
349 Pan(desired_azimuth[0], elevation[0], input_bus, output_bus, 349 Pan(desired_azimuth[0], elevation[0], input_bus, output_bus,
350 frames_to_process, channel_interpretation); 350 frames_to_process, channel_interpretation);
351 } 351 }
352 352
353 bool HRTFPanner::RequiresTailProcessing() const {
354 // Always return true since the tail and latency are never zero.
355 return true;
356 }
357
353 double HRTFPanner::TailTime() const { 358 double HRTFPanner::TailTime() const {
354 // Because HRTFPanner is implemented with a DelayKernel and a FFTConvolver, 359 // Because HRTFPanner is implemented with a DelayKernel and a FFTConvolver,
355 // the tailTime of the HRTFPanner is the sum of the tailTime of the 360 // the tailTime of the HRTFPanner is the sum of the tailTime of the
356 // DelayKernel and the tailTime of the FFTConvolver, which is 361 // DelayKernel and the tailTime of the FFTConvolver, which is
357 // MaxDelayTimeSeconds and fftSize() / 2, respectively. 362 // MaxDelayTimeSeconds and fftSize() / 2, respectively.
358 return kMaxDelayTimeSeconds + 363 return kMaxDelayTimeSeconds +
359 (FftSize() / 2) / static_cast<double>(SampleRate()); 364 (FftSize() / 2) / static_cast<double>(SampleRate());
360 } 365 }
361 366
362 double HRTFPanner::LatencyTime() const { 367 double HRTFPanner::LatencyTime() const {
363 // The latency of a FFTConvolver is also fftSize() / 2, and is in addition to 368 // The latency of a FFTConvolver is also fftSize() / 2, and is in addition to
364 // its tailTime of the same value. 369 // its tailTime of the same value.
365 return (FftSize() / 2) / static_cast<double>(SampleRate()); 370 return (FftSize() / 2) / static_cast<double>(SampleRate());
366 } 371 }
367 372
368 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/HRTFPanner.h ('k') | third_party/WebKit/Source/platform/audio/Panner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698