| 13 | { |
| 14 | |
| 15 | class AudioParamTimeline |
| 16 | { |
| 17 | |
| 18 | public: |
| 19 | AudioParamTimeline() {} |
| 20 | |
| 21 | void setValueAtTime(float value, float time); |
| 22 | void linearRampToValueAtTime(float value, float time); |
| 23 | void exponentialRampToValueAtTime(float value, float time); |
| 24 | void setTargetAtTime(float target, float time, float timeConstant); |
| 25 | void setValueCurveAtTime(std::vector<float> & curve, float time, float duration); |
| 26 | void cancelScheduledValues(float startTime); |
| 27 | |
| 28 | // hasValue is set to true if a valid timeline value is returned. |
| 29 | // otherwise defaultValue is returned. |
| 30 | float valueForContextTime(ContextRenderLock &, float defaultValue, bool & hasValue); |
| 31 | |
| 32 | // Given the time range, calculates parameter values into the values buffer |
| 33 | // and returns the last parameter value calculated for "values" or the defaultValue if none were calculated. |
| 34 | // controlRate is the rate (number per second) at which parameter values will be calculated. |
| 35 | // It should equal sampleRate for sample-accurate parameter changes, and otherwise will usually match |
| 36 | // the render quantum size such that the parameter value changes once per render quantum. |
| 37 | float valuesForTimeRange(double startTime, double endTime, float defaultValue, |
| 38 | float * values, size_t numberOfValues, double sampleRate, double controlRate); |
| 39 | |
| 40 | bool hasValues() { return m_events.size() > 0; } |
| 41 | |
| 42 | private: |
| 43 | |
| 44 | // @tofix - move to implementation file to hide from public API |
| 45 | |
| 46 | class ParamEvent |
| 47 | { |
| 48 | |
| 49 | public: |
| 50 | enum Type |
| 51 | { |
| 52 | SetValue, |
| 53 | LinearRampToValue, |
| 54 | ExponentialRampToValue, |
| 55 | SetTarget, |
| 56 | SetValueCurve, |
| 57 | LastType |
| 58 | }; |
| 59 | |
| 60 | ParamEvent(Type type, float value, float time, float timeConstant, float duration, std::vector<float> curve) |
| 61 | : m_type(type) |
| 62 | , m_value(value) |
| 63 | , m_time(time) |
| 64 | , m_timeConstant(timeConstant) |
| 65 | , m_duration(duration) |
| 66 | , m_curve(curve) |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | ParamEvent(const ParamEvent & rhs) |
| 71 | : m_type(rhs.m_type) |
| 72 | , m_value(rhs.m_value) |
nothing calls this directly
no outgoing calls
no test coverage detected