| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ExponentialRampToValue, | 76 ExponentialRampToValue, |
| 77 SetTarget, | 77 SetTarget, |
| 78 SetValueCurve, | 78 SetValueCurve, |
| 79 LastType | 79 LastType |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 static ParamEvent createLinearRampEvent(float value, double time, float
initialValue, double callTime); | 82 static ParamEvent createLinearRampEvent(float value, double time, float
initialValue, double callTime); |
| 83 static ParamEvent createExponentialRampEvent(float value, double time, f
loat initialValue, double callTime); | 83 static ParamEvent createExponentialRampEvent(float value, double time, f
loat initialValue, double callTime); |
| 84 static ParamEvent createSetValueEvent(float value, double time); | 84 static ParamEvent createSetValueEvent(float value, double time); |
| 85 static ParamEvent createSetTargetEvent(float value, double time, double
timeConstant); | 85 static ParamEvent createSetTargetEvent(float value, double time, double
timeConstant); |
| 86 static ParamEvent createSetValueCurveEvent(DOMFloat32Array* curve, doubl
e time, double duration); | 86 static ParamEvent createSetValueCurveEvent(const DOMFloat32Array* curve,
double time, double duration); |
| 87 | 87 |
| 88 Type getType() const { return m_type; } | 88 Type getType() const { return m_type; } |
| 89 float value() const { return m_value; } | 89 float value() const { return m_value; } |
| 90 double time() const { return m_time; } | 90 double time() const { return m_time; } |
| 91 double timeConstant() const { return m_timeConstant; } | 91 double timeConstant() const { return m_timeConstant; } |
| 92 double duration() const { return m_duration; } | 92 double duration() const { return m_duration; } |
| 93 DOMFloat32Array* curve() { return m_curve.get(); } | 93 Vector<float>& curve() { return m_curve; } |
| 94 float initialValue() const { return m_initialValue; } | 94 float initialValue() const { return m_initialValue; } |
| 95 double callTime() const { return m_callTime; } | 95 double callTime() const { return m_callTime; } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 ParamEvent(Type type, float value, double time, | 98 ParamEvent(Type type, float value, double time, |
| 99 double timeConstant, double duration, DOMFloat32Array* curve, | 99 double timeConstant, double duration, const DOMFloat32Array* curve, |
| 100 float initialValue = 0, double callTime = 0) | 100 float initialValue = 0, double callTime = 0); |
| 101 : m_type(type) | |
| 102 , m_value(value) | |
| 103 , m_time(time) | |
| 104 , m_timeConstant(timeConstant) | |
| 105 , m_duration(duration) | |
| 106 , m_curve(curve) | |
| 107 , m_initialValue(initialValue) | |
| 108 , m_callTime(callTime) | |
| 109 { | |
| 110 } | |
| 111 | 101 |
| 112 Type m_type; | 102 Type m_type; |
| 113 float m_value; | 103 float m_value; |
| 114 double m_time; | 104 double m_time; |
| 115 // Only used for SetTarget events | 105 // Only used for SetTarget events |
| 116 double m_timeConstant; | 106 double m_timeConstant; |
| 117 // Only used for SetValueCurve events. | 107 // Only used for SetValueCurve events. |
| 118 double m_duration; | 108 double m_duration; |
| 119 CrossThreadPersistent<DOMFloat32Array> m_curve; | 109 Vector<float> m_curve; |
| 120 // Initial value and time to use for linear and exponential ramps that d
on't have a | 110 // Initial value and time to use for linear and exponential ramps that d
on't have a |
| 121 // preceding event. | 111 // preceding event. |
| 122 float m_initialValue; | 112 float m_initialValue; |
| 123 double m_callTime; | 113 double m_callTime; |
| 124 }; | 114 }; |
| 125 | 115 |
| 126 void insertEvent(const ParamEvent&, ExceptionState&); | 116 void insertEvent(const ParamEvent&, ExceptionState&); |
| 127 float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defa
ultValue, float* values, unsigned numberOfValues, double sampleRate, double cont
rolRate); | 117 float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defa
ultValue, float* values, unsigned numberOfValues, double sampleRate, double cont
rolRate); |
| 128 | 118 |
| 129 // Produce a nice string describing the event in human-readable form. | 119 // Produce a nice string describing the event in human-readable form. |
| 130 String eventToString(const ParamEvent&); | 120 String eventToString(const ParamEvent&); |
| 131 Vector<ParamEvent> m_events; | 121 Vector<ParamEvent> m_events; |
| 132 | 122 |
| 133 mutable Mutex m_eventsLock; | 123 mutable Mutex m_eventsLock; |
| 134 }; | 124 }; |
| 135 | 125 |
| 136 } // namespace blink | 126 } // namespace blink |
| 137 | 127 |
| 138 #endif // AudioParamTimeline_h | 128 #endif // AudioParamTimeline_h |
| OLD | NEW |