OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/webaudio/IIRFilterNode.h" | 5 #include "modules/webaudio/IIRFilterNode.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "modules/webaudio/AudioBasicProcessorHandler.h" | 10 #include "modules/webaudio/AudioBasicProcessorHandler.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 DEFINE_TRACE(IIRFilterNode) { | 120 DEFINE_TRACE(IIRFilterNode) { |
121 AudioNode::Trace(visitor); | 121 AudioNode::Trace(visitor); |
122 } | 122 } |
123 | 123 |
124 IIRProcessor* IIRFilterNode::IirProcessor() const { | 124 IIRProcessor* IIRFilterNode::IirProcessor() const { |
125 return static_cast<IIRProcessor*>( | 125 return static_cast<IIRProcessor*>( |
126 static_cast<AudioBasicProcessorHandler&>(Handler()).Processor()); | 126 static_cast<AudioBasicProcessorHandler&>(Handler()).Processor()); |
127 } | 127 } |
128 | 128 |
129 void IIRFilterNode::getFrequencyResponse(const DOMFloat32Array* frequency_hz, | 129 void IIRFilterNode::getFrequencyResponse( |
130 DOMFloat32Array* mag_response, | 130 NotShared<const DOMFloat32Array> frequency_hz, |
131 DOMFloat32Array* phase_response, | 131 NotShared<DOMFloat32Array> mag_response, |
132 ExceptionState& exception_state) { | 132 NotShared<DOMFloat32Array> phase_response, |
133 if (!frequency_hz) { | 133 ExceptionState& exception_state) { |
| 134 if (!frequency_hz.View()) { |
134 exception_state.ThrowDOMException(kNotSupportedError, | 135 exception_state.ThrowDOMException(kNotSupportedError, |
135 "frequencyHz array cannot be null"); | 136 "frequencyHz array cannot be null"); |
136 return; | 137 return; |
137 } | 138 } |
138 | 139 |
139 if (!mag_response) { | 140 if (!mag_response.View()) { |
140 exception_state.ThrowDOMException(kNotSupportedError, | 141 exception_state.ThrowDOMException(kNotSupportedError, |
141 "magResponse array cannot be null"); | 142 "magResponse array cannot be null"); |
142 return; | 143 return; |
143 } | 144 } |
144 | 145 |
145 if (!phase_response) { | 146 if (!phase_response.View()) { |
146 exception_state.ThrowDOMException(kNotSupportedError, | 147 exception_state.ThrowDOMException(kNotSupportedError, |
147 "phaseResponse array cannot be null"); | 148 "phaseResponse array cannot be null"); |
148 return; | 149 return; |
149 } | 150 } |
150 | 151 |
151 unsigned frequency_hz_length = frequency_hz->length(); | 152 unsigned frequency_hz_length = frequency_hz.View()->length(); |
152 | 153 |
153 if (mag_response->length() < frequency_hz_length) { | 154 if (mag_response.View()->length() < frequency_hz_length) { |
154 exception_state.ThrowDOMException( | 155 exception_state.ThrowDOMException( |
155 kNotSupportedError, | 156 kNotSupportedError, |
156 ExceptionMessages::IndexExceedsMinimumBound( | 157 ExceptionMessages::IndexExceedsMinimumBound( |
157 "magResponse length", mag_response->length(), frequency_hz_length)); | 158 "magResponse length", mag_response.View()->length(), |
| 159 frequency_hz_length)); |
158 return; | 160 return; |
159 } | 161 } |
160 | 162 |
161 if (phase_response->length() < frequency_hz_length) { | 163 if (phase_response.View()->length() < frequency_hz_length) { |
162 exception_state.ThrowDOMException( | 164 exception_state.ThrowDOMException( |
163 kNotSupportedError, ExceptionMessages::IndexExceedsMinimumBound( | 165 kNotSupportedError, |
164 "phaseResponse length", | 166 ExceptionMessages::IndexExceedsMinimumBound( |
165 phase_response->length(), frequency_hz_length)); | 167 "phaseResponse length", phase_response.View()->length(), |
| 168 frequency_hz_length)); |
166 return; | 169 return; |
167 } | 170 } |
168 | 171 |
169 IirProcessor()->GetFrequencyResponse( | 172 IirProcessor()->GetFrequencyResponse( |
170 frequency_hz_length, frequency_hz->Data(), mag_response->Data(), | 173 frequency_hz_length, frequency_hz.View()->Data(), |
171 phase_response->Data()); | 174 mag_response.View()->Data(), phase_response.View()->Data()); |
172 } | 175 } |
173 | 176 |
174 } // namespace blink | 177 } // namespace blink |
OLD | NEW |