Chromium Code Reviews| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 return m_dynamicsCompressor->tailTime(); | 118 return m_dynamicsCompressor->tailTime(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 double DynamicsCompressorHandler::latencyTime() const | 121 double DynamicsCompressorHandler::latencyTime() const |
| 122 { | 122 { |
| 123 return m_dynamicsCompressor->latencyTime(); | 123 return m_dynamicsCompressor->latencyTime(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // ---------------------------------------------------------------- | 126 // ---------------------------------------------------------------- |
| 127 | 127 |
| 128 DynamicsCompressorNode::DynamicsCompressorNode(AbstractAudioContext& context, fl oat sampleRate) | 128 DynamicsCompressorNode::DynamicsCompressorNode(AbstractAudioContext& context) |
| 129 : AudioNode(context) | 129 : AudioNode(context) |
| 130 , m_threshold(AudioParam::create(context, ParamTypeDynamicsCompressorThresho ld, -24)) | 130 , m_threshold(AudioParam::create(context, ParamTypeDynamicsCompressorThresho ld, -24)) |
| 131 , m_knee(AudioParam::create(context, ParamTypeDynamicsCompressorKnee, 30)) | 131 , m_knee(AudioParam::create(context, ParamTypeDynamicsCompressorKnee, 30)) |
| 132 , m_ratio(AudioParam::create(context, ParamTypeDynamicsCompressorRatio, 12)) | 132 , m_ratio(AudioParam::create(context, ParamTypeDynamicsCompressorRatio, 12)) |
| 133 , m_attack(AudioParam::create(context, ParamTypeDynamicsCompressorAttack, 0. 003)) | 133 , m_attack(AudioParam::create(context, ParamTypeDynamicsCompressorAttack, 0. 003)) |
| 134 , m_release(AudioParam::create(context, ParamTypeDynamicsCompressorRelease, 0.250)) | 134 , m_release(AudioParam::create(context, ParamTypeDynamicsCompressorRelease, 0.250)) |
| 135 { | 135 { |
| 136 setHandler(DynamicsCompressorHandler::create( | 136 setHandler(DynamicsCompressorHandler::create( |
| 137 *this, | 137 *this, |
| 138 sampleRate, | 138 context.sampleRate(), |
| 139 m_threshold->handler(), | 139 m_threshold->handler(), |
| 140 m_knee->handler(), | 140 m_knee->handler(), |
| 141 m_ratio->handler(), | 141 m_ratio->handler(), |
| 142 m_attack->handler(), | 142 m_attack->handler(), |
| 143 m_release->handler())); | 143 m_release->handler())); |
| 144 } | 144 } |
| 145 | 145 |
| 146 DynamicsCompressorNode* DynamicsCompressorNode::create(AbstractAudioContext& con text, float sampleRate) | 146 DynamicsCompressorNode* DynamicsCompressorNode::create(AbstractAudioContext& con text, ExceptionState& exceptionState) |
| 147 { | 147 { |
| 148 return new DynamicsCompressorNode(context, sampleRate); | 148 ASSERT(isMainThread()); |
|
hongchan
2016/05/13 01:20:12
DCHECK.
Raymond Toy
2016/05/20 23:12:00
Done.
| |
| 149 | |
| 150 if (context.isContextClosed()) { | |
| 151 context.throwExceptionForClosedState(exceptionState); | |
| 152 return nullptr; | |
| 153 } | |
| 154 | |
| 155 return new DynamicsCompressorNode(context); | |
| 149 } | 156 } |
| 150 | 157 |
| 151 DEFINE_TRACE(DynamicsCompressorNode) | 158 DEFINE_TRACE(DynamicsCompressorNode) |
| 152 { | 159 { |
| 153 visitor->trace(m_threshold); | 160 visitor->trace(m_threshold); |
| 154 visitor->trace(m_knee); | 161 visitor->trace(m_knee); |
| 155 visitor->trace(m_ratio); | 162 visitor->trace(m_ratio); |
| 156 visitor->trace(m_attack); | 163 visitor->trace(m_attack); |
| 157 visitor->trace(m_release); | 164 visitor->trace(m_release); |
| 158 AudioNode::trace(visitor); | 165 AudioNode::trace(visitor); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 188 return m_attack; | 195 return m_attack; |
| 189 } | 196 } |
| 190 | 197 |
| 191 AudioParam* DynamicsCompressorNode::release() const | 198 AudioParam* DynamicsCompressorNode::release() const |
| 192 { | 199 { |
| 193 return m_release; | 200 return m_release; |
| 194 } | 201 } |
| 195 | 202 |
| 196 } // namespace blink | 203 } // namespace blink |
| 197 | 204 |
| OLD | NEW |