OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 else if (type == "allpass") | 83 else if (type == "allpass") |
84 setType(BiquadProcessor::Allpass); | 84 setType(BiquadProcessor::Allpass); |
85 else | 85 else |
86 ASSERT_NOT_REACHED(); | 86 ASSERT_NOT_REACHED(); |
87 } | 87 } |
88 | 88 |
89 bool BiquadFilterNode::setType(unsigned type) | 89 bool BiquadFilterNode::setType(unsigned type) |
90 { | 90 { |
91 if (type > BiquadProcessor::Allpass) | 91 if (type > BiquadProcessor::Allpass) |
92 return false; | 92 return false; |
93 | 93 |
94 biquadProcessor()->setType(static_cast<BiquadProcessor::FilterType>(type)); | 94 biquadProcessor()->setType(static_cast<BiquadProcessor::FilterType>(type)); |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 void BiquadFilterNode::getFrequencyResponse(const Float32Array* frequencyHz, | 98 void BiquadFilterNode::getFrequencyResponse(const Float32Array* frequencyHz, |
99 Float32Array* magResponse, | 99 Float32Array* magResponse, |
100 Float32Array* phaseResponse) | 100 Float32Array* phaseResponse) |
101 { | 101 { |
102 if (!frequencyHz || !magResponse || !phaseResponse) | 102 if (!frequencyHz || !magResponse || !phaseResponse) |
103 return; | 103 return; |
104 | 104 |
105 int n = std::min(frequencyHz->length(), | 105 int n = std::min(frequencyHz->length(), |
106 std::min(magResponse->length(), phaseResponse->length())); | 106 std::min(magResponse->length(), phaseResponse->length())); |
107 | 107 |
108 if (n) { | 108 if (n) { |
109 biquadProcessor()->getFrequencyResponse(n, | 109 biquadProcessor()->getFrequencyResponse(n, |
110 frequencyHz->data(), | 110 frequencyHz->data(), |
111 magResponse->data(), | 111 magResponse->data(), |
112 phaseResponse->data()); | 112 phaseResponse->data()); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 } // namespace WebCore | 116 } // namespace WebCore |
117 | 117 |
118 #endif // ENABLE(WEB_AUDIO) | 118 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |