| 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 20 matching lines...) Expand all Loading... |
| 31 #include "platform/audio/AudioBus.h" | 31 #include "platform/audio/AudioBus.h" |
| 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 AbstractAudioContext; | 41 class BaseAudioContext; |
| 42 | 42 |
| 43 // PannerNode is an AudioNode with one input and one output. | 43 // 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. | 44 // 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. | 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 // A distance effect will attenuate the gain as the position moves away from the
listener. | 46 // 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. | 47 // 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. | 48 // All of these effects follow the OpenAL specification very closely. |
| 49 | 49 |
| 50 class PannerHandler final : public AudioHandler { | 50 class PannerHandler final : public AudioHandler { |
| 51 public: | 51 public: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 PannerHandler( | 116 PannerHandler( |
| 117 AudioNode&, | 117 AudioNode&, |
| 118 float sampleRate, | 118 float sampleRate, |
| 119 AudioParamHandler& positionX, | 119 AudioParamHandler& positionX, |
| 120 AudioParamHandler& positionY, | 120 AudioParamHandler& positionY, |
| 121 AudioParamHandler& positionZ, | 121 AudioParamHandler& positionZ, |
| 122 AudioParamHandler& orientationX, | 122 AudioParamHandler& orientationX, |
| 123 AudioParamHandler& orientationY, | 123 AudioParamHandler& orientationY, |
| 124 AudioParamHandler& orientationZ); | 124 AudioParamHandler& orientationZ); |
| 125 | 125 |
| 126 // AbstractAudioContext's listener | 126 // BaseAudioContext's listener |
| 127 AudioListener* listener(); | 127 AudioListener* listener(); |
| 128 | 128 |
| 129 bool setPanningModel(unsigned); // Returns true on success. | 129 bool setPanningModel(unsigned); // Returns true on success. |
| 130 bool setDistanceModel(unsigned); // Returns true on success. | 130 bool setDistanceModel(unsigned); // Returns true on success. |
| 131 | 131 |
| 132 void calculateAzimuthElevation( | 132 void calculateAzimuthElevation( |
| 133 double* outAzimuth, | 133 double* outAzimuth, |
| 134 double* outElevation, | 134 double* outElevation, |
| 135 const FloatPoint3D& position, | 135 const FloatPoint3D& position, |
| 136 const FloatPoint3D& listenerPosition, | 136 const FloatPoint3D& listenerPosition, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 FloatPoint3D m_lastPosition; | 200 FloatPoint3D m_lastPosition; |
| 201 FloatPoint3D m_lastOrientation; | 201 FloatPoint3D m_lastOrientation; |
| 202 | 202 |
| 203 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. | 203 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. |
| 204 mutable Mutex m_processLock; | 204 mutable Mutex m_processLock; |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 class PannerNode final : public AudioNode { | 207 class PannerNode final : public AudioNode { |
| 208 DEFINE_WRAPPERTYPEINFO(); | 208 DEFINE_WRAPPERTYPEINFO(); |
| 209 public: | 209 public: |
| 210 static PannerNode* create(AbstractAudioContext&, ExceptionState&); | 210 static PannerNode* create(BaseAudioContext&, ExceptionState&); |
| 211 PannerHandler& pannerHandler() const; | 211 PannerHandler& pannerHandler() const; |
| 212 | 212 |
| 213 DECLARE_VIRTUAL_TRACE(); | 213 DECLARE_VIRTUAL_TRACE(); |
| 214 | 214 |
| 215 // Uses a 3D cartesian coordinate system | 215 // Uses a 3D cartesian coordinate system |
| 216 AudioParam* positionX() const { return m_positionX; }; | 216 AudioParam* positionX() const { return m_positionX; }; |
| 217 AudioParam* positionY() const { return m_positionY; }; | 217 AudioParam* positionY() const { return m_positionY; }; |
| 218 AudioParam* positionZ() const { return m_positionZ; }; | 218 AudioParam* positionZ() const { return m_positionZ; }; |
| 219 | 219 |
| 220 AudioParam* orientationX() const { return m_orientationX; }; | 220 AudioParam* orientationX() const { return m_orientationX; }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 235 double rolloffFactor() const; | 235 double rolloffFactor() const; |
| 236 void setRolloffFactor(double); | 236 void setRolloffFactor(double); |
| 237 double coneInnerAngle() const; | 237 double coneInnerAngle() const; |
| 238 void setConeInnerAngle(double); | 238 void setConeInnerAngle(double); |
| 239 double coneOuterAngle() const; | 239 double coneOuterAngle() const; |
| 240 void setConeOuterAngle(double); | 240 void setConeOuterAngle(double); |
| 241 double coneOuterGain() const; | 241 double coneOuterGain() const; |
| 242 void setConeOuterGain(double); | 242 void setConeOuterGain(double); |
| 243 | 243 |
| 244 private: | 244 private: |
| 245 PannerNode(AbstractAudioContext&); | 245 PannerNode(BaseAudioContext&); |
| 246 | 246 |
| 247 Member<AudioParam> m_positionX; | 247 Member<AudioParam> m_positionX; |
| 248 Member<AudioParam> m_positionY; | 248 Member<AudioParam> m_positionY; |
| 249 Member<AudioParam> m_positionZ; | 249 Member<AudioParam> m_positionZ; |
| 250 | 250 |
| 251 Member<AudioParam> m_orientationX; | 251 Member<AudioParam> m_orientationX; |
| 252 Member<AudioParam> m_orientationY; | 252 Member<AudioParam> m_orientationY; |
| 253 Member<AudioParam> m_orientationZ; | 253 Member<AudioParam> m_orientationZ; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 } // namespace blink | 256 } // namespace blink |
| 257 | 257 |
| 258 #endif // PannerNode_h | 258 #endif // PannerNode_h |
| OLD | NEW |