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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 void linearRampToValueAtTime(float value, double time, ExceptionState&); | 48 void linearRampToValueAtTime(float value, double time, ExceptionState&); |
49 void exponentialRampToValueAtTime(float value, double time, ExceptionState&)
; | 49 void exponentialRampToValueAtTime(float value, double time, ExceptionState&)
; |
50 void setTargetAtTime(float target, double time, double timeConstant, Excepti
onState&); | 50 void setTargetAtTime(float target, double time, double timeConstant, Excepti
onState&); |
51 void setValueCurveAtTime(DOMFloat32Array* curve, double time, double duratio
n, ExceptionState&); | 51 void setValueCurveAtTime(DOMFloat32Array* curve, double time, double duratio
n, ExceptionState&); |
52 void cancelScheduledValues(double startTime, ExceptionState&); | 52 void cancelScheduledValues(double startTime, ExceptionState&); |
53 | 53 |
54 // hasValue is set to true if a valid timeline value is returned. | 54 // hasValue is set to true if a valid timeline value is returned. |
55 // otherwise defaultValue is returned. | 55 // otherwise defaultValue is returned. |
56 float valueForContextTime(AbstractAudioContext*, float defaultValue, bool& h
asValue); | 56 float valueForContextTime(AbstractAudioContext*, float defaultValue, bool& h
asValue); |
57 | 57 |
58 // Given the time range, calculates parameter values into the values buffer | 58 // Given the time range in frames, calculates parameter values into the valu
es buffer and |
59 // and returns the last parameter value calculated for "values" or the defau
ltValue if none were calculated. | 59 // returns the last parameter value calculated for "values" or the defaultVa
lue if none were |
60 // controlRate is the rate (number per second) at which parameter values wil
l be calculated. | 60 // calculated. controlRate is the rate (number per second) at which paramet
er values will be |
61 // It should equal sampleRate for sample-accurate parameter changes, and oth
erwise will usually match | 61 // calculated. It should equal sampleRate for sample-accurate parameter cha
nges, and otherwise |
62 // the render quantum size such that the parameter value changes once per re
nder quantum. | 62 // will usually match the render quantum size such that the parameter value
changes once per |
63 float valuesForTimeRange(double startTime, double endTime, float defaultValu
e, float* values, unsigned numberOfValues, double sampleRate, double controlRate
); | 63 // render quantum. |
| 64 float valuesForFrameRange(size_t startFrame, size_t endFrame, float defaultV
alue, float* values, unsigned numberOfValues, double sampleRate, double controlR
ate); |
64 | 65 |
65 bool hasValues() { return m_events.size(); } | 66 bool hasValues() { return m_events.size(); } |
66 | 67 |
67 private: | 68 private: |
68 class ParamEvent { | 69 class ParamEvent { |
69 public: | 70 public: |
70 enum Type { | 71 enum Type { |
71 SetValue, | 72 SetValue, |
72 LinearRampToValue, | 73 LinearRampToValue, |
73 ExponentialRampToValue, | 74 ExponentialRampToValue, |
(...skipping 22 matching lines...) Expand all Loading... |
96 private: | 97 private: |
97 Type m_type; | 98 Type m_type; |
98 float m_value; | 99 float m_value; |
99 double m_time; | 100 double m_time; |
100 double m_timeConstant; | 101 double m_timeConstant; |
101 double m_duration; | 102 double m_duration; |
102 RefPtr<DOMFloat32Array> m_curve; | 103 RefPtr<DOMFloat32Array> m_curve; |
103 }; | 104 }; |
104 | 105 |
105 void insertEvent(const ParamEvent&, ExceptionState&); | 106 void insertEvent(const ParamEvent&, ExceptionState&); |
106 float valuesForTimeRangeImpl(double startTime, double endTime, float default
Value, float* values, unsigned numberOfValues, double sampleRate, double control
Rate); | 107 float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defa
ultValue, float* values, unsigned numberOfValues, double sampleRate, double cont
rolRate); |
107 | 108 |
108 // Produce a nice string describing the event in human-readable form. | 109 // Produce a nice string describing the event in human-readable form. |
109 String eventToString(const ParamEvent&); | 110 String eventToString(const ParamEvent&); |
110 Vector<ParamEvent> m_events; | 111 Vector<ParamEvent> m_events; |
111 | 112 |
112 Mutex m_eventsLock; | 113 Mutex m_eventsLock; |
113 }; | 114 }; |
114 | 115 |
115 } // namespace blink | 116 } // namespace blink |
116 | 117 |
117 #endif // AudioParamTimeline_h | 118 #endif // AudioParamTimeline_h |
OLD | NEW |