Debian Codegraph @

contrib/externs/w3c_audio.js

raw symbols SCIP
1 /*
2 * Copyright 2012 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /**
18 * @fileoverview Definitions for the API related to audio.
19 * Definitions for the Web Audio API.
20 * This file is based on the W3C Working Draft 15 March 2012.
21 * @see http://www.w3.org/TR/webaudio/
22 *
23 * @externs
24 */
25
26 /**
27 * @constructor
28 */
29 var AudioContext = function() {};
30
31 /** @type {AudioDestinationNode} */
32 AudioContext.prototype.destination;
33
34 /** @type {number} */
35 AudioContext.prototype.sampleRate;
36
37 /** @type {number} */
38 AudioContext.prototype.currentTime;
39
40 /** @type {AudioListener} */
41 AudioContext.prototype.listener;
42
43 /**
44 * AudioContext.prototype.createBuffer() has 2 syntax:
45 * * Regular method:
46 * createBuffer = function(numberOfChannels, length, sampleRate) {};
47 *
48 * * ArrayBuffer method:
49 * createBuffer = function(buffer, mixToMono) {};
50 *
51 * @param {number|ArrayBuffer} a
52 * @param {number|boolean} b
53 * @param {number=} sampleRate
54 */
55 AudioContext.prototype.createBuffer = function(a, b, sampleRate) {};
56
57 /**
58 * @param {ArrayBuffer} audioData
59 * @param {Function} successCallback
60 * @param {Function=} errorCallback
61 */
62 AudioContext.prototype.decodeAudioData = function(audioData, successCallback,
63 errorCallback) {};
64
65 /**
66 * @return {AudioBufferSourceNode}
67 */
68 AudioContext.prototype.createBufferSource = function() {};
69
70 /**
71 * @param {number} bufferSize
72 * @param {number} numberOfInputs
73 * @param {number} numberOfOuputs
74 * @return {JavaScriptAudioNode}
75 */
76 AudioContext.prototype.createJavaScriptNode = function(bufferSize,
77 numberOfInputs, numberOfOuputs) {};
78
79 /**
80 * @return {OscillatorNode}
81 */
82 AudioContext.prototype.createOscillator = function() {};
83
84 /**
85 * @return {RealtimeAnalyserNode}
86 */
87 AudioContext.prototype.createAnalyser = function() {};
88
89 /**
90 * @return {AudioGainNode}
91 */
92 AudioContext.prototype.createGainNode = function() {};
93
94 /**
95 * @param {number=} maxDelayTime
96 * @return {DelayNode}
97 */
98 AudioContext.prototype.createDelayNode = function(maxDelayTime) {};
99
100 /**
101 * @return {BiquadFilterNode}
102 */
103 AudioContext.prototype.createBiquadFilter = function() {};
104
105 /**
106 * @return {AudioPannerNode}
107 */
108 AudioContext.prototype.createPanner = function() {};
109
110 /**
111 * @return {ConvolverNode}
112 */
113 AudioContext.prototype.createConvolver = function() {};
114
115 /**
116 * @return {AudioChannelSplitter}
117 */
118 AudioContext.prototype.createChannelSplitter = function() {};
119
120 /**
121 * @return {AudioChannelMerger}
122 */
123 AudioContext.prototype.createChannelMerger = function() {};
124
125 /**
126 * @return {DynamicsCompressorNode}
127 */
128 AudioContext.prototype.createDynamicsCompressor = function() {};
129
130 /**
131 * @param {HTMLMediaElement} mediaElement
132 * @return {MediaElementAudioSourceNode}
133 */
134 AudioContext.prototype.createMediaElementSource = function(mediaElement) {};
135
136 /**
137 * @constructor
138 */
139 var AudioNode = function() {};
140
141 /**
142 * @param {AudioNode} destination
143 * @param {number=} output
144 * @param {number=} input
145 */
146 AudioNode.prototype.connect = function(destination, output, input) {};
147
148 /**
149 * @param {number=} output
150 */
151 AudioNode.prototype.disconnect = function(output) {};
152
153 /** @type {AudioContext} */
154 AudioNode.prototype.context;
155
156 /** @type {number} */
157 AudioNode.prototype.numberOfInputs;
158
159 /** @type {number} */
160 AudioNode.prototype.numberOfOutputs;
161
162 /**
163 * @constructor
164 * @extends {AudioNode}
165 * @private
166 */
167 var AudioSourceNode = function() {};
168
169 /**
170 * @constructor
171 * @extends {AudioNode}
172 * @private
173 */
174 var AudioDestinationNode = function() {};
175
176 /** @type {number} */
177 AudioDestinationNode.prototype.numberOfChannels;
178
179 /**
180 * @constructor
181 * @private
182 */
183 var AudioParam = function() {};
184
185 /** @type {number} */
186 AudioParam.prototype.value;
187
188 /** @type {number} */
189 AudioParam.prototype.maxValue;
190
191 /** @type {number} */
192 AudioParam.prototype.minValue;
193
194 /** @type {number} */
195 AudioParam.prototype.defaultValue;
196
197 /** @type {number} */
198 AudioParam.prototype.units;
199
200 /**
201 * @param {number} value
202 * @param {number} time
203 */
204 AudioParam.prototype.setValueAtTime = function(value, time) {};
205
206 /**
207 * @param {number} value
208 * @param {number} time
209 */
210 AudioParam.prototype.linearRampToValueAtTime = function(value, time) {};
211
212 /**
213 * @param {number} value
214 * @param {number} time
215 */
216 AudioParam.prototype.exponentialRampToValueAtTime = function(value, time) {};
217
218 /**
219 * @param {number} targetValue
220 * @param {number} time
221 * @param {number} timeConstant
222 */
223 AudioParam.prototype.setTargetValueAtTime = function(targetValue, time,
224 timeConstant) {};
225
226 /**
227 * @param {Float32Array} values
228 * @param {number} time
229 * @param {number} duration
230 */
231 AudioParam.prototype.setValueCurveAtTime = function(values, time, duration) {};
232
233 /**
234 * @param {number} startTime
235 */
236 AudioParam.prototype.cancelScheduledValues = function(startTime) {};
237
238 /**
239 * @constructor
240 * @extends {AudioParam}
241 */
242 var AudioGain = function() {};
243
244 /**
245 * @constructor
246 * @extends {AudioNode}
247 */
248 var AudioGainNode = function() {};
249
250 /** @type {AudioGain} */
251 AudioGainNode.prototype.gain;
252
253 /**
254 * @constructor
255 * @extends {AudioNode}
256 */
257 var DelayNode = function() {};
258
259 /** @type {AudioParam} */
260 DelayNode.prototype.delayTime;
261
262 /**
263 * @constructor
264 */
265 var AudioBuffer = function() {};
266
267 /** @type {AudioGain} */
268 AudioBuffer.prototype.gain;
269
270 /** @type {number} */
271 AudioBuffer.prototype.sampleRate;
272
273 /** @type {number} */
274 AudioBuffer.prototype.length;
275
276 /** @type {number} */
277 AudioBuffer.prototype.duration;
278
279 /** @type {number} */
280 AudioBuffer.prototype.numberOfChannels;
281
282 /**
283 * @param {number} channel
284 * @return {Float32Array}
285 */
286 AudioBuffer.prototype.getChannelData = function(channel) {};
287
288 /**
289 * @constructor
290 * @extends {AudioSourceNode}
291 */
292 var AudioBufferSourceNode = function() {};
293
294 /** @type {AudioBuffer} */
295 AudioBufferSourceNode.prototype.buffer;
296
297 /** @type {number} */
298 AudioBufferSourceNode.prototype.gain;
299
300 /** @type {AudioParam} */
301 AudioBufferSourceNode.prototype.playbackRate;
302
303 /** @type {boolean} */
304 AudioBufferSourceNode.prototype.loop;
305
306 /**
307 * @param {number} when
308 */
309 AudioBufferSourceNode.prototype.noteOn = function(when) {};
310
311 /**
312 * @param {number} when
313 * @param {number} grainOffset
314 * @param {number} grainDuration
315 */
316 AudioBufferSourceNode.prototype.noteGrainOn = function(when, grainOffset,
317 grainDuration) {};
318
319 /**
320 * @param {number} when
321 */
322 AudioBufferSourceNode.prototype.noteOff = function(when) {};
323
324 /**
325 * @constructor
326 * @extends {AudioSourceNode}
327 */
328 var MediaElementAudioSourceNode = function() {};
329
330 /**
331 * @constructor
332 * @extends {AudioNode}
333 */
334 var JavaScriptAudioNode = function() {};
335
336 /** @type {EventListener} */
337 JavaScriptAudioNode.prototype.onaudioprocess;
338
339 /**
340 * @const
341 * @type {number}
342 */
343 JavaScriptAudioNode.prototype.bufferSize;
344
345 /**
346 * @constructor
347 * @extends {Event}
348 * @private
349 */
350 var AudioProcessingEvent = function() {};
351
352 /** @type {JavaScriptAudioNode} */
353 AudioProcessingEvent.prototype.node;
354
355 /** @type {number} */
356 AudioProcessingEvent.prototype.playbackTime;
357
358 /** @type {number} */
359 AudioProcessingEvent.prototype.inputBuffer;
360
361 /** @type {AudioBuffer} */
362 AudioProcessingEvent.prototype.outputBuffer;
363
364 /**
365 * @constructor
366 * @extends {AudioNode}
367 */
368 var AudioPannerNode = function() {};
369
370 /**
371 * @const
372 * @type {number}
373 */
374 AudioPannerNode.prototype.EQUALPOWER = 0;
375
376 /**
377 * @const
378 * @type {number}
379 */
380 AudioPannerNode.prototype.HRTF = 1;
381
382 /**
383 * @const
384 * @type {number}
385 */
386 AudioPannerNode.prototype.SOUNDFIELD = 2;
387
388 /**
389 * @const
390 * @type {number}
391 */
392 AudioPannerNode.prototype.LINEAR_DISTANCE = 0;
393
394 /**
395 * @const
396 * @type {number}
397 */
398 AudioPannerNode.prototype.INVERSE_DISTANCE = 1;
399
400 /**
401 * @const
402 * @type {number}
403 */
404 AudioPannerNode.prototype.EXPONENTIAL_DISTANCE = 2;
405
406 /** @type {number} */
407 AudioPannerNode.prototype.panningModel;
408
409 /**
410 * @param {number} x
411 * @param {number} y
412 * @param {number} z
413 */
414 AudioPannerNode.prototype.setPosition = function(x, y, z) {};
415
416 /**
417 * @param {number} x
418 * @param {number} y
419 * @param {number} z
420 */
421 AudioPannerNode.prototype.setOrientation = function(x, y, z) {};
422
423 /**
424 * @param {number} x
425 * @param {number} y
426 * @param {number} z
427 */
428 AudioPannerNode.prototype.setVelocity = function(x, y, z) {};
429
430 /** @type {number} */
431 AudioPannerNode.prototype.distanceModel;
432
433 /** @type {number} */
434 AudioPannerNode.prototype.refDistance;
435
436 /** @type {number} */
437 AudioPannerNode.prototype.maxDistance;
438
439 /** @type {number} */
440 AudioPannerNode.prototype.rolloffFactor;
441
442 /** @type {number} */
443 AudioPannerNode.prototype.coneInnerAngle;
444
445 /** @type {number} */
446 AudioPannerNode.prototype.coneOuterAngle;
447
448 /** @type {number} */
449 AudioPannerNode.prototype.coneOuterGain;
450
451 /** @type {AudioGain} */
452 AudioPannerNode.prototype.coneGain;
453
454 /** @type {AudioGain} */
455 AudioPannerNode.prototype.distanceGain;
456
457 /**
458 * @constructor
459 */
460 var AudioListener = function() {};
461
462 /** @type {number} */
463 AudioListener.prototype.gain;
464
465 /** @type {number} */
466 AudioListener.prototype.dopplerFactor;
467
468 /** @type {number} */
469 AudioListener.prototype.speedOfSound;
470
471 /**
472 * @param {number} x
473 * @param {number} y
474 * @param {number} z
475 */
476 AudioListener.prototype.setPosition = function(x, y, z) {};
477
478 /**
479 * @param {number} x
480 * @param {number} y
481 * @param {number} z
482 * @param {number} xUp
483 * @param {number} yUp
484 * @param {number} zUp
485 */
486 AudioListener.prototype.setOrientation = function(x, y, z, xUp, yUp, zUp) {};
487
488 /**
489 * @param {number} x
490 * @param {number} y
491 * @param {number} z
492 */
493 AudioListener.prototype.setVelocity = function(x, y, z) {};
494
495 /**
496 * @constructor
497 * @extends {AudioNode}
498 */
499 var ConvolverNode = function() {};
500
501 /** @type {AudioBuffer} */
502 ConvolverNode.prototype.buffer;
503
504 /** @type {boolean} */
505 ConvolverNode.prototype.normalize;
506
507 /**
508 * @constructor
509 * @extends {AudioNode}
510 */
511 var RealtimeAnalyserNode = function() {};
512
513 /**
514 * @param {Float32Array} array
515 */
516 RealtimeAnalyserNode.prototype.getFloatFrequencyData = function(array) {};
517
518 /**
519 * @param {Uint8Array} array
520 */
521 RealtimeAnalyserNode.prototype.getByteFrequencyData = function(array) {};
522
523 /**
524 * @param {Uint8Array} array
525 */
526 RealtimeAnalyserNode.prototype.getByteTimeDomainData = function(array) {};
527
528 /** @type {number} */
529 RealtimeAnalyserNode.prototype.fftSize;
530
531 /** @type {number} */
532 RealtimeAnalyserNode.prototype.frequencyBinCount;
533
534 /** @type {number} */
535 RealtimeAnalyserNode.prototype.minDecibels;
536
537 /** @type {number} */
538 RealtimeAnalyserNode.prototype.maxDecibels;
539
540 /** @type {number} */
541 RealtimeAnalyserNode.prototype.smoothingTimeConstant;
542
543 /**
544 * @constructor
545 * @extends {AudioNode}
546 */
547 var AudioChannelSplitter = function() {};
548
549 /**
550 * @constructor
551 * @extends {AudioNode}
552 */
553 var AudioChannelMerger = function() {};
554
555 /**
556 * @constructor
557 * @extends {AudioNode}
558 */
559 var DynamicsCompressorNode = function() {};
560
561 /** @type {AudioParam} */
562 DynamicsCompressorNode.prototype.threshold;
563
564 /** @type {AudioParam} */
565 DynamicsCompressorNode.prototype.knee;
566
567 /** @type {AudioParam} */
568 DynamicsCompressorNode.prototype.ratio;
569
570 /** @type {AudioParam} */
571 DynamicsCompressorNode.prototype.reduction;
572
573 /** @type {AudioParam} */
574 DynamicsCompressorNode.prototype.attack;
575
576 /** @type {AudioParam} */
577 DynamicsCompressorNode.prototype.release;
578
579 /**
580 * @constructor
581 * @extends {AudioNode}
582 */
583 var BiquadFilterNode = function() {};
584
585 /**
586 * @const
587 * @type {number}
588 */
589 BiquadFilterNode.prototype.LOWPASS = 0;
590
591 /**
592 * @const
593 * @type {number}
594 */
595 BiquadFilterNode.prototype.HIGHPASS = 1;
596
597 /**
598 * @const
599 * @type {number}
600 */
601 BiquadFilterNode.prototype.BANDPASS = 2;
602
603 /**
604 * @const
605 * @type {number}
606 */
607 BiquadFilterNode.prototype.LOWSHELF = 3;
608
609 /**
610 * @const
611 * @type {number}
612 */
613 BiquadFilterNode.prototype.HIGHSHELF = 4;
614
615 /**
616 * @const
617 * @type {number}
618 */
619 BiquadFilterNode.prototype.PEAKING = 5;
620
621 /**
622 * @const
623 * @type {number}
624 */
625 BiquadFilterNode.prototype.NOTCH = 6;
626
627 /**
628 * @const
629 * @type {number}
630 */
631 BiquadFilterNode.prototype.ALLPASS = 7;
632
633 /** @type {number} */
634 BiquadFilterNode.prototype.type;
635
636 /** @type {AudioParam} */
637 BiquadFilterNode.prototype.frequency;
638
639 /** @type {AudioParam} */
640 BiquadFilterNode.prototype.Q;
641
642 /** @type {AudioParam} */
643 BiquadFilterNode.prototype.gain;
644
645 /**
646 * @param {Float32Array} frequencyHz
647 * @param {Float32Array} magResponse
648 * @param {Float32Array} phaseResponse
649 */
650 BiquadFilterNode.prototype.getFrequencyResponse = function(frequencyHz,
651 magResponse, phaseResponse) {};
652
653 /**
654 * @constructor
655 */
656 var WaveTable = function() {};
657
658 /**
659 * @constructor
660 * @extends {AudioNode}
661 */
662 var OscillatorNode = function() {};
663
664 /** @type {string} */
665 OscillatorNode.prototype.type;
666
667 /** @type {number} */
668 OscillatorNode.prototype.playbackState;
669
670 /** @type {AudioParam} */
671 OscillatorNode.prototype.frequency;
672
673 /** @type {AudioParam} */
674 OscillatorNode.prototype.detune;
675
676 /** @type {function(number)} */
677 OscillatorNode.prototype.start;
678
679 /** @type {function(number)} */
680 OscillatorNode.prototype.stop;
681
682 /** @type {function(WaveTable)} */
683 OscillatorNode.prototype.setWaveTable;
684
685 /**
686 * @constructor
687 * @extends {AudioNode}
688 */
689 var WaveShaperNode = function() {};
690
691 /** @type {Float32Array} */
692 WaveShaperNode.prototype.curve;
693
694 /**
695 * Definitions for the Web Audio API with webkit prefix.
696 */
697
698 /**
699 * @constructor
700 * @extends {AudioContext}
701 */
702 var webkitAudioContext = function() {};
703
704 /**
705 * @constructor
706 * @extends {AudioPannerNode}
707 */
708 var webkitAudioPannerNode = function() {};
709
710 /**
711 * Definitions for the Audio API as implemented in Firefox.
712 * Please note that this document describes a non-standard experimental API.
713 * This API is considered deprecated.
714 * @see https://developer.mozilla.org/en/DOM/HTMLAudioElement
715 */
716
717 /**
718 * @param {string=} src
719 * @constructor
720 */
721 var Audio = function(src) {};
722
723 /**
724 * @param {number} channels
725 * @param {number} rate
726 */
727 Audio.prototype.mozSetup = function(channels, rate) {};
728
729 /**
730 * @param {Array|Float32Array} buffer
731 */
732 Audio.prototype.mozWriteAudio = function(buffer) {};
733
734 /**
735 * @return {number}
736 */
737 Audio.prototype.mozCurrentSampleOffset = function() {};
738