Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/DelayNode.cpp

Issue 1865583002: Implement BaseAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "core/dom/ExceptionCode.h" 28 #include "core/dom/ExceptionCode.h"
29 #include "modules/webaudio/AudioBasicProcessorHandler.h" 29 #include "modules/webaudio/AudioBasicProcessorHandler.h"
30 #include "modules/webaudio/DelayProcessor.h" 30 #include "modules/webaudio/DelayProcessor.h"
31 #include "wtf/MathExtras.h" 31 #include "wtf/MathExtras.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 const double maximumAllowedDelayTime = 180; 35 const double maximumAllowedDelayTime = 180;
36 36
37 DelayNode::DelayNode(AbstractAudioContext& context, float sampleRate, double max DelayTime) 37 DelayNode::DelayNode(BaseAudioContext& context, float sampleRate, double maxDela yTime)
38 : AudioNode(context) 38 : AudioNode(context)
39 , m_delayTime(AudioParam::create(context, 0.0)) 39 , m_delayTime(AudioParam::create(context, 0.0))
40 { 40 {
41 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeDelay, * this, sampleRate, adoptPtr(new DelayProcessor(sampleRate, 1, m_delayTime->handle r(), maxDelayTime)))); 41 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeDelay, * this, sampleRate, adoptPtr(new DelayProcessor(sampleRate, 1, m_delayTime->handle r(), maxDelayTime))));
42 } 42 }
43 43
44 DelayNode* DelayNode::create(AbstractAudioContext& context, float sampleRate, do uble maxDelayTime, ExceptionState& exceptionState) 44 DelayNode* DelayNode::create(BaseAudioContext& context, float sampleRate, double maxDelayTime, ExceptionState& exceptionState)
45 { 45 {
46 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) { 46 if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) {
47 exceptionState.throwDOMException( 47 exceptionState.throwDOMException(
48 NotSupportedError, 48 NotSupportedError,
49 ExceptionMessages::indexOutsideRange( 49 ExceptionMessages::indexOutsideRange(
50 "max delay time", 50 "max delay time",
51 maxDelayTime, 51 maxDelayTime,
52 0.0, 52 0.0,
53 ExceptionMessages::ExclusiveBound, 53 ExceptionMessages::ExclusiveBound,
54 maximumAllowedDelayTime, 54 maximumAllowedDelayTime,
55 ExceptionMessages::ExclusiveBound)); 55 ExceptionMessages::ExclusiveBound));
56 return nullptr; 56 return nullptr;
57 } 57 }
58 return new DelayNode(context, sampleRate, maxDelayTime); 58 return new DelayNode(context, sampleRate, maxDelayTime);
59 } 59 }
60 60
61 AudioParam* DelayNode::delayTime() 61 AudioParam* DelayNode::delayTime()
62 { 62 {
63 return m_delayTime; 63 return m_delayTime;
64 } 64 }
65 65
66 DEFINE_TRACE(DelayNode) 66 DEFINE_TRACE(DelayNode)
67 { 67 {
68 visitor->trace(m_delayTime); 68 visitor->trace(m_delayTime);
69 AudioNode::trace(visitor); 69 AudioNode::trace(visitor);
70 } 70 }
71 71
72 } // namespace blink 72 } // namespace blink
73 73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698