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

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

Issue 1928163002: Add a name attribute for each AudioParam (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation error 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 22 matching lines...) Expand all
33 namespace blink { 33 namespace blink {
34 34
35 const double AudioParamHandler::DefaultSmoothingConstant = 0.05; 35 const double AudioParamHandler::DefaultSmoothingConstant = 0.05;
36 const double AudioParamHandler::SnapThreshold = 0.001; 36 const double AudioParamHandler::SnapThreshold = 0.001;
37 37
38 AudioDestinationHandler& AudioParamHandler::destinationHandler() const 38 AudioDestinationHandler& AudioParamHandler::destinationHandler() const
39 { 39 {
40 return *m_destinationHandler; 40 return *m_destinationHandler;
41 } 41 }
42 42
43 String AudioParamHandler::getParamName() const
44 {
45 // The returned string should be the name of the node and the name of the Au dioParam for
46 // that node.
47 switch (m_paramType) {
48 case ParamTypeAudioBufferSourcePlaybackRate:
49 return "AudioBufferSource.playbackRate";
50 case ParamTypeAudioBufferSourceDetune:
51 return "AudioBufferSource.detune";
52 case ParamTypeBiquadFilterFrequency:
53 return "BiquadFilter.frequency";
54 case ParamTypeBiquadFilterQ:
55 return "BiquadFilter.Q";
56 case ParamTypeBiquadFilterGain:
57 return "BiquadFilter.gain";
58 case ParamTypeBiquadFilterDetune:
59 return "BiquadFilter.detune";
60 case ParamTypeDelayDelayTime:
61 return "Delay.delayTime";
62 case ParamTypeDynamicsCompressorThreshold:
63 return "DynamicsCompressor.threshold";
64 case ParamTypeDynamicsCompressorKnee:
65 return "DynamicsCompressor.knee";
66 case ParamTypeDynamicsCompressorRatio:
67 return "DynamicsCompressor.ratio";
68 case ParamTypeDynamicsCompressorAttack:
69 return "DynamicsCompressor.attack";
70 case ParamTypeDynamicsCompressorRelease:
71 return "DynamicsCompressor.release";
72 case ParamTypeGainGain:
73 return "Gain.gain";
74 case ParamTypeOscillatorFrequency:
75 return "Oscillator.frequency";
76 case ParamTypeOscillatorDetune:
77 return "Oscillator.detune";
78 case ParamTypeStereoPannerPan:
79 return "StereoPanner.pan";
80 };
81
82 NOTREACHED();
83 return "UnknownNode.unknownAudioParam";
84 }
85
43 float AudioParamHandler::value() 86 float AudioParamHandler::value()
44 { 87 {
45 // Update value for timeline. 88 // Update value for timeline.
46 float v = intrinsicValue(); 89 float v = intrinsicValue();
47 if (deferredTaskHandler().isAudioThread()) { 90 if (deferredTaskHandler().isAudioThread()) {
48 bool hasValue; 91 bool hasValue;
49 float timelineValue = m_timeline.valueForContextTime(destinationHandler( ), v, hasValue); 92 float timelineValue = m_timeline.valueForContextTime(destinationHandler( ), v, hasValue);
50 93
51 if (hasValue) 94 if (hasValue)
52 v = timelineValue; 95 v = timelineValue;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 229
187 if (m_outputs.contains(&output)) { 230 if (m_outputs.contains(&output)) {
188 m_outputs.remove(&output); 231 m_outputs.remove(&output);
189 changedOutputs(); 232 changedOutputs();
190 output.removeParam(*this); 233 output.removeParam(*this);
191 } 234 }
192 } 235 }
193 236
194 // ---------------------------------------------------------------- 237 // ----------------------------------------------------------------
195 238
196 AudioParam::AudioParam(AbstractAudioContext& context, double defaultValue) 239 AudioParam::AudioParam(AbstractAudioContext& context, AudioParamType paramType, double defaultValue)
197 : m_handler(AudioParamHandler::create(context, defaultValue)) 240 : m_handler(AudioParamHandler::create(context, paramType, defaultValue))
198 , m_context(context) 241 , m_context(context)
199 { 242 {
200 } 243 }
201 244
202 AudioParam* AudioParam::create(AbstractAudioContext& context, double defaultValu e) 245 AudioParam* AudioParam::create(AbstractAudioContext& context, AudioParamType par amType, double defaultValue)
203 { 246 {
204 return new AudioParam(context, defaultValue); 247 return new AudioParam(context, paramType, defaultValue);
205 } 248 }
206 249
207 DEFINE_TRACE(AudioParam) 250 DEFINE_TRACE(AudioParam)
208 { 251 {
209 visitor->trace(m_context); 252 visitor->trace(m_context);
210 } 253 }
211 254
212 float AudioParam::value() const 255 float AudioParam::value() const
213 { 256 {
214 return handler().value(); 257 return handler().value();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 299 }
257 300
258 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState& exceptionState) 301 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState& exceptionState)
259 { 302 {
260 handler().timeline().cancelScheduledValues(startTime, exceptionState); 303 handler().timeline().cancelScheduledValues(startTime, exceptionState);
261 return this; 304 return this;
262 } 305 }
263 306
264 } // namespace blink 307 } // namespace blink
265 308
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698