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 25 matching lines...) Expand all Loading... |
36 #include "platform/geometry/FloatPoint3D.h" | 36 #include "platform/geometry/FloatPoint3D.h" |
37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
38 #include <memory> | 38 #include <memory> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class BaseAudioContext; | 42 class BaseAudioContext; |
43 class PannerOptions; | 43 class PannerOptions; |
44 | 44 |
45 // PannerNode is an AudioNode with one input and one output. | 45 // PannerNode is an AudioNode with one input and one output. |
46 // It positions a sound in 3D space, with the exact effect dependent on the pann
ing model. | 46 // It positions a sound in 3D space, with the exact effect dependent on the |
47 // It has a position and an orientation in 3D space which is relative to the pos
ition and orientation of the context's AudioListener. | 47 // panning model. It has a position and an orientation in 3D space which is |
48 // A distance effect will attenuate the gain as the position moves away from the
listener. | 48 // relative to the position and orientation of the context's AudioListener. A |
49 // A cone effect will attenuate the gain as the orientation moves away from the
listener. | 49 // distance effect will attenuate the gain as the position moves away from the |
50 // All of these effects follow the OpenAL specification very closely. | 50 // listener. A cone effect will attenuate the gain as the orientation moves |
| 51 // away from the listener. All of these effects follow the OpenAL specification |
| 52 // very closely. |
51 | 53 |
52 class PannerHandler final : public AudioHandler { | 54 class PannerHandler final : public AudioHandler { |
53 public: | 55 public: |
54 // These enums are used to distinguish what cached values of panner are dirty. | 56 // These enums are used to distinguish what cached values of panner are dirty. |
55 enum { | 57 enum { |
56 AzimuthElevationDirty = 0x1, | 58 AzimuthElevationDirty = 0x1, |
57 DistanceConeGainDirty = 0x2, | 59 DistanceConeGainDirty = 0x2, |
58 }; | 60 }; |
59 | 61 |
60 static PassRefPtr<PannerHandler> create(AudioNode&, | 62 static PassRefPtr<PannerHandler> create(AudioNode&, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 RefPtr<AudioParamHandler> m_positionY; | 193 RefPtr<AudioParamHandler> m_positionY; |
192 RefPtr<AudioParamHandler> m_positionZ; | 194 RefPtr<AudioParamHandler> m_positionZ; |
193 | 195 |
194 RefPtr<AudioParamHandler> m_orientationX; | 196 RefPtr<AudioParamHandler> m_orientationX; |
195 RefPtr<AudioParamHandler> m_orientationY; | 197 RefPtr<AudioParamHandler> m_orientationY; |
196 RefPtr<AudioParamHandler> m_orientationZ; | 198 RefPtr<AudioParamHandler> m_orientationZ; |
197 | 199 |
198 FloatPoint3D m_lastPosition; | 200 FloatPoint3D m_lastPosition; |
199 FloatPoint3D m_lastOrientation; | 201 FloatPoint3D m_lastOrientation; |
200 | 202 |
201 // Synchronize process() with setting of the panning model, source's location
information, listener, distance parameters and sound cones. | 203 // Synchronize process() with setting of the panning model, source's location |
| 204 // information, listener, distance parameters and sound cones. |
202 mutable Mutex m_processLock; | 205 mutable Mutex m_processLock; |
203 }; | 206 }; |
204 | 207 |
205 class PannerNode final : public AudioNode { | 208 class PannerNode final : public AudioNode { |
206 DEFINE_WRAPPERTYPEINFO(); | 209 DEFINE_WRAPPERTYPEINFO(); |
207 | 210 |
208 public: | 211 public: |
209 static PannerNode* create(BaseAudioContext&, ExceptionState&); | 212 static PannerNode* create(BaseAudioContext&, ExceptionState&); |
210 static PannerNode* create(BaseAudioContext*, | 213 static PannerNode* create(BaseAudioContext*, |
211 const PannerOptions&, | 214 const PannerOptions&, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 Member<AudioParam> m_positionZ; | 254 Member<AudioParam> m_positionZ; |
252 | 255 |
253 Member<AudioParam> m_orientationX; | 256 Member<AudioParam> m_orientationX; |
254 Member<AudioParam> m_orientationY; | 257 Member<AudioParam> m_orientationY; |
255 Member<AudioParam> m_orientationZ; | 258 Member<AudioParam> m_orientationZ; |
256 }; | 259 }; |
257 | 260 |
258 } // namespace blink | 261 } // namespace blink |
259 | 262 |
260 #endif // PannerNode_h | 263 #endif // PannerNode_h |
OLD | NEW |