Class BaseAudioContext

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
    Direct Known Subclasses:
    AudioContext, OfflineAudioContext

    public class BaseAudioContext
    extends EventTarget
    A JavaScript object for BaseAudioContext.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
    • Field Summary

      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseAudioContext()
      Creates an instance.
    • Constructor Detail

      • BaseAudioContext

        public BaseAudioContext()
        Creates an instance.
    • Method Detail

      • createBufferSource

        public AudioBufferSourceNode createBufferSource()
        Returns:
        a new AudioBufferSourceNode, which can be used to play audio data contained within an AudioBuffer object.
      • createBuffer

        public AudioBuffer createBuffer()
        Returns:
        new, empty AudioBuffer object, which can then be populated by data, and played via an AudioBufferSourceNode.
      • createGain

        public GainNode createGain()
        Returns:
        a GainNode, which can be used to control the overall gain (or volume) of the audio graph.
      • decodeAudioData

        public java.lang.Object decodeAudioData​(org.htmlunit.corejs.javascript.typedarrays.NativeArrayBuffer buffer,
                                                org.htmlunit.corejs.javascript.Function success,
                                                org.htmlunit.corejs.javascript.Function error)
        The decodeAudioData() method of the BaseAudioContext Interface is used to asynchronously decode audio file data contained in an ArrayBuffer. In this case the ArrayBuffer is loaded from XMLHttpRequest and FileReader. The decoded AudioBuffer is resampled to the AudioContext's sampling rate, then passed to a callback or promise.
        Parameters:
        buffer - An ArrayBuffer containing the audio data to be decoded, usually grabbed from XMLHttpRequest, WindowOrWorkerGlobalScope.fetch() or FileReader
        success - A callback function to be invoked when the decoding successfully finishes. The single argument to this callback is an AudioBuffer representing the decodedData (the decoded PCM audio data). Usually you'll want to put the decoded data into an AudioBufferSourceNode, from which it can be played and manipulated how you want.
        error - An optional error callback, to be invoked if an error occurs when the audio data is being decoded.
        Returns:
        the promise or null