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 13 matching lines...) Expand all Loading... | |
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 AudioListener_h | 29 #ifndef AudioListener_h |
30 #define AudioListener_h | 30 #define AudioListener_h |
31 | 31 |
32 #include "bindings/v8/ScriptWrappable.h" | 32 #include "bindings/v8/ScriptWrappable.h" |
33 #include "platform/geometry/FloatPoint3D.h" | 33 #include "platform/geometry/FloatPoint3D.h" |
34 #include "platform/heap/Handle.h" | |
34 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
35 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 class PannerNode; | 41 class PannerNode; |
41 | 42 |
42 // AudioListener maintains the state of the listener in the audio scene as defin ed in the OpenAL specification. | 43 // AudioListener maintains the state of the listener in the audio scene as defin ed in the OpenAL specification. |
43 | 44 |
44 class AudioListener : public ScriptWrappable, public RefCounted<AudioListener> { | 45 class AudioListener : public RefCountedWillBeGarbageCollectedFinalized<AudioList ener>, public ScriptWrappable { |
45 public: | 46 public: |
46 static PassRefPtr<AudioListener> create() | 47 static PassRefPtrWillBeRawPtr<AudioListener> create() |
47 { | 48 { |
48 return adoptRef(new AudioListener()); | 49 return adoptRefWillBeNoop(new AudioListener()); |
49 } | 50 } |
50 virtual ~AudioListener(); | 51 virtual ~AudioListener(); |
51 | 52 |
52 // Position | 53 // Position |
53 void setPosition(float x, float y, float z) { setPosition(FloatPoint3D(x, y, z)); } | 54 void setPosition(float x, float y, float z) { setPosition(FloatPoint3D(x, y, z)); } |
54 const FloatPoint3D& position() const { return m_position; } | 55 const FloatPoint3D& position() const { return m_position; } |
55 | 56 |
56 // Orientation and Up-vector | 57 // Orientation and Up-vector |
57 void setOrientation(float x, float y, float z, float upX, float upY, float u pZ) | 58 void setOrientation(float x, float y, float z, float upX, float upY, float u pZ) |
58 { | 59 { |
(...skipping 12 matching lines...) Expand all Loading... | |
71 double dopplerFactor() const { return m_dopplerFactor; } | 72 double dopplerFactor() const { return m_dopplerFactor; } |
72 | 73 |
73 // Speed of sound | 74 // Speed of sound |
74 void setSpeedOfSound(double); | 75 void setSpeedOfSound(double); |
75 double speedOfSound() const { return m_speedOfSound; } | 76 double speedOfSound() const { return m_speedOfSound; } |
76 | 77 |
77 Mutex& listenerLock() { return m_listenerLock; } | 78 Mutex& listenerLock() { return m_listenerLock; } |
78 void addPanner(PannerNode*); | 79 void addPanner(PannerNode*); |
79 void removePanner(PannerNode*); | 80 void removePanner(PannerNode*); |
80 | 81 |
82 void trace(Visitor*) { } | |
Ken Russell (switch to Gerrit)
2014/05/07 22:07:20
Is it necessary to do anything with m_panners?
haraken
2014/05/08 00:52:09
Not necessary, since m_panners is not on heap. We
| |
83 | |
81 private: | 84 private: |
82 AudioListener(); | 85 AudioListener(); |
83 | 86 |
84 void setPosition(const FloatPoint3D&); | 87 void setPosition(const FloatPoint3D&); |
85 void setOrientation(const FloatPoint3D&); | 88 void setOrientation(const FloatPoint3D&); |
86 void setUpVector(const FloatPoint3D&); | 89 void setUpVector(const FloatPoint3D&); |
87 void setVelocity(const FloatPoint3D&); | 90 void setVelocity(const FloatPoint3D&); |
88 | 91 |
89 void markPannersAsDirty(unsigned); | 92 void markPannersAsDirty(unsigned); |
90 | 93 |
91 FloatPoint3D m_position; | 94 FloatPoint3D m_position; |
92 FloatPoint3D m_orientation; | 95 FloatPoint3D m_orientation; |
93 FloatPoint3D m_upVector; | 96 FloatPoint3D m_upVector; |
94 FloatPoint3D m_velocity; | 97 FloatPoint3D m_velocity; |
95 double m_dopplerFactor; | 98 double m_dopplerFactor; |
96 double m_speedOfSound; | 99 double m_speedOfSound; |
97 | 100 |
98 // Synchronize a panner's process() with setting of the state of the listene r. | 101 // Synchronize a panner's process() with setting of the state of the listene r. |
99 mutable Mutex m_listenerLock; | 102 mutable Mutex m_listenerLock; |
100 | 103 |
101 // List for pannerNodes in context. | 104 // List for pannerNodes in context. |
102 Vector<PannerNode*> m_panners; | 105 Vector<PannerNode*> m_panners; |
103 }; | 106 }; |
104 | 107 |
105 } // WebCore | 108 } // WebCore |
106 | 109 |
107 #endif // AudioListener_h | 110 #endif // AudioListener_h |
OLD | NEW |