Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: Source/modules/webaudio/PannerNode.h

Issue 130003002: Handle loops in audio graph better for PannerNodes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/webaudio/panner-loop-expected.txt ('k') | Source/modules/webaudio/PannerNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 #define PannerNode_h 26 #define PannerNode_h
27 27
28 #include "platform/audio/AudioBus.h" 28 #include "platform/audio/AudioBus.h"
29 #include "platform/audio/Cone.h" 29 #include "platform/audio/Cone.h"
30 #include "platform/audio/Distance.h" 30 #include "platform/audio/Distance.h"
31 #include "platform/audio/Panner.h" 31 #include "platform/audio/Panner.h"
32 #include "modules/webaudio/AudioListener.h" 32 #include "modules/webaudio/AudioListener.h"
33 #include "modules/webaudio/AudioNode.h" 33 #include "modules/webaudio/AudioNode.h"
34 #include "modules/webaudio/AudioParam.h" 34 #include "modules/webaudio/AudioParam.h"
35 #include "platform/geometry/FloatPoint3D.h" 35 #include "platform/geometry/FloatPoint3D.h"
36 #include "wtf/HashMap.h"
36 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
37 38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 // PannerNode is an AudioNode with one input and one output. 41 // PannerNode is an AudioNode with one input and one output.
41 // It positions a sound in 3D space, with the exact effect dependent on the pann ing model. 42 // It positions a sound in 3D space, with the exact effect dependent on the pann ing model.
42 // It has a position and an orientation in 3D space which is relative to the pos ition and orientation of the context's AudioListener. 43 // It has a position and an orientation in 3D space which is relative to the pos ition and orientation of the context's AudioListener.
43 // A distance effect will attenuate the gain as the position moves away from the listener. 44 // A distance effect will attenuate the gain as the position moves away from the listener.
44 // A cone effect will attenuate the gain as the orientation moves away from the listener. 45 // A cone effect will attenuate the gain as the orientation moves away from the listener.
45 // All of these effects follow the OpenAL specification very closely. 46 // All of these effects follow the OpenAL specification very closely.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la tencyTime() : 0; } 131 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la tencyTime() : 0; }
131 132
132 private: 133 private:
133 PannerNode(AudioContext*, float sampleRate); 134 PannerNode(AudioContext*, float sampleRate);
134 135
135 // Returns the combined distance and cone gain attenuation. 136 // Returns the combined distance and cone gain attenuation.
136 float distanceConeGain(); 137 float distanceConeGain();
137 138
138 // Notifies any AudioBufferSourceNodes connected to us either directly or in directly about our existence. 139 // Notifies any AudioBufferSourceNodes connected to us either directly or in directly about our existence.
139 // This is in order to handle the pitch change necessary for the doppler shi ft. 140 // This is in order to handle the pitch change necessary for the doppler shi ft.
140 void notifyAudioSourcesConnectedToNode(AudioNode*); 141 void notifyAudioSourcesConnectedToNode(AudioNode*, HashMap<AudioNode*, bool> &visitedNodes);
141 142
142 OwnPtr<Panner> m_panner; 143 OwnPtr<Panner> m_panner;
143 unsigned m_panningModel; 144 unsigned m_panningModel;
144 145
145 FloatPoint3D m_position; 146 FloatPoint3D m_position;
146 FloatPoint3D m_orientation; 147 FloatPoint3D m_orientation;
147 FloatPoint3D m_velocity; 148 FloatPoint3D m_velocity;
148 149
149 // Gain 150 // Gain
150 RefPtr<AudioParam> m_distanceGain; 151 RefPtr<AudioParam> m_distanceGain;
151 RefPtr<AudioParam> m_coneGain; 152 RefPtr<AudioParam> m_coneGain;
152 DistanceEffect m_distanceEffect; 153 DistanceEffect m_distanceEffect;
153 ConeEffect m_coneEffect; 154 ConeEffect m_coneEffect;
154 float m_lastGain; 155 float m_lastGain;
155 156
156 unsigned m_connectionCount; 157 unsigned m_connectionCount;
157 158
158 // Synchronize process() and setPanningModel() which can change the panner. 159 // Synchronize process() and setPanningModel() which can change the panner.
159 mutable Mutex m_pannerLock; 160 mutable Mutex m_pannerLock;
160 }; 161 };
161 162
162 } // namespace WebCore 163 } // namespace WebCore
163 164
164 #endif // PannerNode_h 165 #endif // PannerNode_h
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/panner-loop-expected.txt ('k') | Source/modules/webaudio/PannerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698