OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 #include <sys/types.h> | 36 #include <sys/types.h> |
37 #include "wtf/Float32Array.h" | 37 #include "wtf/Float32Array.h" |
38 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class AudioNodeOutput; | 44 class AudioNodeOutput; |
45 | 45 |
46 class AudioParam FINAL : public RefCounted<AudioParam>, public ScriptWrappable,
public AudioSummingJunction { | 46 class AudioParam FINAL : public RefCountedWillBeGarbageCollectedFinalized<AudioP
aram>, public ScriptWrappable, public AudioSummingJunction { |
47 public: | 47 public: |
48 static const double DefaultSmoothingConstant; | 48 static const double DefaultSmoothingConstant; |
49 static const double SnapThreshold; | 49 static const double SnapThreshold; |
50 | 50 |
51 static PassRefPtr<AudioParam> create(AudioContext* context, const String& na
me, double defaultValue, double minValue, double maxValue, unsigned units = 0) | 51 static PassRefPtrWillBeRawPtr<AudioParam> create(AudioContext* context, cons
t String& name, double defaultValue, double minValue, double maxValue, unsigned
units = 0) |
52 { | 52 { |
53 return adoptRef(new AudioParam(context, name, defaultValue, minValue, ma
xValue, units)); | 53 return adoptRefWillBeNoop(new AudioParam(context, name, defaultValue, mi
nValue, maxValue, units)); |
54 } | 54 } |
55 | 55 |
56 // AudioSummingJunction | 56 // AudioSummingJunction |
57 virtual bool canUpdateState() OVERRIDE { return true; } | 57 virtual bool canUpdateState() OVERRIDE { return true; } |
58 virtual void didUpdate() OVERRIDE { } | 58 virtual void didUpdate() OVERRIDE { } |
59 | 59 |
60 // Intrinsic value. | 60 // Intrinsic value. |
61 float value(); | 61 float value(); |
62 void setValue(float); | 62 void setValue(float); |
63 | 63 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } | 95 bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRe
nderingConnections(); } |
96 | 96 |
97 // Calculates numberOfValues parameter values starting at the context's curr
ent time. | 97 // Calculates numberOfValues parameter values starting at the context's curr
ent time. |
98 // Must be called in the context's render thread. | 98 // Must be called in the context's render thread. |
99 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); | 99 void calculateSampleAccurateValues(float* values, unsigned numberOfValues); |
100 | 100 |
101 // Connect an audio-rate signal to control this parameter. | 101 // Connect an audio-rate signal to control this parameter. |
102 void connect(AudioNodeOutput*); | 102 void connect(AudioNodeOutput*); |
103 void disconnect(AudioNodeOutput*); | 103 void disconnect(AudioNodeOutput*); |
104 | 104 |
| 105 void trace(Visitor*) { } |
| 106 |
105 protected: | 107 protected: |
106 AudioParam(AudioContext* context, const String& name, double defaultValue, d
ouble minValue, double maxValue, unsigned units = 0) | 108 AudioParam(AudioContext* context, const String& name, double defaultValue, d
ouble minValue, double maxValue, unsigned units = 0) |
107 : AudioSummingJunction(context) | 109 : AudioSummingJunction(context) |
108 , m_name(name) | 110 , m_name(name) |
109 , m_value(defaultValue) | 111 , m_value(defaultValue) |
110 , m_defaultValue(defaultValue) | 112 , m_defaultValue(defaultValue) |
111 , m_minValue(minValue) | 113 , m_minValue(minValue) |
112 , m_maxValue(maxValue) | 114 , m_maxValue(maxValue) |
113 , m_units(units) | 115 , m_units(units) |
114 , m_smoothedValue(defaultValue) | 116 , m_smoothedValue(defaultValue) |
(...skipping 15 matching lines...) Expand all Loading... |
130 | 132 |
131 // Smoothing (de-zippering) | 133 // Smoothing (de-zippering) |
132 double m_smoothedValue; | 134 double m_smoothedValue; |
133 | 135 |
134 AudioParamTimeline m_timeline; | 136 AudioParamTimeline m_timeline; |
135 }; | 137 }; |
136 | 138 |
137 } // namespace WebCore | 139 } // namespace WebCore |
138 | 140 |
139 #endif // AudioParam_h | 141 #endif // AudioParam_h |
OLD | NEW |