| 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 17 matching lines...) Expand all Loading... |
| 28 #include "modules/webaudio/AudioBasicProcessorHandler.h" | 28 #include "modules/webaudio/AudioBasicProcessorHandler.h" |
| 29 #include "modules/webaudio/DelayNode.h" | 29 #include "modules/webaudio/DelayNode.h" |
| 30 #include "modules/webaudio/DelayProcessor.h" | 30 #include "modules/webaudio/DelayProcessor.h" |
| 31 #include "wtf/MathExtras.h" | 31 #include "wtf/MathExtras.h" |
| 32 #include "wtf/PtrUtil.h" | 32 #include "wtf/PtrUtil.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 const double maximumAllowedDelayTime = 180; | 36 const double maximumAllowedDelayTime = 180; |
| 37 | 37 |
| 38 DelayNode::DelayNode(AbstractAudioContext& context, double maxDelayTime) | 38 DelayNode::DelayNode(BaseAudioContext& context, double maxDelayTime) |
| 39 : AudioNode(context) | 39 : AudioNode(context) |
| 40 , m_delayTime(AudioParam::create(context, ParamTypeDelayDelayTime, 0.0, 0.0,
maxDelayTime)) | 40 , m_delayTime(AudioParam::create(context, ParamTypeDelayDelayTime, 0.0, 0.0,
maxDelayTime)) |
| 41 { | 41 { |
| 42 setHandler(AudioBasicProcessorHandler::create( | 42 setHandler(AudioBasicProcessorHandler::create( |
| 43 AudioHandler::NodeTypeDelay, | 43 AudioHandler::NodeTypeDelay, |
| 44 *this, | 44 *this, |
| 45 context.sampleRate(), | 45 context.sampleRate(), |
| 46 wrapUnique(new DelayProcessor( | 46 wrapUnique(new DelayProcessor( |
| 47 context.sampleRate(), | 47 context.sampleRate(), |
| 48 1, | 48 1, |
| 49 m_delayTime->handler(), | 49 m_delayTime->handler(), |
| 50 maxDelayTime)))); | 50 maxDelayTime)))); |
| 51 } | 51 } |
| 52 | 52 |
| 53 DelayNode* DelayNode::create(AbstractAudioContext& context, ExceptionState& exce
ptionState) | 53 DelayNode* DelayNode::create(BaseAudioContext& context, ExceptionState& exceptio
nState) |
| 54 { | 54 { |
| 55 DCHECK(isMainThread()); | 55 DCHECK(isMainThread()); |
| 56 | 56 |
| 57 // The default maximum delay time for the delay node is 1 sec. | 57 // The default maximum delay time for the delay node is 1 sec. |
| 58 return create(context, 1, exceptionState); | 58 return create(context, 1, exceptionState); |
| 59 } | 59 } |
| 60 | 60 |
| 61 DelayNode* DelayNode::create(AbstractAudioContext& context, double maxDelayTime,
ExceptionState& exceptionState) | 61 DelayNode* DelayNode::create(BaseAudioContext& context, double maxDelayTime, Exc
eptionState& exceptionState) |
| 62 { | 62 { |
| 63 DCHECK(isMainThread()); | 63 DCHECK(isMainThread()); |
| 64 | 64 |
| 65 if (context.isContextClosed()) { | 65 if (context.isContextClosed()) { |
| 66 context.throwExceptionForClosedState(exceptionState); | 66 context.throwExceptionForClosedState(exceptionState); |
| 67 return nullptr; | 67 return nullptr; |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { | 70 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { |
| 71 exceptionState.throwDOMException( | 71 exceptionState.throwDOMException( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 DEFINE_TRACE(DelayNode) | 91 DEFINE_TRACE(DelayNode) |
| 92 { | 92 { |
| 93 visitor->trace(m_delayTime); | 93 visitor->trace(m_delayTime); |
| 94 AudioNode::trace(visitor); | 94 AudioNode::trace(visitor); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| 98 | 98 |
| OLD | NEW |