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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Orientation and Up-vector | 57 // Orientation and Up-vector |
58 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) |
59 { | 59 { |
60 setOrientation(FloatPoint3D(x, y, z)); | 60 setOrientation(FloatPoint3D(x, y, z)); |
61 setUpVector(FloatPoint3D(upX, upY, upZ)); | 61 setUpVector(FloatPoint3D(upX, upY, upZ)); |
62 } | 62 } |
63 const FloatPoint3D& orientation() const { return m_orientation; } | 63 const FloatPoint3D& orientation() const { return m_orientation; } |
64 const FloatPoint3D& upVector() const { return m_upVector; } | 64 const FloatPoint3D& upVector() const { return m_upVector; } |
65 | 65 |
66 // Velocity | 66 // Velocity |
67 void setVelocity(float x, float y, float z) { setVelocity(FloatPoint3D(x, y,
z)); } | 67 void setVelocity(float x, float y, float z); |
68 const FloatPoint3D& velocity() const { return m_velocity; } | |
69 | 68 |
70 // Doppler factor | 69 // Doppler factor |
71 void setDopplerFactor(double); | 70 void setDopplerFactor(double); |
72 double dopplerFactor() const { return m_dopplerFactor; } | 71 double dopplerFactor() const { return m_dopplerFactor; } |
73 | 72 |
74 // Speed of sound | 73 // Speed of sound |
75 void setSpeedOfSound(double); | 74 void setSpeedOfSound(double); |
76 double speedOfSound() const { return m_speedOfSound; } | 75 double speedOfSound() const { return m_speedOfSound; } |
77 | 76 |
78 Mutex& listenerLock() { return m_listenerLock; } | 77 Mutex& listenerLock() { return m_listenerLock; } |
79 void addPanner(PannerHandler&); | 78 void addPanner(PannerHandler&); |
80 void removePanner(PannerHandler&); | 79 void removePanner(PannerHandler&); |
81 | 80 |
82 // HRTF DB loader | 81 // HRTF DB loader |
83 HRTFDatabaseLoader* hrtfDatabaseLoader() { return m_hrtfDatabaseLoader.get()
; } | 82 HRTFDatabaseLoader* hrtfDatabaseLoader() { return m_hrtfDatabaseLoader.get()
; } |
84 void createAndLoadHRTFDatabaseLoader(float); | 83 void createAndLoadHRTFDatabaseLoader(float); |
85 bool isHRTFDatabaseLoaded(); | 84 bool isHRTFDatabaseLoaded(); |
86 void waitForHRTFDatabaseLoaderThreadCompletion(); | 85 void waitForHRTFDatabaseLoaderThreadCompletion(); |
87 | 86 |
88 DECLARE_TRACE(); | 87 DECLARE_TRACE(); |
89 | 88 |
90 private: | 89 private: |
91 AudioListener(); | 90 AudioListener(); |
92 | 91 |
93 void setPosition(const FloatPoint3D&); | 92 void setPosition(const FloatPoint3D&); |
94 void setOrientation(const FloatPoint3D&); | 93 void setOrientation(const FloatPoint3D&); |
95 void setUpVector(const FloatPoint3D&); | 94 void setUpVector(const FloatPoint3D&); |
96 void setVelocity(const FloatPoint3D&); | |
97 | 95 |
98 void markPannersAsDirty(unsigned); | 96 void markPannersAsDirty(unsigned); |
99 | 97 |
100 FloatPoint3D m_position; | 98 FloatPoint3D m_position; |
101 FloatPoint3D m_orientation; | 99 FloatPoint3D m_orientation; |
102 FloatPoint3D m_upVector; | 100 FloatPoint3D m_upVector; |
103 FloatPoint3D m_velocity; | |
104 double m_dopplerFactor; | 101 double m_dopplerFactor; |
105 double m_speedOfSound; | 102 double m_speedOfSound; |
106 | 103 |
107 // Synchronize a panner's process() with setting of the state of the listene
r. | 104 // Synchronize a panner's process() with setting of the state of the listene
r. |
108 mutable Mutex m_listenerLock; | 105 mutable Mutex m_listenerLock; |
109 // List for pannerNodes in context. This is updated only in the main thread, | 106 // List for pannerNodes in context. This is updated only in the main thread, |
110 // and can be referred in audio thread. | 107 // and can be referred in audio thread. |
111 // These raw pointers are safe because PannerHandler::uninitialize() | 108 // These raw pointers are safe because PannerHandler::uninitialize() |
112 // unregisters it from m_panners. | 109 // unregisters it from m_panners. |
113 HashSet<PannerHandler*> m_panners; | 110 HashSet<PannerHandler*> m_panners; |
114 // HRTF DB loader for panner node. | 111 // HRTF DB loader for panner node. |
115 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | 112 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
116 }; | 113 }; |
117 | 114 |
118 } // namespace blink | 115 } // namespace blink |
119 | 116 |
120 #endif // AudioListener_h | 117 #endif // AudioListener_h |
OLD | NEW |