@@ -5,29 +5,40 @@ define(function (require) {
5
5
var Effect = require ( 'effect' ) ;
6
6
7
7
/**
8
- * Spatializer is a class that can construct both a Spatial Panner
9
- * and a Spatial Listener. The panner is based on the
10
- * Web Audio Spatial Panner Node
11
- * https://www.w3.org/TR/webaudio/#the-spatializernode-interface
8
+ * Panner3D is based on the <a title="Web Audio Panner docs" href=
9
+ * "https://developer.mozilla.org/en-US/docs/Web/API/PannerNode">
10
+ * Web Audio Spatial Panner Node</a>.
12
11
* This panner is a spatial processing node that allows audio to be positioned
13
- * and oriented in 3D space.
12
+ * and oriented in 3D space.
14
13
*
15
- * The Listener modifies the properties of the Audio Context Listener.
16
- * Both objects types use the same methods. The default is a spatial panner.
14
+ * The position is relative to an <a title="Web Audio Listener docs" href=
15
+ * "https://developer.mozilla.org/en-US/docs/Web/API/AudioListener">
16
+ * Audio Context Listener</a>, which can be accessed
17
+ * by <code>p5.soundOut.audiocontext.listener</code>
17
18
*
18
- * <code>p5.Panner3D</code> - Constructs a Spatial Panner<br/>
19
- * <code>p5.Listener3D</code> - Constructs a Spatial Listener<br/>
20
19
*
21
- * @class Spatializer
20
+ * @class p5.Panner3D
22
21
* @constructor
23
- * @return {Object } p5.Panner3D Object
24
- *
25
- * @property {Web Audio Node } spatializer Web Audio Spatial Panning Node
26
- * @property {AudioParam } spatializer.panningModel "equal power" or "HRTF"
27
- * @pproperty {AudioParam} spatializer.distanceModel "linear", "inverse", or "exponential"
28
22
*/
29
23
p5 . Panner3D = function ( ) {
30
24
Effect . call ( this ) ;
25
+
26
+ /**
27
+ * <a title="Web Audio Panner docs" href=
28
+ * "https://developer.mozilla.org/en-US/docs/Web/API/PannerNode">
29
+ * Web Audio Spatial Panner Node</a>
30
+ *
31
+ * Properties include
32
+ * - <a title="w3 spec for Panning Model"
33
+ * href="https://www.w3.org/TR/webaudio/#idl-def-PanningModelType"
34
+ * >panningModel</a>: "equal power" or "HRTF"
35
+ * - <a title="w3 spec for Distance Model"
36
+ * href="https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType"
37
+ * >distanceModel</a>: "linear", "inverse", or "exponential"
38
+ *
39
+ * @property {Web Audio Node } panner
40
+ *
41
+ */
31
42
this . panner = this . ac . createPanner ( ) ;
32
43
this . panner . panningModel = 'HRTF' ;
33
44
this . panner . distanceModel = 'linear' ;
@@ -36,10 +47,12 @@ define(function (require) {
36
47
} ;
37
48
38
49
p5 . Panner3D . prototype = Object . create ( Effect . prototype ) ;
39
-
50
+
40
51
41
52
/**
42
53
* Connect an audio sorce
54
+ *
55
+ * @method process
43
56
* @param {Object } src Input source
44
57
*/
45
58
p5 . Panner3D . prototype . process = function ( src ) {
@@ -57,15 +70,23 @@ define(function (require) {
57
70
this . positionX ( xVal , time ) ;
58
71
this . positionY ( yVal , time ) ;
59
72
this . positionZ ( zVal , time ) ;
60
- return [ this . panner . positionX . value ,
73
+ return [ this . panner . positionX . value ,
61
74
this . panner . positionY . value ,
62
75
this . panner . positionZ . value ] ;
63
76
} ;
64
77
65
78
/**
66
79
* Getter and setter methods for position coordinates
67
80
* @method positionX
81
+ * @return {Number } updated coordinate value
82
+ */
83
+ /**
84
+ * Getter and setter methods for position coordinates
68
85
* @method positionY
86
+ * @return {Number } updated coordinate value
87
+ */
88
+ /**
89
+ * Getter and setter methods for position coordinates
69
90
* @method positionZ
70
91
* @return {Number } updated coordinate value
71
92
*/
@@ -116,17 +137,25 @@ define(function (require) {
116
137
this . orientX ( xVal , time ) ;
117
138
this . orientY ( yVal , time ) ;
118
139
this . orientZ ( zVal , time ) ;
119
- return [ this . panner . orientationX . value ,
140
+ return [ this . panner . orientationX . value ,
120
141
this . panner . orientationY . value ,
121
142
this . panner . orientationZ . value ] ;
122
143
} ;
123
144
124
145
/**
125
146
* Getter and setter methods for orient coordinates
126
- * @method positionX
127
- * @method positionY
128
- * @method positionZ
129
- * @return {Number } [updated coordinate value]
147
+ * @method orientX
148
+ * @return {Number } updated coordinate value
149
+ */
150
+ /**
151
+ * Getter and setter methods for orient coordinates
152
+ * @method orientY
153
+ * @return {Number } updated coordinate value
154
+ */
155
+ /**
156
+ * Getter and setter methods for orient coordinates
157
+ * @method orientZ
158
+ * @return {Number } updated coordinate value
130
159
*/
131
160
p5 . Panner3D . prototype . orientX = function ( xVal , time ) {
132
161
var t = time || 0 ;
@@ -166,7 +195,7 @@ define(function (require) {
166
195
* Set the rolloff factor and max distance
167
196
* @method setFalloff
168
197
* @param {Number } [maxDistance]
169
- * @param {Number } [rolloffFactor]
198
+ * @param {Number } [rolloffFactor]
170
199
*/
171
200
p5 . Panner3D . prototype . setFalloff = function ( maxDistance , rolloffFactor ) {
172
201
this . maxDist ( maxDistance ) ;
@@ -175,8 +204,8 @@ define(function (require) {
175
204
/**
176
205
* Maxium distance between the source and the listener
177
206
* @method maxDist
178
- * @param {Number } maxDistance
179
- * @return {Number } updated value
207
+ * @param {Number } maxDistance
208
+ * @return {Number } updated value
180
209
*/
181
210
p5 . Panner3D . prototype . maxDist = function ( maxDistance ) {
182
211
if ( typeof maxDistance === 'number' ) {
@@ -188,8 +217,8 @@ define(function (require) {
188
217
/**
189
218
* How quickly the volume is reduced as the source moves away from the listener
190
219
* @method rollof
191
- * @param {Number } rolloffFactor
192
- * @return {Number } updated value
220
+ * @param {Number } rolloffFactor
221
+ * @return {Number } updated value
193
222
*/
194
223
p5 . Panner3D . prototype . rolloff = function ( rolloffFactor ) {
195
224
if ( typeof rolloffFactor === 'number' ) {
0 commit comments