| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 | 30 |
| 31 #if ENABLE(WEB_AUDIO) | 31 #if ENABLE(WEB_AUDIO) |
| 32 | 32 |
| 33 #include "platform/audio/HRTFKernel.h" | 33 #include "platform/audio/HRTFKernel.h" |
| 34 | 34 |
| 35 #include "platform/audio/AudioChannel.h" | 35 #include "platform/audio/AudioChannel.h" |
| 36 #include "platform/audio/FFTFrame.h" | |
| 37 #include "platform/FloatConversion.h" | 36 #include "platform/FloatConversion.h" |
| 38 #include "wtf/MathExtras.h" | 37 #include "wtf/MathExtras.h" |
| 39 | 38 |
| 40 using namespace std; | 39 using namespace std; |
| 41 | 40 |
| 42 namespace WebCore { | 41 namespace WebCore { |
| 43 | 42 |
| 44 // Takes the input AudioChannel as an input impulse response and calculates the
average group delay. | 43 // Takes the input AudioChannel as an input impulse response and calculates the
average group delay. |
| 45 // This represents the initial delay before the most energetic part of the impul
se response. | 44 // This represents the initial delay before the most energetic part of the impul
se response. |
| 46 // The sample-frame delay is removed from the impulseP impulse response, and thi
s value is returned. | 45 // The sample-frame delay is removed from the impulseP impulse response, and thi
s value is returned. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 126 |
| 128 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay
(); | 127 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay
(); |
| 129 | 128 |
| 130 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern
el1->fftFrame(), *kernel2->fftFrame(), x); | 129 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern
el1->fftFrame(), *kernel2->fftFrame(), x); |
| 131 return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRat
e1); | 130 return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRat
e1); |
| 132 } | 131 } |
| 133 | 132 |
| 134 } // namespace WebCore | 133 } // namespace WebCore |
| 135 | 134 |
| 136 #endif // ENABLE(WEB_AUDIO) | 135 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |