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

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

Issue 1803153002: Add min/max values for AudioParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 7 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 18 matching lines...) Expand all
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(AbstractAudioContext& context, float sampleRate, double max DelayTime)
38 : AudioNode(context) 38 : AudioNode(context)
39 , m_delayTime(AudioParam::create(context, ParamTypeDelayDelayTime, 0.0)) 39 , m_delayTime(AudioParam::create(context, ParamTypeDelayDelayTime, 0.0, 0.0, maxDelayTime))
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(AbstractAudioContext& context, float sampleRate, do uble 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(
(...skipping 14 matching lines...) Expand all
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