| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo. | 67 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo. |
| 68 if (inputBus != outputBus) | 68 if (inputBus != outputBus) |
| 69 outputBus->copyFrom(*inputBus); | 69 outputBus->copyFrom(*inputBus); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void AnalyserNode::reset() | 72 void AnalyserNode::reset() |
| 73 { | 73 { |
| 74 m_analyser.reset(); | 74 m_analyser.reset(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AnalyserNode::setFftSize(unsigned size, ExceptionState& es) | 77 void AnalyserNode::setFftSize(unsigned size, ExceptionState& exceptionState) |
| 78 { | 78 { |
| 79 if (!m_analyser.setFftSize(size)) { | 79 if (!m_analyser.setFftSize(size)) { |
| 80 es.throwDOMException( | 80 exceptionState.throwDOMException( |
| 81 IndexSizeError, | 81 IndexSizeError, |
| 82 ExceptionMessages::failedToSet( | 82 ExceptionMessages::failedToSet( |
| 83 "fftSize", | 83 "fftSize", |
| 84 "AnalyserNode", | 84 "AnalyserNode", |
| 85 "FFT size (" + String::number(size) | 85 "FFT size (" + String::number(size) |
| 86 + ") must be a power of two between " | 86 + ") must be a power of two between " |
| 87 + String::number(RealtimeAnalyser::MinFFTSize) + " and " | 87 + String::number(RealtimeAnalyser::MinFFTSize) + " and " |
| 88 + String::number(RealtimeAnalyser::MaxFFTSize) + ", inclusive"))
; | 88 + String::number(RealtimeAnalyser::MaxFFTSize) + ", inclusive"))
; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void AnalyserNode::setMinDecibels(float k, ExceptionState& es) | 92 void AnalyserNode::setMinDecibels(float k, ExceptionState& exceptionState) |
| 93 { | 93 { |
| 94 if (k <= maxDecibels()) { | 94 if (k <= maxDecibels()) { |
| 95 m_analyser.setMinDecibels(k); | 95 m_analyser.setMinDecibels(k); |
| 96 } else { | 96 } else { |
| 97 es.throwDOMException( | 97 exceptionState.throwDOMException( |
| 98 IndexSizeError, | 98 IndexSizeError, |
| 99 ExceptionMessages::failedToSet( | 99 ExceptionMessages::failedToSet( |
| 100 "minDecibels", | 100 "minDecibels", |
| 101 "AnalyserNode", | 101 "AnalyserNode", |
| 102 "minDecibels (" + String::number(k) | 102 "minDecibels (" + String::number(k) |
| 103 + ") must be less than or equal maxDecibels (" + String::number(
maxDecibels()) | 103 + ") must be less than or equal maxDecibels (" + String::number(
maxDecibels()) |
| 104 + ").")); | 104 + ").")); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 void AnalyserNode::setMaxDecibels(float k, ExceptionState& es) | 108 void AnalyserNode::setMaxDecibels(float k, ExceptionState& exceptionState) |
| 109 { | 109 { |
| 110 if (k >= minDecibels()) { | 110 if (k >= minDecibels()) { |
| 111 m_analyser.setMaxDecibels(k); | 111 m_analyser.setMaxDecibels(k); |
| 112 } else { | 112 } else { |
| 113 es.throwDOMException( | 113 exceptionState.throwDOMException( |
| 114 IndexSizeError, | 114 IndexSizeError, |
| 115 ExceptionMessages::failedToSet( | 115 ExceptionMessages::failedToSet( |
| 116 "maxDecibels", | 116 "maxDecibels", |
| 117 "AnalyserNode", | 117 "AnalyserNode", |
| 118 "maxDecibels (" + String::number(k) | 118 "maxDecibels (" + String::number(k) |
| 119 + ") must be greater than or equal minDecibels (" + String::numb
er(minDecibels()) | 119 + ") must be greater than or equal minDecibels (" + String::numb
er(minDecibels()) |
| 120 + ").")); | 120 + ").")); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionState& es) | 124 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionState& exceptionSt
ate) |
| 125 { | 125 { |
| 126 if (k >= 0 && k <= 1) { | 126 if (k >= 0 && k <= 1) { |
| 127 m_analyser.setSmoothingTimeConstant(k); | 127 m_analyser.setSmoothingTimeConstant(k); |
| 128 } else { | 128 } else { |
| 129 es.throwDOMException( | 129 exceptionState.throwDOMException( |
| 130 IndexSizeError, | 130 IndexSizeError, |
| 131 ExceptionMessages::failedToSet( | 131 ExceptionMessages::failedToSet( |
| 132 "smoothingTimeConstant", | 132 "smoothingTimeConstant", |
| 133 "AnalyserNode", | 133 "AnalyserNode", |
| 134 "smoothing value (" + String::number(k) | 134 "smoothing value (" + String::number(k) |
| 135 + ") must be between 0 and 1, inclusive.")); | 135 + ") must be between 0 and 1, inclusive.")); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace WebCore | 139 } // namespace WebCore |
| 140 | 140 |
| 141 #endif // ENABLE(WEB_AUDIO) | 141 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |