| 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 * | 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Value smoothing: | 132 // Value smoothing: |
| 133 | 133 |
| 134 // When a new value is set with setValue(), in our internal use of the param
eter we don't immediately jump to it. | 134 // When a new value is set with setValue(), in our internal use of the param
eter we don't immediately jump to it. |
| 135 // Instead we smoothly approach this value to avoid glitching. | 135 // Instead we smoothly approach this value to avoid glitching. |
| 136 float smoothedValue(); | 136 float smoothedValue(); |
| 137 | 137 |
| 138 // Smoothly exponentially approaches to (de-zippers) the desired value. | 138 // Smoothly exponentially approaches to (de-zippers) the desired value. |
| 139 // Returns true if smoothed value has already snapped exactly to value. | 139 // Returns true if smoothed value has already snapped exactly to value. |
| 140 bool smooth(); | 140 bool smooth(); |
| 141 | 141 |
| 142 void resetSmoothedValue() { m_smoothedValue = intrinsicValue(); } | 142 void resetSmoothedValue() { m_timeline.setSmoothedValue(intrinsicValue()); } |
| 143 | 143 |
| 144 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } | 144 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } |
| 145 | 145 |
| 146 // Calculates numberOfValues parameter values starting at the context's curr
ent time. | 146 // Calculates numberOfValues parameter values starting at the context's curr
ent time. |
| 147 // Must be called in the context's render thread. | 147 // Must be called in the context's render thread. |
| 148 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); | 148 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); |
| 149 | 149 |
| 150 // Connect an audio-rate signal to control this parameter. | 150 // Connect an audio-rate signal to control this parameter. |
| 151 void connect(AudioNodeOutput&); | 151 void connect(AudioNodeOutput&); |
| 152 void disconnect(AudioNodeOutput&); | 152 void disconnect(AudioNodeOutput&); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 174 // Intrinsic value | 174 // Intrinsic value |
| 175 float m_intrinsicValue; | 175 float m_intrinsicValue; |
| 176 void setIntrinsicValue(float newValue); | 176 void setIntrinsicValue(float newValue); |
| 177 | 177 |
| 178 float m_defaultValue; | 178 float m_defaultValue; |
| 179 | 179 |
| 180 // Nominal range for the value | 180 // Nominal range for the value |
| 181 float m_minValue; | 181 float m_minValue; |
| 182 float m_maxValue; | 182 float m_maxValue; |
| 183 | 183 |
| 184 // Smoothing (de-zippering) | |
| 185 float m_smoothedValue; | |
| 186 | |
| 187 AudioParamTimeline m_timeline; | 184 AudioParamTimeline m_timeline; |
| 188 | 185 |
| 189 // The destination node used to get necessary information like the smaple ra
te and context time. | 186 // The destination node used to get necessary information like the smaple ra
te and context time. |
| 190 RefPtr<AudioDestinationHandler> m_destinationHandler; | 187 RefPtr<AudioDestinationHandler> m_destinationHandler; |
| 191 }; | 188 }; |
| 192 | 189 |
| 193 // AudioParam class represents web-exposed AudioParam interface. | 190 // AudioParam class represents web-exposed AudioParam interface. |
| 194 class AudioParam final : public GarbageCollectedFinalized<AudioParam>, public Sc
riptWrappable { | 191 class AudioParam final : public GarbageCollectedFinalized<AudioParam>, public Sc
riptWrappable { |
| 195 DEFINE_WRAPPERTYPEINFO(); | 192 DEFINE_WRAPPERTYPEINFO(); |
| 196 public: | 193 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 226 | 223 |
| 227 void warnIfOutsideRange(const String& paramMethd, float value); | 224 void warnIfOutsideRange(const String& paramMethd, float value); |
| 228 | 225 |
| 229 RefPtr<AudioParamHandler> m_handler; | 226 RefPtr<AudioParamHandler> m_handler; |
| 230 Member<AbstractAudioContext> m_context; | 227 Member<AbstractAudioContext> m_context; |
| 231 }; | 228 }; |
| 232 | 229 |
| 233 } // namespace blink | 230 } // namespace blink |
| 234 | 231 |
| 235 #endif // AudioParam_h | 232 #endif // AudioParam_h |
| OLD | NEW |