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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 #include <stdio.h> | 35 #include <stdio.h> |
36 #include <algorithm> | 36 #include <algorithm> |
37 #include "platform/audio/DenormalDisabler.h" | 37 #include "platform/audio/DenormalDisabler.h" |
38 #include "wtf/MathExtras.h" | 38 #include "wtf/MathExtras.h" |
39 | 39 |
40 #if OS(MACOSX) | 40 #if OS(MACOSX) |
41 #include <Accelerate/Accelerate.h> | 41 #include <Accelerate/Accelerate.h> |
42 #endif | 42 #endif |
43 | 43 |
44 namespace WebCore { | 44 namespace blink { |
45 | 45 |
46 #if OS(MACOSX) | 46 #if OS(MACOSX) |
47 const int kBufferSize = 1024; | 47 const int kBufferSize = 1024; |
48 #endif | 48 #endif |
49 | 49 |
50 Biquad::Biquad() | 50 Biquad::Biquad() |
51 { | 51 { |
52 #if OS(MACOSX) | 52 #if OS(MACOSX) |
53 // Allocate two samples more for filter history | 53 // Allocate two samples more for filter history |
54 m_inputBuffer.allocate(kBufferSize + 2); | 54 m_inputBuffer.allocate(kBufferSize + 2); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 double omega = -piDouble * frequency[k]; | 577 double omega = -piDouble * frequency[k]; |
578 Complex z = Complex(cos(omega), sin(omega)); | 578 Complex z = Complex(cos(omega), sin(omega)); |
579 Complex numerator = b0 + (b1 + b2 * z) * z; | 579 Complex numerator = b0 + (b1 + b2 * z) * z; |
580 Complex denominator = Complex(1, 0) + (a1 + a2 * z) * z; | 580 Complex denominator = Complex(1, 0) + (a1 + a2 * z) * z; |
581 Complex response = numerator / denominator; | 581 Complex response = numerator / denominator; |
582 magResponse[k] = static_cast<float>(abs(response)); | 582 magResponse[k] = static_cast<float>(abs(response)); |
583 phaseResponse[k] = static_cast<float>(atan2(imag(response), real(respons
e))); | 583 phaseResponse[k] = static_cast<float>(atan2(imag(response), real(respons
e))); |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 } // namespace WebCore | 587 } // namespace blink |
588 | 588 |
589 #endif // ENABLE(WEB_AUDIO) | 589 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |