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 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 // PannerNode is an AudioNode with one input and one output. | 39 // PannerNode is an AudioNode with one input and one output. |
40 // It positions a sound in 3D space, with the exact effect dependent on the pann
ing model. | 40 // It positions a sound in 3D space, with the exact effect dependent on the pann
ing model. |
41 // It has a position and an orientation in 3D space which is relative to the pos
ition and orientation of the context's AudioListener. | 41 // It has a position and an orientation in 3D space which is relative to the pos
ition and orientation of the context's AudioListener. |
42 // A distance effect will attenuate the gain as the position moves away from the
listener. | 42 // A distance effect will attenuate the gain as the position moves away from the
listener. |
43 // A cone effect will attenuate the gain as the orientation moves away from the
listener. | 43 // A cone effect will attenuate the gain as the orientation moves away from the
listener. |
44 // All of these effects follow the OpenAL specification very closely. | 44 // All of these effects follow the OpenAL specification very closely. |
45 | 45 |
46 class PannerNode FINAL : public AudioNode { | 46 class PannerNode final : public AudioNode { |
47 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
48 public: | 48 public: |
49 // These enums are used to distinguish what cached values of panner are dirt
y. | 49 // These enums are used to distinguish what cached values of panner are dirt
y. |
50 enum { | 50 enum { |
51 AzimuthElevationDirty = 0x1, | 51 AzimuthElevationDirty = 0x1, |
52 DistanceConeGainDirty = 0x2, | 52 DistanceConeGainDirty = 0x2, |
53 DopplerRateDirty = 0x4, | 53 DopplerRateDirty = 0x4, |
54 }; | 54 }; |
55 | 55 |
56 static PannerNode* create(AudioContext* context, float sampleRate) | 56 static PannerNode* create(AudioContext* context, float sampleRate) |
57 { | 57 { |
58 return adoptRefCountedGarbageCollectedWillBeNoop(new PannerNode(context,
sampleRate)); | 58 return adoptRefCountedGarbageCollectedWillBeNoop(new PannerNode(context,
sampleRate)); |
59 } | 59 } |
60 | 60 |
61 virtual ~PannerNode(); | 61 virtual ~PannerNode(); |
62 | 62 |
63 // AudioNode | 63 // AudioNode |
64 virtual void dispose() OVERRIDE; | 64 virtual void dispose() override; |
65 virtual void process(size_t framesToProcess) OVERRIDE; | 65 virtual void process(size_t framesToProcess) override; |
66 virtual void pullInputs(size_t framesToProcess) OVERRIDE; | 66 virtual void pullInputs(size_t framesToProcess) override; |
67 virtual void initialize() OVERRIDE; | 67 virtual void initialize() override; |
68 virtual void uninitialize() OVERRIDE; | 68 virtual void uninitialize() override; |
69 | 69 |
70 // Panning model | 70 // Panning model |
71 String panningModel() const; | 71 String panningModel() const; |
72 void setPanningModel(const String&); | 72 void setPanningModel(const String&); |
73 | 73 |
74 // Position, orientation and velocity | 74 // Position, orientation and velocity |
75 void setPosition(float x, float y, float z); | 75 void setPosition(float x, float y, float z); |
76 void setOrientation(float x, float y, float z); | 76 void setOrientation(float x, float y, float z); |
77 void setVelocity(float x, float y, float z); | 77 void setVelocity(float x, float y, float z); |
78 | 78 |
(...skipping 18 matching lines...) Expand all Loading... |
97 void setConeOuterAngle(double); | 97 void setConeOuterAngle(double); |
98 | 98 |
99 double coneOuterGain() const { return m_coneEffect.outerGain(); } | 99 double coneOuterGain() const { return m_coneEffect.outerGain(); } |
100 void setConeOuterGain(double); | 100 void setConeOuterGain(double); |
101 | 101 |
102 void markPannerAsDirty(unsigned); | 102 void markPannerAsDirty(unsigned); |
103 | 103 |
104 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. | 104 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. |
105 double dopplerRate(); | 105 double dopplerRate(); |
106 | 106 |
107 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } | 107 virtual double tailTime() const override { return m_panner ? m_panner->tailT
ime() : 0; } |
108 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } | 108 virtual double latencyTime() const override { return m_panner ? m_panner->la
tencyTime() : 0; } |
109 | 109 |
110 virtual void setChannelCount(unsigned long, ExceptionState&) FINAL; | 110 virtual void setChannelCount(unsigned long, ExceptionState&) final; |
111 virtual void setChannelCountMode(const String&, ExceptionState&) FINAL; | 111 virtual void setChannelCountMode(const String&, ExceptionState&) final; |
112 | 112 |
113 virtual void trace(Visitor*) OVERRIDE; | 113 virtual void trace(Visitor*) override; |
114 | 114 |
115 private: | 115 private: |
116 PannerNode(AudioContext*, float sampleRate); | 116 PannerNode(AudioContext*, float sampleRate); |
117 | 117 |
118 // AudioContext's listener | 118 // AudioContext's listener |
119 AudioListener* listener(); | 119 AudioListener* listener(); |
120 | 120 |
121 bool setPanningModel(unsigned); // Returns true on success. | 121 bool setPanningModel(unsigned); // Returns true on success. |
122 bool setDistanceModel(unsigned); // Returns true on success. | 122 bool setDistanceModel(unsigned); // Returns true on success. |
123 | 123 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // AudioContext's connection count | 163 // AudioContext's connection count |
164 unsigned m_connectionCount; | 164 unsigned m_connectionCount; |
165 | 165 |
166 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. | 166 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. |
167 mutable Mutex m_processLock; | 167 mutable Mutex m_processLock; |
168 }; | 168 }; |
169 | 169 |
170 } // namespace blink | 170 } // namespace blink |
171 | 171 |
172 #endif // PannerNode_h | 172 #endif // PannerNode_h |
OLD | NEW |