BaseAudioContext.hx 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. /**
  25. The `BaseAudioContext` interface acts as a base definition for online and offline audio-processing graphs, as represented by `AudioContext` and `OfflineAudioContext` respectively.
  26. 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/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext>
  28. **/
  29. @:native("BaseAudioContext")
  30. extern class BaseAudioContext extends js.html.EventTarget {
  31. /**
  32. Returns an `AudioDestinationNode` representing the final destination of all audio in the context. It can be thought of as the audio-rendering device.
  33. **/
  34. var destination(default,null) : AudioDestinationNode;
  35. /**
  36. 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.
  37. **/
  38. var sampleRate(default,null) : Float;
  39. /**
  40. Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at `0`.
  41. **/
  42. var currentTime(default,null) : Float;
  43. /**
  44. Returns the `AudioListener` object, used for 3D spatialization.
  45. **/
  46. var listener(default,null) : AudioListener;
  47. /**
  48. Returns the current state of the `AudioContext`.
  49. **/
  50. var state(default,null) : AudioContextState;
  51. /**
  52. 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`).
  53. **/
  54. var onstatechange : haxe.Constraints.Function;
  55. /**
  56. Resumes the progression of time in an audio context that has previously been suspended/paused.
  57. @throws DOMError
  58. **/
  59. function resume() : Promise<Void>;
  60. /**
  61. Creates a new, empty `AudioBuffer` object, which can then be populated by data and played via an `AudioBufferSourceNode`.
  62. @throws DOMError
  63. **/
  64. function createBuffer( numberOfChannels : Int, length : Int, sampleRate : Float ) : AudioBuffer;
  65. /**
  66. 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.
  67. @throws DOMError
  68. **/
  69. @:overload( function( audioData : js.html.ArrayBuffer, ?successCallback : AudioBuffer -> Void, ?errorCallback : Void -> Void ) : Promise<AudioBuffer> {} )
  70. function decodeAudioData( audioData : js.html.ArrayBuffer, ?successCallback : AudioBuffer -> Void, ?errorCallback : js.html.DOMException -> Void ) : Promise<AudioBuffer>;
  71. /**
  72. 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.
  73. @throws DOMError
  74. **/
  75. function createBufferSource() : AudioBufferSourceNode;
  76. /**
  77. 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.
  78. @throws DOMError
  79. **/
  80. function createConstantSource() : ConstantSourceNode;
  81. /**
  82. Creates a `ScriptProcessorNode`, which can be used for direct audio processing via JavaScript.
  83. @throws DOMError
  84. **/
  85. function createScriptProcessor( bufferSize : Int = 0, numberOfInputChannels : Int = 2, numberOfOutputChannels : Int = 2 ) : ScriptProcessorNode;
  86. /**
  87. Creates an `AnalyserNode`, which can be used to expose audio time and frequency data and for example to create data visualisations.
  88. @throws DOMError
  89. **/
  90. function createAnalyser() : AnalyserNode;
  91. /**
  92. Creates a `GainNode`, which can be used to control the overall volume of the audio graph.
  93. @throws DOMError
  94. **/
  95. function createGain() : GainNode;
  96. /**
  97. 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.
  98. @throws DOMError
  99. **/
  100. function createDelay( maxDelayTime : Float = 1.0 ) : DelayNode;
  101. /**
  102. Creates a `BiquadFilterNode`, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc
  103. @throws DOMError
  104. **/
  105. function createBiquadFilter() : BiquadFilterNode;
  106. /**
  107. Creates an `IIRFilterNode`, which represents a second order filter configurable as several different common filter types.
  108. @throws DOMError
  109. **/
  110. function createIIRFilter( feedforward : Array<Float>, feedback : Array<Float> ) : IIRFilterNode;
  111. /**
  112. Creates a `WaveShaperNode`, which is used to implement non-linear distortion effects.
  113. @throws DOMError
  114. **/
  115. function createWaveShaper() : WaveShaperNode;
  116. /**
  117. Creates a `PannerNode`, which is used to spatialise an incoming audio stream in 3D space.
  118. @throws DOMError
  119. **/
  120. function createPanner() : PannerNode;
  121. /**
  122. Creates a `StereoPannerNode`, which can be used to apply stereo panning to an audio source.
  123. @throws DOMError
  124. **/
  125. function createStereoPanner() : StereoPannerNode;
  126. /**
  127. Creates a `ConvolverNode`, which can be used to apply convolution effects to your audio graph, for example a reverberation effect.
  128. @throws DOMError
  129. **/
  130. function createConvolver() : ConvolverNode;
  131. /**
  132. Creates a `ChannelSplitterNode`, which is used to access the individual channels of an audio stream and process them separately.
  133. @throws DOMError
  134. **/
  135. function createChannelSplitter( numberOfOutputs : Int = 6 ) : ChannelSplitterNode;
  136. /**
  137. Creates a `ChannelMergerNode`, which is used to combine channels from multiple audio streams into a single audio stream.
  138. @throws DOMError
  139. **/
  140. function createChannelMerger( numberOfInputs : Int = 6 ) : ChannelMergerNode;
  141. /**
  142. Creates a `DynamicsCompressorNode`, which can be used to apply acoustic compression to an audio signal.
  143. @throws DOMError
  144. **/
  145. function createDynamicsCompressor() : DynamicsCompressorNode;
  146. /**
  147. Creates an `OscillatorNode`, a source representing a periodic waveform. It basically generates a tone.
  148. @throws DOMError
  149. **/
  150. function createOscillator() : OscillatorNode;
  151. /**
  152. Creates a `PeriodicWave`, used to define a periodic waveform that can be used to determine the output of an `OscillatorNode`.
  153. @throws DOMError
  154. **/
  155. function createPeriodicWave( real : js.html.Float32Array, imag : js.html.Float32Array, ?constraints : PeriodicWaveConstraints ) : PeriodicWave;
  156. }