BaseAudioContext.hx 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\BaseAudioContext.webidl. Do not edit!
  23. package js.html.audio;
  24. import js.lib.Promise;
  25. /**
  26. The `BaseAudioContext` interface acts as a base definition for online and offline audio-processing graphs, as represented by `AudioContext` and `OfflineAudioContext` respectively.
  27. Documentation [BaseAudioContext](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  28. @see <https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext>
  29. **/
  30. @:native("BaseAudioContext")
  31. extern class BaseAudioContext extends js.html.EventTarget {
  32. /**
  33. Returns an `AudioDestinationNode` representing the final destination of all audio in the context. It can be thought of as the audio-rendering device.
  34. **/
  35. var destination(default,null) : AudioDestinationNode;
  36. /**
  37. Returns a float representing the sample rate (in samples per second) used by all nodes in this context. The sample-rate of an `AudioContext` cannot be changed.
  38. **/
  39. var sampleRate(default,null) : Float;
  40. /**
  41. Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at `0`.
  42. **/
  43. var currentTime(default,null) : Float;
  44. /**
  45. Returns the `AudioListener` object, used for 3D spatialization.
  46. **/
  47. var listener(default,null) : AudioListener;
  48. /**
  49. Returns the current state of the `AudioContext`.
  50. **/
  51. var state(default,null) : AudioContextState;
  52. /**
  53. An event handler that runs when an event of type `statechange` has fired. This occurs when the `AudioContext`'s state changes, due to the calling of one of the state change methods (`AudioContext.suspend`, `AudioContext.resume`, or `AudioContext.close`).
  54. **/
  55. var onstatechange : haxe.Constraints.Function;
  56. /**
  57. Resumes the progression of time in an audio context that has previously been suspended/paused.
  58. @throws DOMError
  59. **/
  60. function resume() : Promise<Void>;
  61. /**
  62. Creates a new, empty `AudioBuffer` object, which can then be populated by data and played via an `AudioBufferSourceNode`.
  63. @throws DOMError
  64. **/
  65. function createBuffer( numberOfChannels : Int, length : Int, sampleRate : Float ) : AudioBuffer;
  66. /**
  67. Asynchronously decodes audio file data contained in an `ArrayBuffer`. In this case, the ArrayBuffer is usually loaded from an `XMLHttpRequest`'s `response` attribute after setting the `responseType` to `arraybuffer`. This method only works on complete files, not fragments of audio files.
  68. @throws DOMError
  69. **/
  70. @:overload( function( audioData : js.lib.ArrayBuffer, ?successCallback : AudioBuffer -> Void, ?errorCallback : Void -> Void ) : Promise<AudioBuffer> {} )
  71. function decodeAudioData( audioData : js.lib.ArrayBuffer, ?successCallback : AudioBuffer -> Void, ?errorCallback : js.html.DOMException -> Void ) : Promise<AudioBuffer>;
  72. /**
  73. Creates an `AudioBufferSourceNode`, which can be used to play and manipulate audio data contained within an `AudioBuffer` object. `AudioBuffer`s are created using `AudioContext.createBuffer` or returned by `AudioContext.decodeAudioData` when it successfully decodes an audio track.
  74. @throws DOMError
  75. **/
  76. function createBufferSource() : AudioBufferSourceNode;
  77. /**
  78. Creates a `ConstantSourceNode` object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the same value.
  79. @throws DOMError
  80. **/
  81. function createConstantSource() : ConstantSourceNode;
  82. /**
  83. Creates a `ScriptProcessorNode`, which can be used for direct audio processing via JavaScript.
  84. @throws DOMError
  85. **/
  86. function createScriptProcessor( bufferSize : Int = 0, numberOfInputChannels : Int = 2, numberOfOutputChannels : Int = 2 ) : ScriptProcessorNode;
  87. /**
  88. Creates an `AnalyserNode`, which can be used to expose audio time and frequency data and for example to create data visualisations.
  89. @throws DOMError
  90. **/
  91. function createAnalyser() : AnalyserNode;
  92. /**
  93. Creates a `GainNode`, which can be used to control the overall volume of the audio graph.
  94. @throws DOMError
  95. **/
  96. function createGain() : GainNode;
  97. /**
  98. Creates a `DelayNode`, which is used to delay the incoming audio signal by a certain amount. This node is also useful to create feedback loops in a Web Audio API graph.
  99. @throws DOMError
  100. **/
  101. function createDelay( maxDelayTime : Float = 1.0 ) : DelayNode;
  102. /**
  103. Creates a `BiquadFilterNode`, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc
  104. @throws DOMError
  105. **/
  106. function createBiquadFilter() : BiquadFilterNode;
  107. /**
  108. Creates an `IIRFilterNode`, which represents a second order filter configurable as several different common filter types.
  109. @throws DOMError
  110. **/
  111. function createIIRFilter( feedforward : Array<Float>, feedback : Array<Float> ) : IIRFilterNode;
  112. /**
  113. Creates a `WaveShaperNode`, which is used to implement non-linear distortion effects.
  114. @throws DOMError
  115. **/
  116. function createWaveShaper() : WaveShaperNode;
  117. /**
  118. Creates a `PannerNode`, which is used to spatialise an incoming audio stream in 3D space.
  119. @throws DOMError
  120. **/
  121. function createPanner() : PannerNode;
  122. /**
  123. Creates a `StereoPannerNode`, which can be used to apply stereo panning to an audio source.
  124. @throws DOMError
  125. **/
  126. function createStereoPanner() : StereoPannerNode;
  127. /**
  128. Creates a `ConvolverNode`, which can be used to apply convolution effects to your audio graph, for example a reverberation effect.
  129. @throws DOMError
  130. **/
  131. function createConvolver() : ConvolverNode;
  132. /**
  133. Creates a `ChannelSplitterNode`, which is used to access the individual channels of an audio stream and process them separately.
  134. @throws DOMError
  135. **/
  136. function createChannelSplitter( numberOfOutputs : Int = 6 ) : ChannelSplitterNode;
  137. /**
  138. Creates a `ChannelMergerNode`, which is used to combine channels from multiple audio streams into a single audio stream.
  139. @throws DOMError
  140. **/
  141. function createChannelMerger( numberOfInputs : Int = 6 ) : ChannelMergerNode;
  142. /**
  143. Creates a `DynamicsCompressorNode`, which can be used to apply acoustic compression to an audio signal.
  144. @throws DOMError
  145. **/
  146. function createDynamicsCompressor() : DynamicsCompressorNode;
  147. /**
  148. Creates an `OscillatorNode`, a source representing a periodic waveform. It basically generates a tone.
  149. @throws DOMError
  150. **/
  151. function createOscillator() : OscillatorNode;
  152. /**
  153. Creates a `PeriodicWave`, used to define a periodic waveform that can be used to determine the output of an `OscillatorNode`.
  154. @throws DOMError
  155. **/
  156. function createPeriodicWave( real : js.lib.Float32Array, imag : js.lib.Float32Array, ?constraints : PeriodicWaveConstraints ) : PeriodicWave;
  157. }