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 19 matching lines...) Expand all Loading... |
30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
32 #include "modules/webaudio/AudioBasicProcessorHandler.h" | 32 #include "modules/webaudio/AudioBasicProcessorHandler.h" |
33 #include "modules/webaudio/DelayProcessor.h" | 33 #include "modules/webaudio/DelayProcessor.h" |
34 #include "wtf/MathExtras.h" | 34 #include "wtf/MathExtras.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 const double maximumAllowedDelayTime = 180; | 38 const double maximumAllowedDelayTime = 180; |
39 | 39 |
40 DelayNode::DelayNode(AudioContext& context, float sampleRate, double maxDelayTim
e) | 40 DelayNode::DelayNode(AbstractAudioContext& context, float sampleRate, double max
DelayTime) |
41 : AudioNode(context) | 41 : AudioNode(context) |
42 , m_delayTime(AudioParam::create(context, 0.0)) | 42 , m_delayTime(AudioParam::create(context, 0.0)) |
43 { | 43 { |
44 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeDelay, *
this, sampleRate, adoptPtr(new DelayProcessor(sampleRate, 1, m_delayTime->handle
r(), maxDelayTime)))); | 44 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeDelay, *
this, sampleRate, adoptPtr(new DelayProcessor(sampleRate, 1, m_delayTime->handle
r(), maxDelayTime)))); |
45 } | 45 } |
46 | 46 |
47 DelayNode* DelayNode::create(AudioContext& context, float sampleRate, double max
DelayTime, ExceptionState& exceptionState) | 47 DelayNode* DelayNode::create(AbstractAudioContext& context, float sampleRate, do
uble maxDelayTime, ExceptionState& exceptionState) |
48 { | 48 { |
49 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { | 49 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { |
50 exceptionState.throwDOMException( | 50 exceptionState.throwDOMException( |
51 NotSupportedError, | 51 NotSupportedError, |
52 ExceptionMessages::indexOutsideRange( | 52 ExceptionMessages::indexOutsideRange( |
53 "max delay time", | 53 "max delay time", |
54 maxDelayTime, | 54 maxDelayTime, |
55 0.0, | 55 0.0, |
56 ExceptionMessages::ExclusiveBound, | 56 ExceptionMessages::ExclusiveBound, |
57 maximumAllowedDelayTime, | 57 maximumAllowedDelayTime, |
(...skipping 10 matching lines...) Expand all Loading... |
68 | 68 |
69 DEFINE_TRACE(DelayNode) | 69 DEFINE_TRACE(DelayNode) |
70 { | 70 { |
71 visitor->trace(m_delayTime); | 71 visitor->trace(m_delayTime); |
72 AudioNode::trace(visitor); | 72 AudioNode::trace(visitor); |
73 } | 73 } |
74 | 74 |
75 } // namespace blink | 75 } // namespace blink |
76 | 76 |
77 #endif // ENABLE(WEB_AUDIO) | 77 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |