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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "platform/audio/Cone.h" | 32 #include "platform/audio/Cone.h" |
33 #include "platform/audio/Distance.h" | 33 #include "platform/audio/Distance.h" |
34 #include "platform/audio/Panner.h" | 34 #include "platform/audio/Panner.h" |
35 #include "platform/geometry/FloatPoint3D.h" | 35 #include "platform/geometry/FloatPoint3D.h" |
36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
37 #include <memory> | 37 #include <memory> |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class BaseAudioContext; | 41 class BaseAudioContext; |
| 42 class PannerOptions; |
42 | 43 |
43 // PannerNode is an AudioNode with one input and one output. | 44 // PannerNode is an AudioNode with one input and one output. |
44 // It positions a sound in 3D space, with the exact effect dependent on the pann
ing model. | 45 // It positions a sound in 3D space, with the exact effect dependent on the pann
ing model. |
45 // It has a position and an orientation in 3D space which is relative to the pos
ition and orientation of the context's AudioListener. | 46 // It has a position and an orientation in 3D space which is relative to the pos
ition and orientation of the context's AudioListener. |
46 // A distance effect will attenuate the gain as the position moves away from the
listener. | 47 // A distance effect will attenuate the gain as the position moves away from the
listener. |
47 // A cone effect will attenuate the gain as the orientation moves away from the
listener. | 48 // A cone effect will attenuate the gain as the orientation moves away from the
listener. |
48 // All of these effects follow the OpenAL specification very closely. | 49 // All of these effects follow the OpenAL specification very closely. |
49 | 50 |
50 class PannerHandler final : public AudioHandler { | 51 class PannerHandler final : public AudioHandler { |
51 public: | 52 public: |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 FloatPoint3D m_lastOrientation; | 202 FloatPoint3D m_lastOrientation; |
202 | 203 |
203 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. | 204 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. |
204 mutable Mutex m_processLock; | 205 mutable Mutex m_processLock; |
205 }; | 206 }; |
206 | 207 |
207 class PannerNode final : public AudioNode { | 208 class PannerNode final : public AudioNode { |
208 DEFINE_WRAPPERTYPEINFO(); | 209 DEFINE_WRAPPERTYPEINFO(); |
209 public: | 210 public: |
210 static PannerNode* create(BaseAudioContext&, ExceptionState&); | 211 static PannerNode* create(BaseAudioContext&, ExceptionState&); |
| 212 static PannerNode* create(BaseAudioContext*, const PannerOptions&, Exception
State&); |
211 PannerHandler& pannerHandler() const; | 213 PannerHandler& pannerHandler() const; |
212 | 214 |
213 DECLARE_VIRTUAL_TRACE(); | 215 DECLARE_VIRTUAL_TRACE(); |
214 | 216 |
215 // Uses a 3D cartesian coordinate system | 217 // Uses a 3D cartesian coordinate system |
216 AudioParam* positionX() const { return m_positionX; }; | 218 AudioParam* positionX() const { return m_positionX; }; |
217 AudioParam* positionY() const { return m_positionY; }; | 219 AudioParam* positionY() const { return m_positionY; }; |
218 AudioParam* positionZ() const { return m_positionZ; }; | 220 AudioParam* positionZ() const { return m_positionZ; }; |
219 | 221 |
220 AudioParam* orientationX() const { return m_orientationX; }; | 222 AudioParam* orientationX() const { return m_orientationX; }; |
(...skipping 28 matching lines...) Expand all Loading... |
249 Member<AudioParam> m_positionZ; | 251 Member<AudioParam> m_positionZ; |
250 | 252 |
251 Member<AudioParam> m_orientationX; | 253 Member<AudioParam> m_orientationX; |
252 Member<AudioParam> m_orientationY; | 254 Member<AudioParam> m_orientationY; |
253 Member<AudioParam> m_orientationZ; | 255 Member<AudioParam> m_orientationZ; |
254 }; | 256 }; |
255 | 257 |
256 } // namespace blink | 258 } // namespace blink |
257 | 259 |
258 #endif // PannerNode_h | 260 #endif // PannerNode_h |
OLD | NEW |