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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 #ifndef NDEBUG | 37 #ifndef NDEBUG |
38 #include <stdio.h> | 38 #include <stdio.h> |
39 #endif | 39 #endif |
40 | 40 |
41 #include "platform/Logging.h" | 41 #include "platform/Logging.h" |
42 #include "wtf/Complex.h" | 42 #include "wtf/Complex.h" |
43 #include "wtf/MathExtras.h" | 43 #include "wtf/MathExtras.h" |
44 #include "wtf/OwnPtr.h" | 44 #include "wtf/OwnPtr.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace blink { |
47 | 47 |
48 void FFTFrame::doPaddedFFT(const float* data, size_t dataSize) | 48 void FFTFrame::doPaddedFFT(const float* data, size_t dataSize) |
49 { | 49 { |
50 // Zero-pad the impulse response | 50 // Zero-pad the impulse response |
51 AudioFloatArray paddedResponse(fftSize()); // zero-initialized | 51 AudioFloatArray paddedResponse(fftSize()); // zero-initialized |
52 paddedResponse.copyToRange(data, 0, dataSize); | 52 paddedResponse.copyToRange(data, 0, dataSize); |
53 | 53 |
54 // Get the frequency-domain version of padded response | 54 // Get the frequency-domain version of padded response |
55 doFFT(paddedResponse.data()); | 55 doFFT(paddedResponse.data()); |
56 } | 56 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 for (int i = 1; i < n; i++) { | 285 for (int i = 1; i < n; i++) { |
286 double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]); | 286 double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]); |
287 double phase = atan2(realP[i], imagP[i]); | 287 double phase = atan2(realP[i], imagP[i]); |
288 | 288 |
289 WTF_LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase); | 289 WTF_LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase); |
290 } | 290 } |
291 WTF_LOG(WebAudio, "****\n"); | 291 WTF_LOG(WebAudio, "****\n"); |
292 } | 292 } |
293 #endif // NDEBUG | 293 #endif // NDEBUG |
294 | 294 |
295 } // namespace WebCore | 295 } // namespace blink |
296 | 296 |
297 #endif // ENABLE(WEB_AUDIO) | 297 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |