| 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 * 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 m_analyser.setSmoothingTimeConstant(k); | 106 m_analyser.setSmoothingTimeConstant(k); |
| 107 } else { | 107 } else { |
| 108 exceptionState.throwDOMException( | 108 exceptionState.throwDOMException( |
| 109 IndexSizeError, | 109 IndexSizeError, |
| 110 ExceptionMessages::indexOutsideRange("smoothing value", k, 0.0, Exce
ptionMessages::InclusiveBound, 1.0, ExceptionMessages::InclusiveBound)); | 110 ExceptionMessages::indexOutsideRange("smoothing value", k, 0.0, Exce
ptionMessages::InclusiveBound, 1.0, ExceptionMessages::InclusiveBound)); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 // ---------------------------------------------------------------- | 114 // ---------------------------------------------------------------- |
| 115 | 115 |
| 116 AnalyserNode::AnalyserNode(AbstractAudioContext& context, float sampleRate) | 116 AnalyserNode::AnalyserNode(AbstractAudioContext& context) |
| 117 : AudioBasicInspectorNode(context) | 117 : AudioBasicInspectorNode(context) |
| 118 { | 118 { |
| 119 setHandler(AnalyserHandler::create(*this, sampleRate)); | 119 setHandler(AnalyserHandler::create(*this, context.sampleRate())); |
| 120 } | 120 } |
| 121 | 121 |
| 122 AnalyserNode* AnalyserNode::create(AbstractAudioContext& context, float sampleRa
te) | 122 AnalyserNode* AnalyserNode::create(AbstractAudioContext& context, ExceptionState
& exceptionState) |
| 123 { | 123 { |
| 124 return new AnalyserNode(context, sampleRate); | 124 DCHECK(isMainThread()); |
| 125 |
| 126 if (context.isContextClosed()) { |
| 127 context.throwExceptionForClosedState(exceptionState); |
| 128 return nullptr; |
| 129 } |
| 130 |
| 131 return new AnalyserNode(context); |
| 125 } | 132 } |
| 126 | 133 |
| 127 AnalyserHandler& AnalyserNode::analyserHandler() const | 134 AnalyserHandler& AnalyserNode::analyserHandler() const |
| 128 { | 135 { |
| 129 return static_cast<AnalyserHandler&>(handler()); | 136 return static_cast<AnalyserHandler&>(handler()); |
| 130 } | 137 } |
| 131 | 138 |
| 132 unsigned AnalyserNode::fftSize() const | 139 unsigned AnalyserNode::fftSize() const |
| 133 { | 140 { |
| 134 return analyserHandler().fftSize(); | 141 return analyserHandler().fftSize(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 analyserHandler().getFloatTimeDomainData(array); | 196 analyserHandler().getFloatTimeDomainData(array); |
| 190 } | 197 } |
| 191 | 198 |
| 192 void AnalyserNode::getByteTimeDomainData(DOMUint8Array* array) | 199 void AnalyserNode::getByteTimeDomainData(DOMUint8Array* array) |
| 193 { | 200 { |
| 194 analyserHandler().getByteTimeDomainData(array); | 201 analyserHandler().getByteTimeDomainData(array); |
| 195 } | 202 } |
| 196 | 203 |
| 197 } // namespace blink | 204 } // namespace blink |
| 198 | 205 |
| OLD | NEW |