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 22 matching lines...) Expand all Loading... |
33 #include "modules/webaudio/AudioParam.h" | 33 #include "modules/webaudio/AudioParam.h" |
34 #include "platform/geometry/FloatPoint3D.h" | 34 #include "platform/geometry/FloatPoint3D.h" |
35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class HRTFDatabaseLoader; | 40 class HRTFDatabaseLoader; |
41 class PannerHandler; | 41 class PannerHandler; |
42 | 42 |
43 // 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 |
| 44 // defined in the OpenAL specification. |
44 | 45 |
45 class AudioListener : public GarbageCollectedFinalized<AudioListener>, | 46 class AudioListener : public GarbageCollectedFinalized<AudioListener>, |
46 public ScriptWrappable { | 47 public ScriptWrappable { |
47 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
48 | 49 |
49 public: | 50 public: |
50 static AudioListener* create(BaseAudioContext& context) { | 51 static AudioListener* create(BaseAudioContext& context) { |
51 return new AudioListener(context); | 52 return new AudioListener(context); |
52 } | 53 } |
53 virtual ~AudioListener(); | 54 virtual ~AudioListener(); |
54 | 55 |
55 // Location of the listener | 56 // Location of the listener |
56 AudioParam* positionX() const { return m_positionX; }; | 57 AudioParam* positionX() const { return m_positionX; }; |
57 AudioParam* positionY() const { return m_positionY; }; | 58 AudioParam* positionY() const { return m_positionY; }; |
58 AudioParam* positionZ() const { return m_positionZ; }; | 59 AudioParam* positionZ() const { return m_positionZ; }; |
59 | 60 |
60 // Forward direction vector of the listener | 61 // Forward direction vector of the listener |
61 AudioParam* forwardX() const { return m_forwardX; }; | 62 AudioParam* forwardX() const { return m_forwardX; }; |
62 AudioParam* forwardY() const { return m_forwardY; }; | 63 AudioParam* forwardY() const { return m_forwardY; }; |
63 AudioParam* forwardZ() const { return m_forwardZ; }; | 64 AudioParam* forwardZ() const { return m_forwardZ; }; |
64 | 65 |
65 // Up direction vector for the listener | 66 // Up direction vector for the listener |
66 AudioParam* upX() const { return m_upX; }; | 67 AudioParam* upX() const { return m_upX; }; |
67 AudioParam* upY() const { return m_upY; }; | 68 AudioParam* upY() const { return m_upY; }; |
68 AudioParam* upZ() const { return m_upZ; }; | 69 AudioParam* upZ() const { return m_upZ; }; |
69 | 70 |
70 // True if any of AudioParams have automations. | 71 // True if any of AudioParams have automations. |
71 bool hasSampleAccurateValues() const; | 72 bool hasSampleAccurateValues() const; |
72 | 73 |
73 // Update the internal state of the listener, including updating the dirty sta
te of all | 74 // Update the internal state of the listener, including updating the dirty |
74 // PannerNodes if necessary. | 75 // state of all PannerNodes if necessary. |
75 void updateState(); | 76 void updateState(); |
76 | 77 |
77 bool isListenerDirty() const { return m_isListenerDirty; } | 78 bool isListenerDirty() const { return m_isListenerDirty; } |
78 | 79 |
79 const FloatPoint3D position() const { | 80 const FloatPoint3D position() const { |
80 return FloatPoint3D(m_positionX->value(), m_positionY->value(), | 81 return FloatPoint3D(m_positionX->value(), m_positionY->value(), |
81 m_positionZ->value()); | 82 m_positionZ->value()); |
82 } | 83 } |
83 const FloatPoint3D orientation() const { | 84 const FloatPoint3D orientation() const { |
84 return FloatPoint3D(m_forwardX->value(), m_forwardY->value(), | 85 return FloatPoint3D(m_forwardX->value(), m_forwardY->value(), |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // These raw pointers are safe because PannerHandler::uninitialize() | 203 // These raw pointers are safe because PannerHandler::uninitialize() |
203 // unregisters it from m_panners. | 204 // unregisters it from m_panners. |
204 HashSet<PannerHandler*> m_panners; | 205 HashSet<PannerHandler*> m_panners; |
205 // HRTF DB loader for panner node. | 206 // HRTF DB loader for panner node. |
206 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | 207 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
207 }; | 208 }; |
208 | 209 |
209 } // namespace blink | 210 } // namespace blink |
210 | 211 |
211 #endif // AudioListener_h | 212 #endif // AudioListener_h |
OLD | NEW |