Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h

Issue 2033503004: Avoid slow AudioParam automation path when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // returns the last parameter value calculated for "values" or the defaultVa lue if none were 60 // returns the last parameter value calculated for "values" or the defaultVa lue if none were
61 // calculated. controlRate is the rate (number per second) at which paramet er values will be 61 // calculated. controlRate is the rate (number per second) at which paramet er values will be
62 // calculated. It should equal sampleRate for sample-accurate parameter cha nges, and otherwise 62 // calculated. It should equal sampleRate for sample-accurate parameter cha nges, and otherwise
63 // will usually match the render quantum size such that the parameter value changes once per 63 // will usually match the render quantum size such that the parameter value changes once per
64 // render quantum. 64 // render quantum.
65 float valuesForFrameRange(size_t startFrame, size_t endFrame, float defaultV alue, float* values, unsigned numberOfValues, double sampleRate, double controlR ate, float minValue, float maxValue); 65 float valuesForFrameRange(size_t startFrame, size_t endFrame, float defaultV alue, float* values, unsigned numberOfValues, double sampleRate, double controlR ate, float minValue, float maxValue);
66 66
67 // Returns true if this AudioParam has any events on it. 67 // Returns true if this AudioParam has any events on it.
68 bool hasValues() const; 68 bool hasValues() const;
69 69
70 float smoothedValue() { return m_smoothedValue; }
71 void setSmoothedValue(float v) { m_smoothedValue = v; }
70 private: 72 private:
71 class ParamEvent { 73 class ParamEvent {
72 public: 74 public:
73 enum Type { 75 enum Type {
74 SetValue, 76 SetValue,
75 LinearRampToValue, 77 LinearRampToValue,
76 ExponentialRampToValue, 78 ExponentialRampToValue,
77 SetTarget, 79 SetTarget,
78 SetValueCurve, 80 SetValueCurve,
79 LastType 81 LastType
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 }; 116 };
115 117
116 void insertEvent(const ParamEvent&, ExceptionState&); 118 void insertEvent(const ParamEvent&, ExceptionState&);
117 float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defa ultValue, float* values, unsigned numberOfValues, double sampleRate, double cont rolRate); 119 float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defa ultValue, float* values, unsigned numberOfValues, double sampleRate, double cont rolRate);
118 120
119 // Produce a nice string describing the event in human-readable form. 121 // Produce a nice string describing the event in human-readable form.
120 String eventToString(const ParamEvent&); 122 String eventToString(const ParamEvent&);
121 Vector<ParamEvent> m_events; 123 Vector<ParamEvent> m_events;
122 124
123 mutable Mutex m_eventsLock; 125 mutable Mutex m_eventsLock;
126
127 // Smoothing (de-zippering)
128 float m_smoothedValue;
124 }; 129 };
125 130
126 } // namespace blink 131 } // namespace blink
127 132
128 #endif // AudioParamTimeline_h 133 #endif // AudioParamTimeline_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698