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

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

Issue 2389253002: reflow comments in modules/{webaudio,vr} (Closed)
Patch Set: . Created 4 years, 2 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 25 matching lines...) Expand all
36 #include "modules/webaudio/BaseAudioContext.h" 36 #include "modules/webaudio/BaseAudioContext.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 #include "wtf/ThreadSafeRefCounted.h" 38 #include "wtf/ThreadSafeRefCounted.h"
39 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
40 #include <sys/types.h> 40 #include <sys/types.h>
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class AudioNodeOutput; 44 class AudioNodeOutput;
45 45
46 // Each AudioParam gets an identifier here. This is mostly for instrospection i f warnings or 46 // Each AudioParam gets an identifier here. This is mostly for instrospection
47 // other messages need to be printed. It's useful to know what the AudioParam re presents. The 47 // if warnings or other messages need to be printed. It's useful to know what
48 // name should include the node type and the name of the AudioParam. 48 // the AudioParam represents. The name should include the node type and the
49 // name of the AudioParam.
49 enum AudioParamType { 50 enum AudioParamType {
50 ParamTypeAudioBufferSourcePlaybackRate, 51 ParamTypeAudioBufferSourcePlaybackRate,
51 ParamTypeAudioBufferSourceDetune, 52 ParamTypeAudioBufferSourceDetune,
52 ParamTypeBiquadFilterFrequency, 53 ParamTypeBiquadFilterFrequency,
53 ParamTypeBiquadFilterQ, 54 ParamTypeBiquadFilterQ,
54 ParamTypeBiquadFilterQLowpass, 55 ParamTypeBiquadFilterQLowpass,
55 ParamTypeBiquadFilterQHighpass, 56 ParamTypeBiquadFilterQHighpass,
56 ParamTypeBiquadFilterGain, 57 ParamTypeBiquadFilterGain,
57 ParamTypeBiquadFilterDetune, 58 ParamTypeBiquadFilterDetune,
58 ParamTypeDelayDelayTime, 59 ParamTypeDelayDelayTime,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 // AudioSummingJunction 116 // AudioSummingJunction
116 void didUpdate() override {} 117 void didUpdate() override {}
117 118
118 AudioParamTimeline& timeline() { return m_timeline; } 119 AudioParamTimeline& timeline() { return m_timeline; }
119 120
120 // Intrinsic value. 121 // Intrinsic value.
121 float value(); 122 float value();
122 void setValue(float); 123 void setValue(float);
123 124
124 // Final value for k-rate parameters, otherwise use calculateSampleAccurateVal ues() for a-rate. 125 // Final value for k-rate parameters, otherwise use
126 // calculateSampleAccurateValues() for a-rate.
125 // Must be called in the audio thread. 127 // Must be called in the audio thread.
126 float finalValue(); 128 float finalValue();
127 129
128 float defaultValue() const { return static_cast<float>(m_defaultValue); } 130 float defaultValue() const { return static_cast<float>(m_defaultValue); }
129 float minValue() const { return m_minValue; } 131 float minValue() const { return m_minValue; }
130 float maxValue() const { return m_maxValue; } 132 float maxValue() const { return m_maxValue; }
131 133
132 // Value smoothing: 134 // Value smoothing:
133 135
134 // When a new value is set with setValue(), in our internal use of the paramet er we don't immediately jump to it. 136 // When a new value is set with setValue(), in our internal use of the
135 // Instead we smoothly approach this value to avoid glitching. 137 // parameter we don't immediately jump to it. Instead we smoothly approach
138 // this value to avoid glitching.
136 float smoothedValue(); 139 float smoothedValue();
137 140
138 // Smoothly exponentially approaches to (de-zippers) the desired value. 141 // Smoothly exponentially approaches to (de-zippers) the desired value.
139 // Returns true if smoothed value has already snapped exactly to value. 142 // Returns true if smoothed value has already snapped exactly to value.
140 bool smooth(); 143 bool smooth();
141 144
142 void resetSmoothedValue() { m_timeline.setSmoothedValue(intrinsicValue()); } 145 void resetSmoothedValue() { m_timeline.setSmoothedValue(intrinsicValue()); }
143 146
144 bool hasSampleAccurateValues() { 147 bool hasSampleAccurateValues() {
145 return m_timeline.hasValues() || numberOfRenderingConnections(); 148 return m_timeline.hasValues() || numberOfRenderingConnections();
146 } 149 }
147 150
148 // Calculates numberOfValues parameter values starting at the context's curren t time. 151 // Calculates numberOfValues parameter values starting at the context's
152 // current time.
149 // Must be called in the context's render thread. 153 // Must be called in the context's render thread.
150 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); 154 void calculateSampleAccurateValues(float* values, unsigned numberOfValues);
151 155
152 // Connect an audio-rate signal to control this parameter. 156 // Connect an audio-rate signal to control this parameter.
153 void connect(AudioNodeOutput&); 157 void connect(AudioNodeOutput&);
154 void disconnect(AudioNodeOutput&); 158 void disconnect(AudioNodeOutput&);
155 159
156 float intrinsicValue() const { return noBarrierLoad(&m_intrinsicValue); } 160 float intrinsicValue() const { return noBarrierLoad(&m_intrinsicValue); }
157 161
158 // Update any histograms with the given value. 162 // Update any histograms with the given value.
159 void updateHistograms(float newValue); 163 void updateHistograms(float newValue);
160 164
161 private: 165 private:
162 AudioParamHandler(BaseAudioContext&, 166 AudioParamHandler(BaseAudioContext&,
163 AudioParamType, 167 AudioParamType,
164 double defaultValue, 168 double defaultValue,
165 float min, 169 float min,
166 float max); 170 float max);
167 171
168 void warnIfOutsideRange(float value, float minValue, float maxValue); 172 void warnIfOutsideRange(float value, float minValue, float maxValue);
169 173
170 // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Aud io specification. 174 // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web
175 // Audio specification.
171 void calculateFinalValues(float* values, 176 void calculateFinalValues(float* values,
172 unsigned numberOfValues, 177 unsigned numberOfValues,
173 bool sampleAccurate); 178 bool sampleAccurate);
174 void calculateTimelineValues(float* values, unsigned numberOfValues); 179 void calculateTimelineValues(float* values, unsigned numberOfValues);
175 180
176 int computeQHistogramValue(float) const; 181 int computeQHistogramValue(float) const;
177 182
178 // The type of AudioParam, indicating what this AudioParam represents and what node it belongs 183 // The type of AudioParam, indicating what this AudioParam represents and what
179 // to. Mostly for informational purposes and doesn't affect implementation. 184 // node it belongs to. Mostly for informational purposes and doesn't affect
185 // implementation.
180 AudioParamType m_paramType; 186 AudioParamType m_paramType;
181 187
182 // Intrinsic value 188 // Intrinsic value
183 float m_intrinsicValue; 189 float m_intrinsicValue;
184 void setIntrinsicValue(float newValue); 190 void setIntrinsicValue(float newValue);
185 191
186 float m_defaultValue; 192 float m_defaultValue;
187 193
188 // Nominal range for the value 194 // Nominal range for the value
189 float m_minValue; 195 float m_minValue;
190 float m_maxValue; 196 float m_maxValue;
191 197
192 AudioParamTimeline m_timeline; 198 AudioParamTimeline m_timeline;
193 199
194 // The destination node used to get necessary information like the smaple rate and context time. 200 // The destination node used to get necessary information like the smaple rate
201 // and context time.
195 RefPtr<AudioDestinationHandler> m_destinationHandler; 202 RefPtr<AudioDestinationHandler> m_destinationHandler;
196 }; 203 };
197 204
198 // AudioParam class represents web-exposed AudioParam interface. 205 // AudioParam class represents web-exposed AudioParam interface.
199 class AudioParam final : public GarbageCollectedFinalized<AudioParam>, 206 class AudioParam final : public GarbageCollectedFinalized<AudioParam>,
200 public ScriptWrappable { 207 public ScriptWrappable {
201 DEFINE_WRAPPERTYPEINFO(); 208 DEFINE_WRAPPERTYPEINFO();
202 209
203 public: 210 public:
204 static AudioParam* create(BaseAudioContext&, 211 static AudioParam* create(BaseAudioContext&,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 260
254 void warnIfOutsideRange(const String& paramMethd, float value); 261 void warnIfOutsideRange(const String& paramMethd, float value);
255 262
256 RefPtr<AudioParamHandler> m_handler; 263 RefPtr<AudioParamHandler> m_handler;
257 Member<BaseAudioContext> m_context; 264 Member<BaseAudioContext> m_context;
258 }; 265 };
259 266
260 } // namespace blink 267 } // namespace blink
261 268
262 #endif // AudioParam_h 269 #endif // AudioParam_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698