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

Side by Side Diff: Source/modules/webaudio/AudioParam.h

Issue 15232002: Make remaining modules/ objects ScriptWrappable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/quota/StorageQuota.cpp ('k') | Source/modules/webmidi/MIDIInput.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef AudioParam_h 29 #ifndef AudioParam_h
30 #define AudioParam_h 30 #define AudioParam_h
31 31
32 #include "bindings/v8/ScriptWrappable.h"
32 #include "modules/webaudio/AudioContext.h" 33 #include "modules/webaudio/AudioContext.h"
33 #include "modules/webaudio/AudioParamTimeline.h" 34 #include "modules/webaudio/AudioParamTimeline.h"
34 #include "modules/webaudio/AudioSummingJunction.h" 35 #include "modules/webaudio/AudioSummingJunction.h"
35 #include <sys/types.h> 36 #include <sys/types.h>
36 #include "wtf/Float32Array.h" 37 #include "wtf/Float32Array.h"
37 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
39 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
40 41
41 namespace WebCore { 42 namespace WebCore {
42 43
43 class AudioNodeOutput; 44 class AudioNodeOutput;
44 45
45 class AudioParam : public AudioSummingJunction, public RefCounted<AudioParam> { 46 class AudioParam : public RefCounted<AudioParam>, public ScriptWrappable, public AudioSummingJunction {
46 public: 47 public:
47 static const double DefaultSmoothingConstant; 48 static const double DefaultSmoothingConstant;
48 static const double SnapThreshold; 49 static const double SnapThreshold;
49 50
50 static PassRefPtr<AudioParam> create(AudioContext* context, const String& na me, double defaultValue, double minValue, double maxValue, unsigned units = 0) 51 static PassRefPtr<AudioParam> create(AudioContext* context, const String& na me, double defaultValue, double minValue, double maxValue, unsigned units = 0)
51 { 52 {
52 return adoptRef(new AudioParam(context, name, defaultValue, minValue, ma xValue, units)); 53 return adoptRef(new AudioParam(context, name, defaultValue, minValue, ma xValue, units));
53 } 54 }
54 55
55 // AudioSummingJunction 56 // AudioSummingJunction
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 : AudioSummingJunction(context) 108 : AudioSummingJunction(context)
108 , m_name(name) 109 , m_name(name)
109 , m_value(defaultValue) 110 , m_value(defaultValue)
110 , m_defaultValue(defaultValue) 111 , m_defaultValue(defaultValue)
111 , m_minValue(minValue) 112 , m_minValue(minValue)
112 , m_maxValue(maxValue) 113 , m_maxValue(maxValue)
113 , m_units(units) 114 , m_units(units)
114 , m_smoothedValue(defaultValue) 115 , m_smoothedValue(defaultValue)
115 , m_smoothingConstant(DefaultSmoothingConstant) 116 , m_smoothingConstant(DefaultSmoothingConstant)
116 { 117 {
118 ScriptWrappable::init(this);
117 } 119 }
118 120
119 private: 121 private:
120 // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web A udio specification. 122 // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web A udio specification.
121 void calculateFinalValues(float* values, unsigned numberOfValues, bool sampl eAccurate); 123 void calculateFinalValues(float* values, unsigned numberOfValues, bool sampl eAccurate);
122 void calculateTimelineValues(float* values, unsigned numberOfValues); 124 void calculateTimelineValues(float* values, unsigned numberOfValues);
123 125
124 String m_name; 126 String m_name;
125 double m_value; 127 double m_value;
126 double m_defaultValue; 128 double m_defaultValue;
127 double m_minValue; 129 double m_minValue;
128 double m_maxValue; 130 double m_maxValue;
129 unsigned m_units; 131 unsigned m_units;
130 132
131 // Smoothing (de-zippering) 133 // Smoothing (de-zippering)
132 double m_smoothedValue; 134 double m_smoothedValue;
133 double m_smoothingConstant; 135 double m_smoothingConstant;
134 136
135 AudioParamTimeline m_timeline; 137 AudioParamTimeline m_timeline;
136 }; 138 };
137 139
138 } // namespace WebCore 140 } // namespace WebCore
139 141
140 #endif // AudioParam_h 142 #endif // AudioParam_h
OLDNEW
« no previous file with comments | « Source/modules/quota/StorageQuota.cpp ('k') | Source/modules/webmidi/MIDIInput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698