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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Instead we smoothly approach this value to avoid glitching. | 78 // Instead we smoothly approach this value to avoid glitching. |
79 float smoothedValue(); | 79 float smoothedValue(); |
80 | 80 |
81 // Smoothly exponentially approaches to (de-zippers) the desired value. | 81 // Smoothly exponentially approaches to (de-zippers) the desired value. |
82 // Returns true if smoothed value has already snapped exactly to value. | 82 // Returns true if smoothed value has already snapped exactly to value. |
83 bool smooth(); | 83 bool smooth(); |
84 | 84 |
85 void resetSmoothedValue() { m_smoothedValue = m_value; } | 85 void resetSmoothedValue() { m_smoothedValue = m_value; } |
86 void setSmoothingConstant(double k) { m_smoothingConstant = k; } | 86 void setSmoothingConstant(double k) { m_smoothingConstant = k; } |
87 | 87 |
88 // Parameter automation. | 88 // Parameter automation. |
89 void setValueAtTime(float value, double time) { m_timeline.setValueAtTime(va
lue, time); } | 89 void setValueAtTime(float value, double time) { m_timeline.setValueAtTime(va
lue, time); } |
90 void linearRampToValueAtTime(float value, double time) { m_timeline.linearRa
mpToValueAtTime(value, time); } | 90 void linearRampToValueAtTime(float value, double time) { m_timeline.linearRa
mpToValueAtTime(value, time); } |
91 void exponentialRampToValueAtTime(float value, double time) { m_timeline.exp
onentialRampToValueAtTime(value, time); } | 91 void exponentialRampToValueAtTime(float value, double time) { m_timeline.exp
onentialRampToValueAtTime(value, time); } |
92 void setTargetAtTime(float target, double time, double timeConstant) { m_tim
eline.setTargetAtTime(target, time, timeConstant); } | 92 void setTargetAtTime(float target, double time, double timeConstant) { m_tim
eline.setTargetAtTime(target, time, timeConstant); } |
93 void setValueCurveAtTime(Float32Array* curve, double time, double duration)
{ m_timeline.setValueCurveAtTime(curve, time, duration); } | 93 void setValueCurveAtTime(Float32Array* curve, double time, double duration)
{ m_timeline.setValueCurveAtTime(curve, time, duration); } |
94 void cancelScheduledValues(double startTime) { m_timeline.cancelScheduledVal
ues(startTime); } | 94 void cancelScheduledValues(double startTime) { m_timeline.cancelScheduledVal
ues(startTime); } |
95 | 95 |
96 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } | 96 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } |
97 | 97 |
98 // Calculates numberOfValues parameter values starting at the context's curr
ent time. | 98 // Calculates numberOfValues parameter values starting at the context's curr
ent time. |
99 // Must be called in the context's render thread. | 99 // Must be called in the context's render thread. |
100 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); | 100 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); |
101 | 101 |
102 // Connect an audio-rate signal to control this parameter. | 102 // Connect an audio-rate signal to control this parameter. |
103 void connect(AudioNodeOutput*); | 103 void connect(AudioNodeOutput*); |
104 void disconnect(AudioNodeOutput*); | 104 void disconnect(AudioNodeOutput*); |
105 | 105 |
106 protected: | 106 protected: |
107 AudioParam(AudioContext* context, const String& name, double defaultValue, d
ouble minValue, double maxValue, unsigned units = 0) | 107 AudioParam(AudioContext* context, const String& name, double defaultValue, d
ouble minValue, double maxValue, unsigned units = 0) |
(...skipping 18 matching lines...) Expand all Loading... |
126 String m_name; | 126 String m_name; |
127 double m_value; | 127 double m_value; |
128 double m_defaultValue; | 128 double m_defaultValue; |
129 double m_minValue; | 129 double m_minValue; |
130 double m_maxValue; | 130 double m_maxValue; |
131 unsigned m_units; | 131 unsigned m_units; |
132 | 132 |
133 // Smoothing (de-zippering) | 133 // Smoothing (de-zippering) |
134 double m_smoothedValue; | 134 double m_smoothedValue; |
135 double m_smoothingConstant; | 135 double m_smoothingConstant; |
136 | 136 |
137 AudioParamTimeline m_timeline; | 137 AudioParamTimeline m_timeline; |
138 }; | 138 }; |
139 | 139 |
140 } // namespace WebCore | 140 } // namespace WebCore |
141 | 141 |
142 #endif // AudioParam_h | 142 #endif // AudioParam_h |
OLD | NEW |