Chromium Code Reviews| 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 | 28 |
| 29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
| 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 "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.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(AudioContext* context, float sampleRate, double maxDelayTim e, ExceptionState& exceptionState) | 38 DelayNode::DelayNode(AudioContext* context, float sampleRate, double maxDelayTim e) |
| 39 : AudioBasicProcessorNode(NodeTypeDelay, context, sampleRate) | 39 : AudioBasicProcessorNode(NodeTypeDelay, context, sampleRate) |
|
haraken
2015/03/20 13:42:01
, m_processor(new DelayProcessor(context, sampleRa
| |
| 40 { | 40 { |
| 41 m_processor = new DelayProcessor(context, sampleRate, 1, maxDelayTime); | |
| 42 } | |
| 43 | |
| 44 DelayNode* DelayNode::create(AudioContext* context, float sampleRate, double max DelayTime, ExceptionState& exceptionState) | |
| 45 { | |
| 41 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { | 46 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { |
| 42 exceptionState.throwDOMException( | 47 exceptionState.throwDOMException( |
| 43 NotSupportedError, | 48 NotSupportedError, |
| 44 "max delay time (" + String::number(maxDelayTime) | 49 "max delay time (" + String::number(maxDelayTime) |
| 45 + ") must be between 0 and " + String::number(maximumAllowedDelayTim e) | 50 + ") must be between 0 and " + String::number(maximumAllowedDelayTim e) |
| 46 + ", exclusive."); | 51 + ", exclusive."); |
| 47 return; | 52 return nullptr; |
| 48 } | 53 } |
| 49 m_processor = new DelayProcessor(context, sampleRate, 1, maxDelayTime); | 54 return new DelayNode(context, sampleRate, maxDelayTime); |
| 50 } | 55 } |
| 51 | 56 |
| 52 AudioParam* DelayNode::delayTime() | 57 AudioParam* DelayNode::delayTime() |
| 53 { | 58 { |
| 54 return delayProcessor()->delayTime(); | 59 return delayProcessor()->delayTime(); |
| 55 } | 60 } |
| 56 | 61 |
| 57 } // namespace blink | 62 } // namespace blink |
| 58 | 63 |
| 59 #endif // ENABLE(WEB_AUDIO) | 64 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |