| OLD | NEW |
| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } else if (m_crossfadeIncr < 0 && fabs(m_crossfadeX) < -m_crossfadeI
ncr) { | 285 } else if (m_crossfadeIncr < 0 && fabs(m_crossfadeX) < -m_crossfadeI
ncr) { |
| 286 // We've fully made the crossfade transition from 2 -> 1. | 286 // We've fully made the crossfade transition from 2 -> 1. |
| 287 m_crossfadeSelection = CrossfadeSelection1; | 287 m_crossfadeSelection = CrossfadeSelection1; |
| 288 m_crossfadeX = 0; | 288 m_crossfadeX = 0; |
| 289 m_crossfadeIncr = 0; | 289 m_crossfadeIncr = 0; |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 void HRTFPanner::panWithSampleAccurateValues(double* desiredAzimuth, double* ele
vation, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess) |
| 296 { |
| 297 // Sample-accurate (a-rate) HRTF panner is not implemented, just k-rate. Ju
st grab the current |
| 298 // azimuth/elevation and use that. |
| 299 // |
| 300 // We are assuming that the inherent smoothing in the HRTF processing is goo
d enough, and we |
| 301 // don't want to increase the complexity of the HRTF panner by 15-20 times.
(We need to cmopute |
| 302 // one output sample for each possibly different impulse response. That N^2
. Previously, we |
| 303 // used an FFT to do them all at once for a complexity of N/log2(N). Hence,
N/log2(N) times |
| 304 // more complex.) |
| 305 pan(desiredAzimuth[0], elevation[0], inputBus, outputBus, framesToProcess); |
| 306 } |
| 307 |
| 295 double HRTFPanner::tailTime() const | 308 double HRTFPanner::tailTime() const |
| 296 { | 309 { |
| 297 // Because HRTFPanner is implemented with a DelayKernel and a FFTConvolver,
the tailTime of the HRTFPanner | 310 // Because HRTFPanner is implemented with a DelayKernel and a FFTConvolver,
the tailTime of the HRTFPanner |
| 298 // is the sum of the tailTime of the DelayKernel and the tailTime of the FFT
Convolver, which is MaxDelayTimeSeconds | 311 // is the sum of the tailTime of the DelayKernel and the tailTime of the FFT
Convolver, which is MaxDelayTimeSeconds |
| 299 // and fftSize() / 2, respectively. | 312 // and fftSize() / 2, respectively. |
| 300 return MaxDelayTimeSeconds + (fftSize() / 2) / static_cast<double>(sampleRat
e()); | 313 return MaxDelayTimeSeconds + (fftSize() / 2) / static_cast<double>(sampleRat
e()); |
| 301 } | 314 } |
| 302 | 315 |
| 303 double HRTFPanner::latencyTime() const | 316 double HRTFPanner::latencyTime() const |
| 304 { | 317 { |
| 305 // The latency of a FFTConvolver is also fftSize() / 2, and is in addition t
o its tailTime of the | 318 // The latency of a FFTConvolver is also fftSize() / 2, and is in addition t
o its tailTime of the |
| 306 // same value. | 319 // same value. |
| 307 return (fftSize() / 2) / static_cast<double>(sampleRate()); | 320 return (fftSize() / 2) / static_cast<double>(sampleRate()); |
| 308 } | 321 } |
| 309 | 322 |
| 310 } // namespace blink | 323 } // namespace blink |
| 311 | 324 |
| OLD | NEW |