From 4f524b864f53f681cea688ae72d57d0e65ff32a5 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sat, 22 Jul 2023 18:08:54 +0100 Subject: [PATCH 01/42] backup --- .../scalajs/dom/AudioBufferSourceNode.scala | 14 +- .../scala/org/scalajs/dom/AudioContext.scala | 138 ++--------------- .../scala/org/scalajs/dom/AudioNode.scala | 4 +- .../dom/AudioScheduledSourceNode.scala | 28 ++++ .../org/scalajs/dom/AudioTimestamp.scala | 13 ++ .../org/scalajs/dom/BaseAudioContext.scala | 140 ++++++++++++++++++ .../org/scalajs/dom/ChannelCountMode.scala | 18 +++ .../scalajs/dom/ChannelInterpretation.scala | 16 ++ .../org/scalajs/dom/ConstantSourceNode.scala | 16 ++ .../dom/MediaElementAudioSourceNode.scala | 6 +- .../MediaElementAudioSourceNodeOptions.scala | 15 ++ .../org/scalajs/dom/OfflineAudioContext.scala | 7 +- .../org/scalajs/dom/OscillatorNode.scala | 11 +- 13 files changed, 275 insertions(+), 151 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala index 1fc346b2b..fafb1e718 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala @@ -24,7 +24,7 @@ import scala.scalajs.js * - Channel count: defined by the associated AudioBuffer */ @js.native -trait AudioBufferSourceNode extends AudioNode { +trait AudioBufferSourceNode extends AudioScheduledSourceNode { /** Is an AudioBuffer that defines the audio asset to be played, or when set to the value null, defines a single * channel of silence. @@ -63,16 +63,8 @@ trait AudioBufferSourceNode extends AudioNode { * The duration parameter, which defaults to the length of the asset minus the value of offset, defines the length * of the portion of the asset to be played. */ - def start(when: Double = js.native, offset: Double = js.native, duration: Double = js.native): Unit = js.native + def start(when: Double, offset: Double, duration: Double): Unit = js.native - /** Schedules the end of the playback of an audio asset. - * - * @param when - * The when parameter defines when the playback will stop. If it represents a time in the past, the playback will - * end immediately. If this method is called twice or more, an exception is raised. - */ - def stop(when: Double = js.native): Unit = js.native + def start(when: Double, offset: Double): Unit = js.native - /** Is an EventHandler containing the callback associated with the ended event. */ - var onended: js.Function1[Event, _] = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala index f56f6d956..6fe71973c 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala @@ -17,98 +17,13 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class AudioContext extends EventTarget { +class AudioContext extends BaseAudioContext { - /** Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at 0 and - * cannot be stopped, paused or reset. - */ - def currentTime: Double = js.native - - /** Returns an AudioDestinationNode representing the final destination of all audio in the context. It can be thought - * of as the audio-rendering device. - */ - val destination: AudioDestinationNode = js.native - - /** Returns the AudioListener object, used for 3D spatialization. */ - val listener: AudioListener = js.native - - /** 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. - */ - val sampleRate: Double = js.native + // Returns the number of seconds of processing latency incurred by the AudioContext passing the audio from the AudioDestinationNode to the aud io subsystem. + def baseLatency: Double = js.native - /** Returns the current state of the AudioContext. */ - def state: String = js.native - - /** Closes the audio context, releasing any system audio resources that it uses. */ - def close(): js.Promise[Unit] = js.native - - /** Creates an AnalyserNode, which can be used to expose audio time and frequency data and for example to create data - * visualisations. - */ - def createAnalyser(): AnalyserNode = js.native - - /** Creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter - * types: high-pass, low-pass, band-pass, etc. - */ - def createBiquadFilter(): BiquadFilterNode = js.native - - /** Creates a new, empty AudioBuffer object, which can then be populated by data and played via an - * AudioBufferSourceNode. - * - * @param numOfChannels - * An integer representing the number of channels this buffer should have. Implementations must support a minimum - * 32 channels. - * @param length - * An integer representing the size of the buffer in sample-frames. - * @param sampleRate - * The sample-rate of the linear audio data in sample-frames per second. An implementation must support - * sample-rates in at least the range 22050 to 96000. - */ - def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer = js.native - - /** Creates an AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an - * AudioBuffer object. AudioBuffers are created using AudioContext.createBuffer or returned by - * AudioContext.decodeAudioData when it successfully decodes an audio track. - */ - def createBufferSource(): AudioBufferSourceNode = js.native - - /** Creates a ChannelMergerNode, which is used to combine channels from multiple audio streams into a single audio - * stream. - * - * @param numberOfInputs - * The number of channels in the input audio streams, which the output stream will contain; the default is 6 is - * this parameter is not specified. - */ - def createChannelMerger(numberOfInputs: Int = js.native): ChannelMergerNode = js.native - - /** Creates a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them - * separately. - * - * @param numberOfOutputs - * The number of channels in the input audio stream that you want to output separately; the default is 6 is this - * parameter is not specified. - */ - def createChannelSplitter(numberOfOutputs: Int = js.native): ChannelSplitterNode = js.native - - /** Creates a ConvolverNode, which can be used to apply convolution effects to your audio graph, for example a - * reverberation effect. - */ - def createConvolver(): ConvolverNode = js.native - - /** 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. - * - * @param maxDelayTime - * The maximum amount of time, in seconds, that the audio signal can be delayed by. The default value is 0. - */ - def createDelay(maxDelayTime: Int): DelayNode = js.native - - /** Creates a DynamicsCompressorNode, which can be used to apply acoustic compression to an audio signal. */ - def createDynamicsCompressor(): DynamicsCompressorNode = js.native - - /** Creates a GainNode, which can be used to control the overall volume of the audio graph. */ - def createGain(): GainNode = js.native + /** Returns an estimation of the output latency of the current audio context. */ + def outputLatency: Double = js.native /** Creates a MediaElementAudioSourceNode associated with an HTMLMediaElement. This can be used to play and manipulate * audio from <video> or <audio> elements. @@ -131,42 +46,6 @@ class AudioContext extends EventTarget { */ def createMediaStreamDestination(): MediaStreamAudioDestinationNode = js.native - /** Creates an OscillatorNode, a source representing a periodic waveform. It basically generates a tone. */ - def createOscillator(): OscillatorNode = js.native - - /** Creates a PannerNode, which is used to spatialise an incoming audio stream in 3D space. */ - def createPanner(): PannerNode = js.native - - /** Creates a PeriodicWave, used to define a periodic waveform that can be used to determine the output of an - * OscillatorNode. - */ - def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave = js.native - - /** Creates a StereoPannerNode, which can be used to apply stereo panning to an audio source. */ - def createStereoPanner(): StereoPannerNode = js.native - - /** Creates a WaveShaperNode, which is used to implement non-linear distortion effects. */ - def createWaveShaper(): WaveShaperNode = js.native - - /** 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. - * - * @param audioData - * An ArrayBuffer containing the audio data to be decoded, usually grabbed from an XMLHttpRequest's response - * attribute after setting the responseType to arraybuffer. - * @param successCallback - * A callback function to be invoked when the decoding successfully finishes. The single argument to this callback - * is an AudioBuffer representing 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. - * @param errorCallback - * An optional error callback, to be invoked if an error occurs when the audio data is being decoded. - */ - def decodeAudioData( - audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _] = js.native, - errorCallback: js.Function0[_] = js.native - ): js.Promise[AudioBuffer] = js.native - /** Resumes the progression of time in an audio context that has previously been suspended. */ def resume(): js.Promise[Unit] = js.native @@ -174,4 +53,11 @@ class AudioContext extends EventTarget { * CPU/battery usage in the process. */ def suspend(): js.Promise[Unit] = js.native + + /** Closes the audio context, releasing any system audio resources that it uses. */ + def close(): js.Promise[Unit] = js.native + + + // TODO docs + def getOutputTimestamp: AudioTimestamp = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala index 283f604dc..2e3ef7adc 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala @@ -47,14 +47,14 @@ trait AudioNode extends EventTarget { /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. */ - var channelCountMode: Int = js.native + var channelCountMode: ChannelCountMode = js.native /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio * up-mixing and down-mixing will happen. * * The possible values are "speakers" or "discrete". */ - var channelInterpretation: String = js.native + var channelInterpretation: ChannelInterpretation = js.native /** Allows us to connect one output of this node to one input of another node. */ def connect(audioNode: AudioNode): Unit = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala new file mode 100644 index 000000000..0d23e3329 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala @@ -0,0 +1,28 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +trait AudioScheduledSourceNode extends AudioNode { + + /** This method specifies the exact time to start playing the tone. */ + def start(): Unit = js.native + + /** This method specifies the exact time to stop playing the tone. */ + def stop(): Unit = js.native + + /** This method specifies the exact time to start playing the tone. */ + def start(when: Double): Unit = js.native + + /** This method specifies the exact time to stop playing the tone. */ + def stop(when: Double): Unit = js.native + + /** Used to set the event handler for the ended event, which fires when the tone has stopped playing. */ + var onended: js.Function1[Event, _] = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala new file mode 100644 index 000000000..63aca71c4 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala @@ -0,0 +1,13 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait AudioTimestamp extends js.Object { + var contextTime: Double + var performanceTime: Double +} diff --git a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala new file mode 100644 index 000000000..732c94280 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala @@ -0,0 +1,140 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +/** The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly — you'd use its features via one of these two inheriting interfaces. + +A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. */ +@js.native +trait BaseAudioContext extends EventTarget { + + /** Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at 0 and + * cannot be stopped, paused or reset. + */ + def currentTime: Double = js.native + + /** Returns an AudioDestinationNode representing the final destination of all audio in the context. It can be thought + * of as the audio-rendering device. + */ + val destination: AudioDestinationNode = js.native + + /** Returns the AudioListener object, used for 3D spatialization. */ + val listener: AudioListener = js.native + + /** 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. + */ + val sampleRate: Double = js.native + + /** Returns the current state of the AudioContext. */ + def state: String = js.native + + /** Creates an AnalyserNode, which can be used to expose audio time and frequency data and for example to create data + * visualisations. + */ + def createAnalyser(): AnalyserNode = js.native + + /** Creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter + * types: high-pass, low-pass, band-pass, etc. + */ + def createBiquadFilter(): BiquadFilterNode = js.native + + /** Creates a new, empty AudioBuffer object, which can then be populated by data and played via an + * AudioBufferSourceNode. + * + * @param numOfChannels + * An integer representing the number of channels this buffer should have. Implementations must support a minimum + * 32 channels. + * @param length + * An integer representing the size of the buffer in sample-frames. + * @param sampleRate + * The sample-rate of the linear audio data in sample-frames per second. An implementation must support + * sample-rates in at least the range 22050 to 96000. + */ + def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer = js.native + + /** Creates an AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an + * AudioBuffer object. AudioBuffers are created using AudioContext.createBuffer or returned by + * AudioContext.decodeAudioData when it successfully decodes an audio track. + */ + def createBufferSource(): AudioBufferSourceNode = js.native + + /** Creates a ChannelMergerNode, which is used to combine channels from multiple audio streams into a single audio + * stream. + * + * @param numberOfInputs + * The number of channels in the input audio streams, which the output stream will contain; the default is 6 is + * this parameter is not specified. + */ + def createChannelMerger(numberOfInputs: Int = js.native): ChannelMergerNode = js.native + + /** Creates a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them + * separately. + * + * @param numberOfOutputs + * The number of channels in the input audio stream that you want to output separately; the default is 6 is this + * parameter is not specified. + */ + def createChannelSplitter(numberOfOutputs: Int = js.native): ChannelSplitterNode = js.native + + /** Creates a ConvolverNode, which can be used to apply convolution effects to your audio graph, for example a + * reverberation effect. + */ + def createConvolver(): ConvolverNode = js.native + + /** 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. + * + * @param maxDelayTime + * The maximum amount of time, in seconds, that the audio signal can be delayed by. The default value is 0. + */ + def createDelay(maxDelayTime: Int): DelayNode = js.native + + /** Creates a DynamicsCompressorNode, which can be used to apply acoustic compression to an audio signal. */ + def createDynamicsCompressor(): DynamicsCompressorNode = js.native + + /** Creates a GainNode, which can be used to control the overall volume of the audio graph. */ + def createGain(): GainNode = js.native + + /** Creates an OscillatorNode, a source representing a periodic waveform. It basically generates a tone. */ + def createOscillator(): OscillatorNode = js.native + + /** Creates a PannerNode, which is used to spatialise an incoming audio stream in 3D space. */ + def createPanner(): PannerNode = js.native + + /** Creates a PeriodicWave, used to define a periodic waveform that can be used to determine the output of an + * OscillatorNode. + */ + def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave = js.native + + /** Creates a StereoPannerNode, which can be used to apply stereo panning to an audio source. */ + def createStereoPanner(): StereoPannerNode = js.native + + /** Creates a WaveShaperNode, which is used to implement non-linear distortion effects. */ + def createWaveShaper(): WaveShaperNode = js.native + + /** 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. + * + * @param audioData + * An ArrayBuffer containing the audio data to be decoded, usually grabbed from an XMLHttpRequest's response + * attribute after setting the responseType to arraybuffer. + * @param successCallback + * A callback function to be invoked when the decoding successfully finishes. The single argument to this callback + * is an AudioBuffer representing 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. + * @param errorCallback + * An optional error callback, to be invoked if an error occurs when the audio data is being decoded. + */ + def decodeAudioData( + audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _] = js.native, + errorCallback: js.Function0[_] = js.native + ): js.Promise[AudioBuffer] = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala b/dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala new file mode 100644 index 000000000..ba969faff --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala @@ -0,0 +1,18 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait ChannelCountMode extends js.Any + +object ChannelCountMode { + val max: ChannelCountMode = "max".asInstanceOf[ChannelCountMode] + val `clamped-max`: ChannelCountMode = "clamped-max".asInstanceOf[ChannelCountMode] + val explicit: ChannelCountMode = "explicit".asInstanceOf[ChannelCountMode] + +} diff --git a/dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala b/dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala new file mode 100644 index 000000000..0f8392a82 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala @@ -0,0 +1,16 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait ChannelInterpretation extends js.Any + +object ChannelInterpretation { + val speakers: ChannelInterpretation = "speakers".asInstanceOf[ChannelInterpretation] + val discrete: ChannelInterpretation = "discrete".asInstanceOf[ChannelInterpretation] +} diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala new file mode 100644 index 000000000..b1549785a --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala @@ -0,0 +1,16 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +trait ConstantSourceNode extends AudioScheduledSourceNode { + + // TODO + val offset: AudioParam = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala index 99e1e6cb1..775640345 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala @@ -6,6 +6,7 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ /** The MediaElementAudioSourceNode interface represents an audio source consisting of an HTML5 <audio> or * <video> element. It is an AudioNode that acts as an audio source. @@ -20,5 +21,8 @@ import scala.scalajs.js * - Channel count: defined by the media in the HTMLMediaElement passed to the AudioContext.createMediaElementSource * method that created it. */ +@JSGlobal @js.native -trait MediaElementAudioSourceNode extends AudioNode +class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) extends AudioNode { + val mediaElement: HTMLMediaElement = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala new file mode 100644 index 000000000..246f335e1 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala @@ -0,0 +1,15 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait MediaElementAudioSourceNodeOptions extends js.Object { + var mediaElement: HTMLMediaElement + var channelCount: js.UndefOr[Int] = js.undefined + var channelCountMode: js.UndefOr[ChannelCountMode] = js.undefined + var channelInterpretation: js.UndefOr[ChannelInterpretation] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala index d8ccc27e6..088e82fae 100644 --- a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala @@ -32,7 +32,7 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) extends AudioContext { +class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) extends BaseAudioContext { /** The promise-based startRendering() method of the OfflineAudioContext Interface starts rendering the audio graph, * taking into account the current connections and the current scheduled changes. @@ -41,4 +41,9 @@ class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) exte * promise resolves with an AudioBuffer containing the rendered audio. */ def startRendering(): js.Promise[AudioBuffer] = js.native + + + // Schedules a suspension of the time progression in the audio context at the specified time and returns a promise. + def suspend(suspendTime: Double): js.Promise[Unit] = js.native + } diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index afaaaf53a..8082f04dd 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -20,7 +20,7 @@ import scala.scalajs.js * - Channel interpretation: speakers */ @js.native -trait OscillatorNode extends AudioNode { +trait OscillatorNode extends AudioScheduledSourceNode { /** An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is * read-only, the value it represents is not.) @@ -35,19 +35,10 @@ trait OscillatorNode extends AudioNode { /** Represents the shape of the oscillator wave generated. Different waves will produce different tones. */ var `type`: String = js.native // Not sure if this is correct ... - /** This method specifies the exact time to start playing the tone. */ - def start(when: Double = js.native): Unit = js.native - - /** This method specifies the exact time to stop playing the tone. */ - def stop(when: Double = js.native): Unit = js.native - /** Used to point to a PeriodicWave defining a periodic waveform that can be used to shape the oscillator's output, * when type = "custom" is used. * * This replaces the now-obsolete OscillatorNode.setWaveTable. */ def setPeriodicWave(wave: PeriodicWave): Unit = js.native - - /** Used to set the event handler for the ended event, which fires when the tone has stopped playing. */ - var onended: js.Function1[Event, _] = js.native } From 8b1d1322d142d3db12488272777d71323745b606 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sat, 22 Jul 2023 22:00:04 +0100 Subject: [PATCH 02/42] backup --- .../scalajs/dom/AudioBufferSourceNode.scala | 5 ++++- .../dom/AudioBufferSourceNodeOptions.scala | 18 ++++++++++++++++++ .../scala/org/scalajs/dom/AudioContext.scala | 1 - .../main/scala/org/scalajs/dom/AudioNode.scala | 4 ++-- .../dom/AudioNodeChannelCountMode.scala | 18 ++++++++++++++++++ ...la => AudioNodeChannelInterpretation.scala} | 10 ++++------ .../org/scalajs/dom/BaseAudioContext.scala | 9 ++++++--- .../org/scalajs/dom/ConstantSourceNode.scala | 2 +- .../main/scala/org/scalajs/dom/GainNode.scala | 4 +++- ...erpretation.scala => GainNodeOptions.scala} | 11 +++++------ .../dom/MediaElementAudioSourceNode.scala | 3 ++- .../MediaElementAudioSourceNodeOptions.scala | 4 ++-- .../org/scalajs/dom/OfflineAudioContext.scala | 1 - 13 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala rename dom/src/main/scala/org/scalajs/dom/{ChannelCountMode.scala => AudioNodeChannelInterpretation.scala} (55%) rename dom/src/main/scala/org/scalajs/dom/{ChannelInterpretation.scala => GainNodeOptions.scala} (55%) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala index fafb1e718..5c0977af7 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala @@ -6,6 +6,7 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ /** AudioBufferSourceNode has no input and exactly one output. The number of channels in the output corresponds to the * number of channels of the AudioBuffer that is set to the AudioBufferSourceNode.buffer property. If there is no @@ -23,8 +24,10 @@ import scala.scalajs.js * - Number of outputs: 1 * - Channel count: defined by the associated AudioBuffer */ +@JSGlobal @js.native -trait AudioBufferSourceNode extends AudioScheduledSourceNode { +class AudioBufferSourceNode(context: BaseAudioContext, options: AudioBufferSourceNodeOptions = js.native) + extends AudioScheduledSourceNode { /** Is an AudioBuffer that defines the audio asset to be played, or when set to the value null, defines a single * channel of silence. diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala new file mode 100644 index 000000000..004b75a77 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala @@ -0,0 +1,18 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait AudioBufferSourceNodeOptions extends js.Object { + var buffer: js.UndefOr[AudioBuffer] = js.undefined + var loop: js.UndefOr[Boolean] = js.undefined + var loopStart: js.UndefOr[Double] = js.undefined + var loopEnd: js.UndefOr[Double] = js.undefined + var detune: js.UndefOr[Double] = js.undefined + var playbackRate: js.UndefOr[Double] = js.undefined +} + diff --git a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala index 6fe71973c..0f0d31295 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala @@ -57,7 +57,6 @@ class AudioContext extends BaseAudioContext { /** Closes the audio context, releasing any system audio resources that it uses. */ def close(): js.Promise[Unit] = js.native - // TODO docs def getOutputTimestamp: AudioTimestamp = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala index 2e3ef7adc..6d107417b 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala @@ -47,14 +47,14 @@ trait AudioNode extends EventTarget { /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. */ - var channelCountMode: ChannelCountMode = js.native + var channelCountMode: AudioNodeChannelCountMode = js.native /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio * up-mixing and down-mixing will happen. * * The possible values are "speakers" or "discrete". */ - var channelInterpretation: ChannelInterpretation = js.native + var channelInterpretation: AudioNodeChannelInterpretation = js.native /** Allows us to connect one output of this node to one input of another node. */ def connect(audioNode: AudioNode): Unit = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala new file mode 100644 index 000000000..623d68207 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala @@ -0,0 +1,18 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait AudioNodeChannelCountMode extends js.Any + +object AudioNodeChannelCountMode { + val max: AudioNodeChannelCountMode = "max".asInstanceOf[AudioNodeChannelCountMode] + val `clamped-max`: AudioNodeChannelCountMode = "clamped-max".asInstanceOf[AudioNodeChannelCountMode] + val explicit: AudioNodeChannelCountMode = "explicit".asInstanceOf[AudioNodeChannelCountMode] + +} diff --git a/dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala similarity index 55% rename from dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala rename to dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala index ba969faff..7708e2770 100644 --- a/dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala @@ -8,11 +8,9 @@ package org.scalajs.dom import scala.scalajs.js @js.native -sealed trait ChannelCountMode extends js.Any - -object ChannelCountMode { - val max: ChannelCountMode = "max".asInstanceOf[ChannelCountMode] - val `clamped-max`: ChannelCountMode = "clamped-max".asInstanceOf[ChannelCountMode] - val explicit: ChannelCountMode = "explicit".asInstanceOf[ChannelCountMode] +sealed trait AudioNodeChannelInterpretation extends js.Any +object AudioNodeChannelInterpretation { + val speakers: AudioNodeChannelInterpretation = "speakers".asInstanceOf[AudioNodeChannelInterpretation] + val discrete: AudioNodeChannelInterpretation = "discrete".asInstanceOf[AudioNodeChannelInterpretation] } diff --git a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala index 732c94280..bc648984b 100644 --- a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala @@ -7,9 +7,12 @@ package org.scalajs.dom import scala.scalajs.js -/** The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly — you'd use its features via one of these two inheriting interfaces. - -A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. */ +/** The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline + * audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use + * BaseAudioContext directly — you'd use its features via one of these two inheriting interfaces. + * + * A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. + */ @js.native trait BaseAudioContext extends EventTarget { diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala index b1549785a..f34410495 100644 --- a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala @@ -10,7 +10,7 @@ import scala.scalajs.js @js.native trait ConstantSourceNode extends AudioScheduledSourceNode { - // TODO + // TODO val offset: AudioParam = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/GainNode.scala b/dom/src/main/scala/org/scalajs/dom/GainNode.scala index c70234e8b..28bffd2e8 100644 --- a/dom/src/main/scala/org/scalajs/dom/GainNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNode.scala @@ -6,6 +6,7 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ /** The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given * gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input @@ -23,8 +24,9 @@ import scala.scalajs.js * - Channel count: 2 (not used in the default count mode) * - Channel interpretation: "speakers" */ +@JSGlobal @js.native -trait GainNode extends AudioNode { +class GainNode(context: BaseAudioContext, options: GainNodeOptions = js.native) extends AudioNode { /** Is an a-rate AudioParam representing the amount of gain to apply. */ val gain: AudioParam = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala similarity index 55% rename from dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala rename to dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala index 0f8392a82..3315ba381 100644 --- a/dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala @@ -7,10 +7,9 @@ package org.scalajs.dom import scala.scalajs.js -@js.native -sealed trait ChannelInterpretation extends js.Any - -object ChannelInterpretation { - val speakers: ChannelInterpretation = "speakers".asInstanceOf[ChannelInterpretation] - val discrete: ChannelInterpretation = "discrete".asInstanceOf[ChannelInterpretation] +trait GainNodeOptions extends js.Object { + var gain: js.UndefOr[Double] = js.undefined + var channelCount: js.UndefOr[Int] = js.undefined + var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala index 775640345..335c4e8c8 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala @@ -23,6 +23,7 @@ import scala.scalajs.js.annotation._ */ @JSGlobal @js.native -class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) extends AudioNode { +class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) + extends AudioNode { val mediaElement: HTMLMediaElement = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala index 246f335e1..b5c6e8bf4 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala @@ -10,6 +10,6 @@ import scala.scalajs.js trait MediaElementAudioSourceNodeOptions extends js.Object { var mediaElement: HTMLMediaElement var channelCount: js.UndefOr[Int] = js.undefined - var channelCountMode: js.UndefOr[ChannelCountMode] = js.undefined - var channelInterpretation: js.UndefOr[ChannelInterpretation] = js.undefined + var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala index 088e82fae..f996739cc 100644 --- a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala @@ -42,7 +42,6 @@ class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) exte */ def startRendering(): js.Promise[AudioBuffer] = js.native - // Schedules a suspension of the time progression in the audio context at the specified time and returns a promise. def suspend(suspendTime: Double): js.Promise[Unit] = js.native From b44eaa8b0d759f523d61dbb4bc588dcef2ce9947 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sat, 22 Jul 2023 22:12:36 +0100 Subject: [PATCH 03/42] backup --- .../dom/AudioBufferSourceNodeOptions.scala | 4 +++- .../dom/AudioNodeChannelCountMode.scala | 1 - .../scala/org/scalajs/dom/AudioParam.scala | 4 ++++ .../dom/MediaElementAudioSourceNode.scala | 2 +- .../org/scalajs/dom/OscillatorNode.scala | 7 +++++-- .../scalajs/dom/OscillatorNodeOptions.scala | 18 ++++++++++++++++++ .../org/scalajs/dom/OscillatorNodeType.scala | 19 +++++++++++++++++++ 7 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala index 004b75a77..480b3cffc 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala @@ -14,5 +14,7 @@ trait AudioBufferSourceNodeOptions extends js.Object { var loopEnd: js.UndefOr[Double] = js.undefined var detune: js.UndefOr[Double] = js.undefined var playbackRate: js.UndefOr[Double] = js.undefined + var channelCount: js.UndefOr[Int] = js.undefined + var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } - diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala index 623d68207..d41252c10 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala @@ -14,5 +14,4 @@ object AudioNodeChannelCountMode { val max: AudioNodeChannelCountMode = "max".asInstanceOf[AudioNodeChannelCountMode] val `clamped-max`: AudioNodeChannelCountMode = "clamped-max".asInstanceOf[AudioNodeChannelCountMode] val explicit: AudioNodeChannelCountMode = "explicit".asInstanceOf[AudioNodeChannelCountMode] - } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParam.scala b/dom/src/main/scala/org/scalajs/dom/AudioParam.scala index 79b16030b..b2e65ab3a 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParam.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParam.scala @@ -36,6 +36,10 @@ trait AudioParam extends AudioNode { /** Represents the initial value of the attributes as defined by the specific AudioNode creating the AudioParam. */ val defaultValue: Double = js.native + val maxValue: Double = js.native + + val minValue: Double = js.native + /** Schedules an instant change to the value of the AudioParam at a precise time, as measured against * AudioContext.currentTime. The new value is given in the value parameter. * diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala index 335c4e8c8..b25fb8f60 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala @@ -23,7 +23,7 @@ import scala.scalajs.js.annotation._ */ @JSGlobal @js.native -class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) +class MediaElementAudioSourceNode(context: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) extends AudioNode { val mediaElement: HTMLMediaElement = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index 8082f04dd..fb3bf164d 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -6,6 +6,7 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ /** The OscillatorNode interface represents a periodic waveform, like a sine wave. It is an AudioNode audio-processing * module that causes a given frequency of sine wave to be created — in effect, a constant tone. @@ -19,8 +20,10 @@ import scala.scalajs.js * - Channel count: 2 (not used in the default count mode) * - Channel interpretation: speakers */ +@JSGlobal @js.native -trait OscillatorNode extends AudioScheduledSourceNode { +class OscillatorNode(context: BaseAudioContext, options: OscillatorNodeOptions = js.native) + extends AudioScheduledSourceNode { /** An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is * read-only, the value it represents is not.) @@ -33,7 +36,7 @@ trait OscillatorNode extends AudioScheduledSourceNode { var detune: AudioParam = js.native /** Represents the shape of the oscillator wave generated. Different waves will produce different tones. */ - var `type`: String = js.native // Not sure if this is correct ... + var `type`: OscillatorNodeType = js.native // Not sure if this is correct ... /** Used to point to a PeriodicWave defining a periodic waveform that can be used to shape the oscillator's output, * when type = "custom" is used. diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala new file mode 100644 index 000000000..7dac9665e --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala @@ -0,0 +1,18 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait OscillatorNodeOptions extends js.Object { + var `type`: js.UndefOr[OscillatorNodeType] = js.undefined + var detune: js.UndefOr[Double] = js.undefined + var frequency: js.UndefOr[Double] = js.undefined + var periodicWave: js.UndefOr[PeriodicWave] = js.undefined + var channelCount: js.UndefOr[Int] = js.undefined + var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala new file mode 100644 index 000000000..05e3446a1 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala @@ -0,0 +1,19 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait OscillatorNodeType extends js.Any + +object OscillatorNodeType { + val sine: OscillatorNodeType = "sine".asInstanceOf[OscillatorNodeType] + val square: OscillatorNodeType = "square".asInstanceOf[OscillatorNodeType] + val sawtooth: OscillatorNodeType = "sawtooth".asInstanceOf[OscillatorNodeType] + val triangle: OscillatorNodeType = "triangle".asInstanceOf[OscillatorNodeType] + val custom: OscillatorNodeType = "custom".asInstanceOf[OscillatorNodeType] +} From 2aaf2ed298012130dda2f8223cc0ae6361a65b3a Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Mon, 18 Sep 2023 17:51:35 +0100 Subject: [PATCH 04/42] Switch back to using traits for now. --- dom/src/main/scala/org/scalajs/dom/GainNode.scala | 10 +++++++--- .../main/scala/org/scalajs/dom/OscillatorNode.scala | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/GainNode.scala b/dom/src/main/scala/org/scalajs/dom/GainNode.scala index 28bffd2e8..2819398be 100644 --- a/dom/src/main/scala/org/scalajs/dom/GainNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNode.scala @@ -6,7 +6,6 @@ package org.scalajs.dom import scala.scalajs.js -import scala.scalajs.js.annotation._ /** The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given * gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input @@ -24,10 +23,15 @@ import scala.scalajs.js.annotation._ * - Channel count: 2 (not used in the default count mode) * - Channel interpretation: "speakers" */ -@JSGlobal @js.native -class GainNode(context: BaseAudioContext, options: GainNodeOptions = js.native) extends AudioNode { +trait GainNode extends AudioNode { /** Is an a-rate AudioParam representing the amount of gain to apply. */ val gain: AudioParam = js.native } + +object GainNode { + + def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions] = js.undefined): GainNode = + js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode] +} diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index fb3bf164d..817835cfd 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -6,7 +6,6 @@ package org.scalajs.dom import scala.scalajs.js -import scala.scalajs.js.annotation._ /** The OscillatorNode interface represents a periodic waveform, like a sine wave. It is an AudioNode audio-processing * module that causes a given frequency of sine wave to be created — in effect, a constant tone. @@ -20,9 +19,8 @@ import scala.scalajs.js.annotation._ * - Channel count: 2 (not used in the default count mode) * - Channel interpretation: speakers */ -@JSGlobal @js.native -class OscillatorNode(context: BaseAudioContext, options: OscillatorNodeOptions = js.native) +trait OscillatorNode extends AudioScheduledSourceNode { /** An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is @@ -45,3 +43,8 @@ class OscillatorNode(context: BaseAudioContext, options: OscillatorNodeOptions = */ def setPeriodicWave(wave: PeriodicWave): Unit = js.native } + +object OscillatorNode { + def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions] = js.undefined): GainNode = + js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode] +} From b91df372cc69c38461ba5ae40ccb8145fe07a7a8 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Mon, 18 Sep 2023 18:15:53 +0100 Subject: [PATCH 05/42] typo. --- dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index 817835cfd..144d04924 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -45,6 +45,6 @@ trait OscillatorNode } object OscillatorNode { - def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions] = js.undefined): GainNode = - js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode] + def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions] = js.undefined): OscillatorNode = + js.Dynamic.newInstance(js.Dynamic.global.OscillatorNode)(context, options).asInstanceOf[OscillatorNode] } From a4edff5f7255d12d87bf1cf09dd67c0679eca260 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sun, 24 Sep 2023 18:20:52 +0100 Subject: [PATCH 06/42] Switch encoding for mima. --- .../org/scalajs/dom/AudioBufferSourceNode.scala | 17 +++++++++++++---- .../org/scalajs/dom/ConstantSourceNode.scala | 5 ++++- .../scalajs/dom/ConstantSourceNodeOptions.scala | 12 ++++++++++++ .../main/scala/org/scalajs/dom/GainNode.scala | 5 ++++- .../dom/MediaElementAudioSourceNode.scala | 17 +++++++++++++---- .../scala/org/scalajs/dom/OscillatorNode.scala | 6 ++++-- 6 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala index 5c0977af7..8e37ee468 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala @@ -6,7 +6,6 @@ package org.scalajs.dom import scala.scalajs.js -import scala.scalajs.js.annotation._ /** AudioBufferSourceNode has no input and exactly one output. The number of channels in the output corresponds to the * number of channels of the AudioBuffer that is set to the AudioBufferSourceNode.buffer property. If there is no @@ -24,10 +23,8 @@ import scala.scalajs.js.annotation._ * - Number of outputs: 1 * - Channel count: defined by the associated AudioBuffer */ -@JSGlobal @js.native -class AudioBufferSourceNode(context: BaseAudioContext, options: AudioBufferSourceNodeOptions = js.native) - extends AudioScheduledSourceNode { +trait AudioBufferSourceNode extends AudioScheduledSourceNode { /** Is an AudioBuffer that defines the audio asset to be played, or when set to the value null, defines a single * channel of silence. @@ -71,3 +68,15 @@ class AudioBufferSourceNode(context: BaseAudioContext, options: AudioBufferSourc def start(when: Double, offset: Double): Unit = js.native } + +object AudioBufferSourceNode { + + import js.`|`.undefOr2jsAny + + def apply(context: BaseAudioContext, + options: js.UndefOr[AudioBufferSourceNodeOptions] = js.undefined): AudioBufferSourceNode = { + js.Dynamic + .newInstance(js.Dynamic.global.AudioBufferSourceNode)(context, options) + .asInstanceOf[AudioBufferSourceNode] + } +} diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala index f34410495..d9fc2d642 100644 --- a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala @@ -6,9 +6,12 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ +@JSGlobal @js.native -trait ConstantSourceNode extends AudioScheduledSourceNode { +class ConstantSourceNode(context: BaseAudioContext, options: ConstantSourceNodeOptions = js.native) + extends AudioScheduledSourceNode { // TODO val offset: AudioParam = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala new file mode 100644 index 000000000..a1632da3e --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala @@ -0,0 +1,12 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait ConstantSourceNodeOptions extends js.Object { + var offset: js.UndefOr[Double] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/GainNode.scala b/dom/src/main/scala/org/scalajs/dom/GainNode.scala index 2819398be..adeb38d9e 100644 --- a/dom/src/main/scala/org/scalajs/dom/GainNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNode.scala @@ -32,6 +32,9 @@ trait GainNode extends AudioNode { object GainNode { - def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions] = js.undefined): GainNode = + import js.`|`.undefOr2jsAny + + def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions] = js.undefined): GainNode = { js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode] + } } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala index b25fb8f60..5604e4029 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala @@ -6,7 +6,6 @@ package org.scalajs.dom import scala.scalajs.js -import scala.scalajs.js.annotation._ /** The MediaElementAudioSourceNode interface represents an audio source consisting of an HTML5 <audio> or * <video> element. It is an AudioNode that acts as an audio source. @@ -21,9 +20,19 @@ import scala.scalajs.js.annotation._ * - Channel count: defined by the media in the HTMLMediaElement passed to the AudioContext.createMediaElementSource * method that created it. */ -@JSGlobal @js.native -class MediaElementAudioSourceNode(context: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) - extends AudioNode { +trait MediaElementAudioSourceNode extends AudioNode { val mediaElement: HTMLMediaElement = js.native } + +object MediaElementAudioSourceNode { + + import js.`|`.undefOr2jsAny + + def apply(context: BaseAudioContext, + options: js.UndefOr[MediaElementAudioSourceNodeOptions] = js.undefined): MediaElementAudioSourceNode = { + js.Dynamic + .newInstance(js.Dynamic.global.MediaElementAudioSourceNode)(context, options) + .asInstanceOf[MediaElementAudioSourceNode] + } +} diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index 144d04924..46dc5e8e6 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -20,8 +20,7 @@ import scala.scalajs.js * - Channel interpretation: speakers */ @js.native -trait OscillatorNode - extends AudioScheduledSourceNode { +trait OscillatorNode extends AudioScheduledSourceNode { /** An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is * read-only, the value it represents is not.) @@ -45,6 +44,9 @@ trait OscillatorNode } object OscillatorNode { + + import js.`|`.undefOr2jsAny + def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions] = js.undefined): OscillatorNode = js.Dynamic.newInstance(js.Dynamic.global.OscillatorNode)(context, options).asInstanceOf[OscillatorNode] } From 9887ce03c28ace679bf9ed9685f9aeafadef1c27 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sun, 24 Sep 2023 18:39:37 +0100 Subject: [PATCH 07/42] Check-in API report --- api-reports/2_12.txt | 218 +++++++++++++++++++++++++++++++++---------- api-reports/2_13.txt | 218 +++++++++++++++++++++++++++++++++---------- 2 files changed, 334 insertions(+), 102 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 9d5cd5409..e90cd6118 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -81,8 +81,8 @@ Algorithm[JT] val name: String AnalyserNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AnalyserNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AnalyserNode[JT] var channelCount: Int -AnalyserNode[JT] var channelCountMode: Int -AnalyserNode[JT] var channelInterpretation: String +AnalyserNode[JT] var channelCountMode: AudioNodeChannelCountMode +AnalyserNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AnalyserNode[JT] def connect(audioNode: AudioNode): Unit AnalyserNode[JT] def connect(audioParam: AudioParam): Unit AnalyserNode[JT] val context: AudioContext @@ -425,8 +425,8 @@ AudioBufferSourceNode[JT] def addEventListener[T <: Event](`type`: String, liste AudioBufferSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioBufferSourceNode[JT] var buffer: AudioBuffer AudioBufferSourceNode[JT] var channelCount: Int -AudioBufferSourceNode[JT] var channelCountMode: Int -AudioBufferSourceNode[JT] var channelInterpretation: String +AudioBufferSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioBufferSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioBufferSourceNode[JT] def connect(audioNode: AudioNode): Unit AudioBufferSourceNode[JT] def connect(audioParam: AudioParam): Unit AudioBufferSourceNode[JT] val context: AudioContext @@ -441,10 +441,25 @@ AudioBufferSourceNode[JT] var onended: js.Function1[Event, _] AudioBufferSourceNode[JT] val playbackRate: AudioParam AudioBufferSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioBufferSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioBufferSourceNode[JT] def start(when: Double?, offset: Double?, duration: Double?): Unit -AudioBufferSourceNode[JT] def stop(when: Double?): Unit +AudioBufferSourceNode[JT] def start(): Unit +AudioBufferSourceNode[JT] def start(when: Double): Unit +AudioBufferSourceNode[JT] def start(when: Double, offset: Double): Unit +AudioBufferSourceNode[JT] def start(when: Double, offset: Double, duration: Double): Unit +AudioBufferSourceNode[JT] def stop(): Unit +AudioBufferSourceNode[JT] def stop(when: Double): Unit +AudioBufferSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[AudioBufferSourceNodeOptions]?): AudioBufferSourceNode +AudioBufferSourceNodeOptions[JT] var buffer: js.UndefOr[AudioBuffer] +AudioBufferSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] +AudioBufferSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +AudioBufferSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +AudioBufferSourceNodeOptions[JT] var detune: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var loop: js.UndefOr[Boolean] +AudioBufferSourceNodeOptions[JT] var loopEnd: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var loopStart: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var playbackRate: js.UndefOr[Double] AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioContext[JC] def baseLatency: Double AudioContext[JC] def close(): js.Promise[Unit] AudioContext[JC] def createAnalyser(): AnalyserNode AudioContext[JC] def createBiquadFilter(): BiquadFilterNode @@ -468,7 +483,9 @@ AudioContext[JC] def currentTime: Double AudioContext[JC] def decodeAudioData(audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _]?, errorCallback: js.Function0[_]?): js.Promise[AudioBuffer] AudioContext[JC] val destination: AudioDestinationNode AudioContext[JC] def dispatchEvent(evt: Event): Boolean +AudioContext[JC] def getOutputTimestamp: AudioTimestamp AudioContext[JC] val listener: AudioListener +AudioContext[JC] def outputLatency: Double AudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioContext[JC] def resume(): js.Promise[Unit] @@ -478,8 +495,8 @@ AudioContext[JC] def suspend(): js.Promise[Unit] AudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioDestinationNode[JT] var channelCount: Int -AudioDestinationNode[JT] var channelCountMode: Int -AudioDestinationNode[JT] var channelInterpretation: String +AudioDestinationNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioDestinationNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioDestinationNode[JT] def connect(audioNode: AudioNode): Unit AudioDestinationNode[JT] def connect(audioParam: AudioParam): Unit AudioDestinationNode[JT] val context: AudioContext @@ -493,8 +510,8 @@ AudioDestinationNode[JT] def removeEventListener[T <: Event](`type`: String, lis AudioListener[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioListener[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioListener[JT] var channelCount: Int -AudioListener[JT] var channelCountMode: Int -AudioListener[JT] var channelInterpretation: String +AudioListener[JT] var channelCountMode: AudioNodeChannelCountMode +AudioListener[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioListener[JT] def connect(audioNode: AudioNode): Unit AudioListener[JT] def connect(audioParam: AudioParam): Unit AudioListener[JT] val context: AudioContext @@ -511,8 +528,8 @@ AudioListener[JT] var speedOfSound: Double AudioNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioNode[JT] var channelCount: Int -AudioNode[JT] var channelCountMode: Int -AudioNode[JT] var channelInterpretation: String +AudioNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioNode[JT] def connect(audioNode: AudioNode): Unit AudioNode[JT] def connect(audioParam: AudioParam): Unit AudioNode[JT] val context: AudioContext @@ -522,12 +539,19 @@ AudioNode[JT] val numberOfInputs: Int AudioNode[JT] val numberOfOutputs: Int AudioNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioNodeChannelCountMode[JT] +AudioNodeChannelCountMode[SO] val `clamped-max`: AudioNodeChannelCountMode +AudioNodeChannelCountMode[SO] val explicit: AudioNodeChannelCountMode +AudioNodeChannelCountMode[SO] val max: AudioNodeChannelCountMode +AudioNodeChannelInterpretation[JT] +AudioNodeChannelInterpretation[SO] val discrete: AudioNodeChannelInterpretation +AudioNodeChannelInterpretation[SO] val speakers: AudioNodeChannelInterpretation AudioParam[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioParam[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioParam[JT] def cancelScheduledValues(startTime: Double): Unit AudioParam[JT] var channelCount: Int -AudioParam[JT] var channelCountMode: Int -AudioParam[JT] var channelInterpretation: String +AudioParam[JT] var channelCountMode: AudioNodeChannelCountMode +AudioParam[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioParam[JT] def connect(audioNode: AudioNode): Unit AudioParam[JT] def connect(audioParam: AudioParam): Unit AudioParam[JT] val context: AudioContext @@ -536,6 +560,8 @@ AudioParam[JT] def disconnect(output: AudioNode?): Unit AudioParam[JT] def dispatchEvent(evt: Event): Boolean AudioParam[JT] def exponentialRampToValueAtTime(value: Double, endTime: Double): Unit AudioParam[JT] def linearRampToValueAtTime(value: Double, endTime: Double): Unit +AudioParam[JT] val maxValue: Double +AudioParam[JT] val minValue: Double AudioParam[JT] val numberOfInputs: Int AudioParam[JT] val numberOfOutputs: Int AudioParam[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit @@ -544,6 +570,27 @@ AudioParam[JT] def setTargetAtTime(target: Double, startTime: Double, timeConsta AudioParam[JT] def setValueAtTime(value: Double, startTime: Double): Unit AudioParam[JT] def setValueCurveAtTime(values: js.typedarray.Float32Array, startTime: Double, duration: Double): Unit AudioParam[JT] var value: Double +AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JT] var channelCount: Int +AudioScheduledSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioScheduledSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation +AudioScheduledSourceNode[JT] def connect(audioNode: AudioNode): Unit +AudioScheduledSourceNode[JT] def connect(audioParam: AudioParam): Unit +AudioScheduledSourceNode[JT] val context: AudioContext +AudioScheduledSourceNode[JT] def disconnect(output: AudioNode?): Unit +AudioScheduledSourceNode[JT] def dispatchEvent(evt: Event): Boolean +AudioScheduledSourceNode[JT] val numberOfInputs: Int +AudioScheduledSourceNode[JT] val numberOfOutputs: Int +AudioScheduledSourceNode[JT] var onended: js.Function1[Event, _] +AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JT] def start(): Unit +AudioScheduledSourceNode[JT] def start(when: Double): Unit +AudioScheduledSourceNode[JT] def stop(): Unit +AudioScheduledSourceNode[JT] def stop(when: Double): Unit +AudioTimestamp[JT] var contextTime: Double +AudioTimestamp[JT] var performanceTime: Double AudioTrack[JT] var enabled: Boolean AudioTrack[JT] val id: String AudioTrack[JT] val kind: String @@ -560,6 +607,32 @@ AudioTrackList[JT] var onchange: js.Function1[Event, Any] AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] def createAnalyser(): AnalyserNode +BaseAudioContext[JT] def createBiquadFilter(): BiquadFilterNode +BaseAudioContext[JT] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer +BaseAudioContext[JT] def createBufferSource(): AudioBufferSourceNode +BaseAudioContext[JT] def createChannelMerger(numberOfInputs: Int?): ChannelMergerNode +BaseAudioContext[JT] def createChannelSplitter(numberOfOutputs: Int?): ChannelSplitterNode +BaseAudioContext[JT] def createConvolver(): ConvolverNode +BaseAudioContext[JT] def createDelay(maxDelayTime: Int): DelayNode +BaseAudioContext[JT] def createDynamicsCompressor(): DynamicsCompressorNode +BaseAudioContext[JT] def createGain(): GainNode +BaseAudioContext[JT] def createOscillator(): OscillatorNode +BaseAudioContext[JT] def createPanner(): PannerNode +BaseAudioContext[JT] def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave +BaseAudioContext[JT] def createStereoPanner(): StereoPannerNode +BaseAudioContext[JT] def createWaveShaper(): WaveShaperNode +BaseAudioContext[JT] def currentTime: Double +BaseAudioContext[JT] def decodeAudioData(audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _]?, errorCallback: js.Function0[_]?): js.Promise[AudioBuffer] +BaseAudioContext[JT] val destination: AudioDestinationNode +BaseAudioContext[JT] def dispatchEvent(evt: Event): Boolean +BaseAudioContext[JT] val listener: AudioListener +BaseAudioContext[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BaseAudioContext[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] val sampleRate: Double +BaseAudioContext[JT] def state: String BeforeUnloadEvent[JC] def bubbles: Boolean BeforeUnloadEvent[JC] def cancelBubble: Boolean BeforeUnloadEvent[JC] def cancelable: Boolean @@ -579,8 +652,8 @@ BiquadFilterNode[JT] val Q: AudioParam BiquadFilterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit BiquadFilterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit BiquadFilterNode[JT] var channelCount: Int -BiquadFilterNode[JT] var channelCountMode: Int -BiquadFilterNode[JT] var channelInterpretation: String +BiquadFilterNode[JT] var channelCountMode: AudioNodeChannelCountMode +BiquadFilterNode[JT] var channelInterpretation: AudioNodeChannelInterpretation BiquadFilterNode[JT] def connect(audioNode: AudioNode): Unit BiquadFilterNode[JT] def connect(audioParam: AudioParam): Unit BiquadFilterNode[JT] val context: AudioContext @@ -1138,8 +1211,8 @@ CanvasRenderingContext2D[JC] def translate(x: Double, y: Double): Unit ChannelMergerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ChannelMergerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ChannelMergerNode[JT] var channelCount: Int -ChannelMergerNode[JT] var channelCountMode: Int -ChannelMergerNode[JT] var channelInterpretation: String +ChannelMergerNode[JT] var channelCountMode: AudioNodeChannelCountMode +ChannelMergerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ChannelMergerNode[JT] def connect(audioNode: AudioNode): Unit ChannelMergerNode[JT] def connect(audioParam: AudioParam): Unit ChannelMergerNode[JT] val context: AudioContext @@ -1152,8 +1225,8 @@ ChannelMergerNode[JT] def removeEventListener[T <: Event](`type`: String, listen ChannelSplitterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ChannelSplitterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ChannelSplitterNode[JT] var channelCount: Int -ChannelSplitterNode[JT] var channelCountMode: Int -ChannelSplitterNode[JT] var channelInterpretation: String +ChannelSplitterNode[JT] var channelCountMode: AudioNodeChannelCountMode +ChannelSplitterNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ChannelSplitterNode[JT] def connect(audioNode: AudioNode): Unit ChannelSplitterNode[JT] def connect(audioParam: AudioParam): Unit ChannelSplitterNode[JT] val context: AudioContext @@ -1383,14 +1456,35 @@ Console[JT] def time(label: String): Unit Console[JT] def timeEnd(label: String): Unit Console[JT] def trace(): Unit Console[JT] def warn(message: Any, optionalParams: Any*): Unit +ConstantSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +ConstantSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +ConstantSourceNode[JC] var channelCount: Int +ConstantSourceNode[JC] var channelCountMode: AudioNodeChannelCountMode +ConstantSourceNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +ConstantSourceNode[JC] def connect(audioNode: AudioNode): Unit +ConstantSourceNode[JC] def connect(audioParam: AudioParam): Unit +ConstantSourceNode[JC] val context: AudioContext +ConstantSourceNode[JC] def disconnect(output: AudioNode?): Unit +ConstantSourceNode[JC] def dispatchEvent(evt: Event): Boolean +ConstantSourceNode[JC] val numberOfInputs: Int +ConstantSourceNode[JC] val numberOfOutputs: Int +ConstantSourceNode[JC] val offset: AudioParam +ConstantSourceNode[JC] var onended: js.Function1[Event, _] +ConstantSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +ConstantSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +ConstantSourceNode[JC] def start(): Unit +ConstantSourceNode[JC] def start(when: Double): Unit +ConstantSourceNode[JC] def stop(): Unit +ConstantSourceNode[JC] def stop(when: Double): Unit +ConstantSourceNodeOptions[JT] var offset: js.UndefOr[Double] ConvertToBlobOptions[JT] var quality: js.UndefOr[Double] ConvertToBlobOptions[JT] var `type`: js.UndefOr[String] ConvolverNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ConvolverNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ConvolverNode[JT] var buffer: AudioBuffer ConvolverNode[JT] var channelCount: Int -ConvolverNode[JT] var channelCountMode: Int -ConvolverNode[JT] var channelInterpretation: String +ConvolverNode[JT] var channelCountMode: AudioNodeChannelCountMode +ConvolverNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ConvolverNode[JT] def connect(audioNode: AudioNode): Unit ConvolverNode[JT] def connect(audioParam: AudioParam): Unit ConvolverNode[JT] val context: AudioContext @@ -1598,8 +1692,8 @@ DedicatedWorkerGlobalScope[JT] def setTimeout(handler: js.Function0[Any], timeou DelayNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit DelayNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit DelayNode[JT] var channelCount: Int -DelayNode[JT] var channelCountMode: Int -DelayNode[JT] var channelInterpretation: String +DelayNode[JT] var channelCountMode: AudioNodeChannelCountMode +DelayNode[JT] var channelInterpretation: AudioNodeChannelInterpretation DelayNode[JT] def connect(audioNode: AudioNode): Unit DelayNode[JT] def connect(audioParam: AudioParam): Unit DelayNode[JT] val context: AudioContext @@ -1924,8 +2018,8 @@ DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, list DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit DynamicsCompressorNode[JT] val attack: AudioParam DynamicsCompressorNode[JT] var channelCount: Int -DynamicsCompressorNode[JT] var channelCountMode: Int -DynamicsCompressorNode[JT] var channelInterpretation: String +DynamicsCompressorNode[JT] var channelCountMode: AudioNodeChannelCountMode +DynamicsCompressorNode[JT] var channelInterpretation: AudioNodeChannelInterpretation DynamicsCompressorNode[JT] def connect(audioNode: AudioNode): Unit DynamicsCompressorNode[JT] def connect(audioParam: AudioParam): Unit DynamicsCompressorNode[JT] val context: AudioContext @@ -2299,8 +2393,8 @@ FullscreenOptions[JT] var navigationUI: js.UndefOr[String] GainNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit GainNode[JT] var channelCount: Int -GainNode[JT] var channelCountMode: Int -GainNode[JT] var channelInterpretation: String +GainNode[JT] var channelCountMode: AudioNodeChannelCountMode +GainNode[JT] var channelInterpretation: AudioNodeChannelInterpretation GainNode[JT] def connect(audioNode: AudioNode): Unit GainNode[JT] def connect(audioParam: AudioParam): Unit GainNode[JT] val context: AudioContext @@ -2311,6 +2405,11 @@ GainNode[JT] val numberOfInputs: Int GainNode[JT] val numberOfOutputs: Int GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +GainNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions]?): GainNode +GainNodeOptions[JT] var channelCount: js.UndefOr[Int] +GainNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +GainNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +GainNodeOptions[JT] var gain: js.UndefOr[Double] Gamepad[JT] val axes: js.Array[Double] Gamepad[JT] val buttons: js.Array[GamepadButton] Gamepad[JT] val connected: Boolean @@ -16075,17 +16174,23 @@ MediaDevices[JT] def removeEventListener[T <: Event](`type`: String, listener: j MediaElementAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaElementAudioSourceNode[JT] var channelCount: Int -MediaElementAudioSourceNode[JT] var channelCountMode: Int -MediaElementAudioSourceNode[JT] var channelInterpretation: String +MediaElementAudioSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaElementAudioSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaElementAudioSourceNode[JT] def connect(audioNode: AudioNode): Unit MediaElementAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaElementAudioSourceNode[JT] val context: AudioContext MediaElementAudioSourceNode[JT] def disconnect(output: AudioNode?): Unit MediaElementAudioSourceNode[JT] def dispatchEvent(evt: Event): Boolean +MediaElementAudioSourceNode[JT] val mediaElement: HTMLMediaElement MediaElementAudioSourceNode[JT] val numberOfInputs: Int MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaElementAudioSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[MediaElementAudioSourceNodeOptions]?): MediaElementAudioSourceNode +MediaElementAudioSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] +MediaElementAudioSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +MediaElementAudioSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +MediaElementAudioSourceNodeOptions[JT] var mediaElement: HTMLMediaElement MediaError[JC] def code: Int MediaError[JO] val MEDIA_ERR_ABORTED: Int MediaError[JO] val MEDIA_ERR_DECODE: Int @@ -16149,8 +16254,8 @@ MediaStream[JC] def removeTrack(track: MediaStreamTrack): Unit MediaStreamAudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaStreamAudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaStreamAudioDestinationNode[JT] var channelCount: Int -MediaStreamAudioDestinationNode[JT] var channelCountMode: Int -MediaStreamAudioDestinationNode[JT] var channelInterpretation: String +MediaStreamAudioDestinationNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaStreamAudioDestinationNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaStreamAudioDestinationNode[JT] def connect(audioNode: AudioNode): Unit MediaStreamAudioDestinationNode[JT] def connect(audioParam: AudioParam): Unit MediaStreamAudioDestinationNode[JT] val context: AudioContext @@ -16164,8 +16269,8 @@ MediaStreamAudioDestinationNode[JT] var stream: MediaStream MediaStreamAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaStreamAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaStreamAudioSourceNode[JT] var channelCount: Int -MediaStreamAudioSourceNode[JT] var channelCountMode: Int -MediaStreamAudioSourceNode[JT] var channelInterpretation: String +MediaStreamAudioSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaStreamAudioSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaStreamAudioSourceNode[JT] def connect(audioNode: AudioNode): Unit MediaStreamAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaStreamAudioSourceNode[JT] val context: AudioContext @@ -16577,7 +16682,6 @@ OfflineAudioCompletionEvent[JT] def timeStamp: Double OfflineAudioCompletionEvent[JT] def `type`: String OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -OfflineAudioContext[JC] def close(): js.Promise[Unit] OfflineAudioContext[JC] def createAnalyser(): AnalyserNode OfflineAudioContext[JC] def createBiquadFilter(): BiquadFilterNode OfflineAudioContext[JC] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -16588,9 +16692,6 @@ OfflineAudioContext[JC] def createConvolver(): ConvolverNode OfflineAudioContext[JC] def createDelay(maxDelayTime: Int): DelayNode OfflineAudioContext[JC] def createDynamicsCompressor(): DynamicsCompressorNode OfflineAudioContext[JC] def createGain(): GainNode -OfflineAudioContext[JC] def createMediaElementSource(myMediaElement: HTMLMediaElement): MediaElementAudioSourceNode -OfflineAudioContext[JC] def createMediaStreamDestination(): MediaStreamAudioDestinationNode -OfflineAudioContext[JC] def createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode OfflineAudioContext[JC] def createOscillator(): OscillatorNode OfflineAudioContext[JC] def createPanner(): PannerNode OfflineAudioContext[JC] def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave @@ -16603,11 +16704,10 @@ OfflineAudioContext[JC] def dispatchEvent(evt: Event): Boolean OfflineAudioContext[JC] val listener: AudioListener OfflineAudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -OfflineAudioContext[JC] def resume(): js.Promise[Unit] OfflineAudioContext[JC] val sampleRate: Double OfflineAudioContext[JC] def startRendering(): js.Promise[AudioBuffer] OfflineAudioContext[JC] def state: String -OfflineAudioContext[JC] def suspend(): js.Promise[Unit] +OfflineAudioContext[JC] def suspend(suspendTime: Double): js.Promise[Unit] OffscreenCanvas[JC] def convertToBlob(options: ConvertToBlobOptions?): js.Promise[Blob] OffscreenCanvas[JC] def getContext(contextType: String): js.Dynamic OffscreenCanvas[JC] def getContext(contextType: String, contextAttributes: TwoDContextAttributes): js.Dynamic @@ -16616,8 +16716,8 @@ OffscreenCanvas[JC] def transferToImageBitmap(): ImageBitmap OscillatorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OscillatorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit OscillatorNode[JT] var channelCount: Int -OscillatorNode[JT] var channelCountMode: Int -OscillatorNode[JT] var channelInterpretation: String +OscillatorNode[JT] var channelCountMode: AudioNodeChannelCountMode +OscillatorNode[JT] var channelInterpretation: AudioNodeChannelInterpretation OscillatorNode[JT] def connect(audioNode: AudioNode): Unit OscillatorNode[JT] def connect(audioParam: AudioParam): Unit OscillatorNode[JT] val context: AudioContext @@ -16631,9 +16731,25 @@ OscillatorNode[JT] var onended: js.Function1[Event, _] OscillatorNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OscillatorNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit OscillatorNode[JT] def setPeriodicWave(wave: PeriodicWave): Unit -OscillatorNode[JT] def start(when: Double?): Unit -OscillatorNode[JT] def stop(when: Double?): Unit -OscillatorNode[JT] var `type`: String +OscillatorNode[JT] def start(): Unit +OscillatorNode[JT] def start(when: Double): Unit +OscillatorNode[JT] def stop(): Unit +OscillatorNode[JT] def stop(when: Double): Unit +OscillatorNode[JT] var `type`: OscillatorNodeType +OscillatorNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions]?): OscillatorNode +OscillatorNodeOptions[JT] var channelCount: js.UndefOr[Int] +OscillatorNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +OscillatorNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +OscillatorNodeOptions[JT] var detune: js.UndefOr[Double] +OscillatorNodeOptions[JT] var frequency: js.UndefOr[Double] +OscillatorNodeOptions[JT] var periodicWave: js.UndefOr[PeriodicWave] +OscillatorNodeOptions[JT] var `type`: js.UndefOr[OscillatorNodeType] +OscillatorNodeType[JT] +OscillatorNodeType[SO] val custom: OscillatorNodeType +OscillatorNodeType[SO] val sawtooth: OscillatorNodeType +OscillatorNodeType[SO] val sine: OscillatorNodeType +OscillatorNodeType[SO] val square: OscillatorNodeType +OscillatorNodeType[SO] val triangle: OscillatorNodeType PageTransitionEvent[JT] def bubbles: Boolean PageTransitionEvent[JT] def cancelBubble: Boolean PageTransitionEvent[JT] def cancelable: Boolean @@ -16655,8 +16771,8 @@ PageVisibility[JT] var visibilitychange: js.Function1[Event, _] PannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit PannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit PannerNode[JT] var channelCount: Int -PannerNode[JT] var channelCountMode: Int -PannerNode[JT] var channelInterpretation: String +PannerNode[JT] var channelCountMode: AudioNodeChannelCountMode +PannerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation PannerNode[JT] var coneInnerAngle: Double PannerNode[JT] var coneOuterAngle: Double PannerNode[JT] var coneOuterGain: Double @@ -25823,8 +25939,8 @@ StaticRangeInit[JT] val startOffset: Int StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit StereoPannerNode[JT] var channelCount: Int -StereoPannerNode[JT] var channelCountMode: Int -StereoPannerNode[JT] var channelInterpretation: String +StereoPannerNode[JT] var channelCountMode: AudioNodeChannelCountMode +StereoPannerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation StereoPannerNode[JT] def connect(audioNode: AudioNode): Unit StereoPannerNode[JT] def connect(audioParam: AudioParam): Unit StereoPannerNode[JT] val context: AudioContext @@ -26230,8 +26346,8 @@ VisibilityState[SO] val visible: VisibilityState WaveShaperNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit WaveShaperNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit WaveShaperNode[JT] var channelCount: Int -WaveShaperNode[JT] var channelCountMode: Int -WaveShaperNode[JT] var channelInterpretation: String +WaveShaperNode[JT] var channelCountMode: AudioNodeChannelCountMode +WaveShaperNode[JT] var channelInterpretation: AudioNodeChannelInterpretation WaveShaperNode[JT] def connect(audioNode: AudioNode): Unit WaveShaperNode[JT] def connect(audioParam: AudioParam): Unit WaveShaperNode[JT] val context: AudioContext diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 9d5cd5409..e90cd6118 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -81,8 +81,8 @@ Algorithm[JT] val name: String AnalyserNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AnalyserNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AnalyserNode[JT] var channelCount: Int -AnalyserNode[JT] var channelCountMode: Int -AnalyserNode[JT] var channelInterpretation: String +AnalyserNode[JT] var channelCountMode: AudioNodeChannelCountMode +AnalyserNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AnalyserNode[JT] def connect(audioNode: AudioNode): Unit AnalyserNode[JT] def connect(audioParam: AudioParam): Unit AnalyserNode[JT] val context: AudioContext @@ -425,8 +425,8 @@ AudioBufferSourceNode[JT] def addEventListener[T <: Event](`type`: String, liste AudioBufferSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioBufferSourceNode[JT] var buffer: AudioBuffer AudioBufferSourceNode[JT] var channelCount: Int -AudioBufferSourceNode[JT] var channelCountMode: Int -AudioBufferSourceNode[JT] var channelInterpretation: String +AudioBufferSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioBufferSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioBufferSourceNode[JT] def connect(audioNode: AudioNode): Unit AudioBufferSourceNode[JT] def connect(audioParam: AudioParam): Unit AudioBufferSourceNode[JT] val context: AudioContext @@ -441,10 +441,25 @@ AudioBufferSourceNode[JT] var onended: js.Function1[Event, _] AudioBufferSourceNode[JT] val playbackRate: AudioParam AudioBufferSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioBufferSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioBufferSourceNode[JT] def start(when: Double?, offset: Double?, duration: Double?): Unit -AudioBufferSourceNode[JT] def stop(when: Double?): Unit +AudioBufferSourceNode[JT] def start(): Unit +AudioBufferSourceNode[JT] def start(when: Double): Unit +AudioBufferSourceNode[JT] def start(when: Double, offset: Double): Unit +AudioBufferSourceNode[JT] def start(when: Double, offset: Double, duration: Double): Unit +AudioBufferSourceNode[JT] def stop(): Unit +AudioBufferSourceNode[JT] def stop(when: Double): Unit +AudioBufferSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[AudioBufferSourceNodeOptions]?): AudioBufferSourceNode +AudioBufferSourceNodeOptions[JT] var buffer: js.UndefOr[AudioBuffer] +AudioBufferSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] +AudioBufferSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +AudioBufferSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +AudioBufferSourceNodeOptions[JT] var detune: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var loop: js.UndefOr[Boolean] +AudioBufferSourceNodeOptions[JT] var loopEnd: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var loopStart: js.UndefOr[Double] +AudioBufferSourceNodeOptions[JT] var playbackRate: js.UndefOr[Double] AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioContext[JC] def baseLatency: Double AudioContext[JC] def close(): js.Promise[Unit] AudioContext[JC] def createAnalyser(): AnalyserNode AudioContext[JC] def createBiquadFilter(): BiquadFilterNode @@ -468,7 +483,9 @@ AudioContext[JC] def currentTime: Double AudioContext[JC] def decodeAudioData(audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _]?, errorCallback: js.Function0[_]?): js.Promise[AudioBuffer] AudioContext[JC] val destination: AudioDestinationNode AudioContext[JC] def dispatchEvent(evt: Event): Boolean +AudioContext[JC] def getOutputTimestamp: AudioTimestamp AudioContext[JC] val listener: AudioListener +AudioContext[JC] def outputLatency: Double AudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioContext[JC] def resume(): js.Promise[Unit] @@ -478,8 +495,8 @@ AudioContext[JC] def suspend(): js.Promise[Unit] AudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioDestinationNode[JT] var channelCount: Int -AudioDestinationNode[JT] var channelCountMode: Int -AudioDestinationNode[JT] var channelInterpretation: String +AudioDestinationNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioDestinationNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioDestinationNode[JT] def connect(audioNode: AudioNode): Unit AudioDestinationNode[JT] def connect(audioParam: AudioParam): Unit AudioDestinationNode[JT] val context: AudioContext @@ -493,8 +510,8 @@ AudioDestinationNode[JT] def removeEventListener[T <: Event](`type`: String, lis AudioListener[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioListener[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioListener[JT] var channelCount: Int -AudioListener[JT] var channelCountMode: Int -AudioListener[JT] var channelInterpretation: String +AudioListener[JT] var channelCountMode: AudioNodeChannelCountMode +AudioListener[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioListener[JT] def connect(audioNode: AudioNode): Unit AudioListener[JT] def connect(audioParam: AudioParam): Unit AudioListener[JT] val context: AudioContext @@ -511,8 +528,8 @@ AudioListener[JT] var speedOfSound: Double AudioNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioNode[JT] var channelCount: Int -AudioNode[JT] var channelCountMode: Int -AudioNode[JT] var channelInterpretation: String +AudioNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioNode[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioNode[JT] def connect(audioNode: AudioNode): Unit AudioNode[JT] def connect(audioParam: AudioParam): Unit AudioNode[JT] val context: AudioContext @@ -522,12 +539,19 @@ AudioNode[JT] val numberOfInputs: Int AudioNode[JT] val numberOfOutputs: Int AudioNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioNodeChannelCountMode[JT] +AudioNodeChannelCountMode[SO] val `clamped-max`: AudioNodeChannelCountMode +AudioNodeChannelCountMode[SO] val explicit: AudioNodeChannelCountMode +AudioNodeChannelCountMode[SO] val max: AudioNodeChannelCountMode +AudioNodeChannelInterpretation[JT] +AudioNodeChannelInterpretation[SO] val discrete: AudioNodeChannelInterpretation +AudioNodeChannelInterpretation[SO] val speakers: AudioNodeChannelInterpretation AudioParam[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioParam[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioParam[JT] def cancelScheduledValues(startTime: Double): Unit AudioParam[JT] var channelCount: Int -AudioParam[JT] var channelCountMode: Int -AudioParam[JT] var channelInterpretation: String +AudioParam[JT] var channelCountMode: AudioNodeChannelCountMode +AudioParam[JT] var channelInterpretation: AudioNodeChannelInterpretation AudioParam[JT] def connect(audioNode: AudioNode): Unit AudioParam[JT] def connect(audioParam: AudioParam): Unit AudioParam[JT] val context: AudioContext @@ -536,6 +560,8 @@ AudioParam[JT] def disconnect(output: AudioNode?): Unit AudioParam[JT] def dispatchEvent(evt: Event): Boolean AudioParam[JT] def exponentialRampToValueAtTime(value: Double, endTime: Double): Unit AudioParam[JT] def linearRampToValueAtTime(value: Double, endTime: Double): Unit +AudioParam[JT] val maxValue: Double +AudioParam[JT] val minValue: Double AudioParam[JT] val numberOfInputs: Int AudioParam[JT] val numberOfOutputs: Int AudioParam[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit @@ -544,6 +570,27 @@ AudioParam[JT] def setTargetAtTime(target: Double, startTime: Double, timeConsta AudioParam[JT] def setValueAtTime(value: Double, startTime: Double): Unit AudioParam[JT] def setValueCurveAtTime(values: js.typedarray.Float32Array, startTime: Double, duration: Double): Unit AudioParam[JT] var value: Double +AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JT] var channelCount: Int +AudioScheduledSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +AudioScheduledSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation +AudioScheduledSourceNode[JT] def connect(audioNode: AudioNode): Unit +AudioScheduledSourceNode[JT] def connect(audioParam: AudioParam): Unit +AudioScheduledSourceNode[JT] val context: AudioContext +AudioScheduledSourceNode[JT] def disconnect(output: AudioNode?): Unit +AudioScheduledSourceNode[JT] def dispatchEvent(evt: Event): Boolean +AudioScheduledSourceNode[JT] val numberOfInputs: Int +AudioScheduledSourceNode[JT] val numberOfOutputs: Int +AudioScheduledSourceNode[JT] var onended: js.Function1[Event, _] +AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JT] def start(): Unit +AudioScheduledSourceNode[JT] def start(when: Double): Unit +AudioScheduledSourceNode[JT] def stop(): Unit +AudioScheduledSourceNode[JT] def stop(when: Double): Unit +AudioTimestamp[JT] var contextTime: Double +AudioTimestamp[JT] var performanceTime: Double AudioTrack[JT] var enabled: Boolean AudioTrack[JT] val id: String AudioTrack[JT] val kind: String @@ -560,6 +607,32 @@ AudioTrackList[JT] var onchange: js.Function1[Event, Any] AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] def createAnalyser(): AnalyserNode +BaseAudioContext[JT] def createBiquadFilter(): BiquadFilterNode +BaseAudioContext[JT] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer +BaseAudioContext[JT] def createBufferSource(): AudioBufferSourceNode +BaseAudioContext[JT] def createChannelMerger(numberOfInputs: Int?): ChannelMergerNode +BaseAudioContext[JT] def createChannelSplitter(numberOfOutputs: Int?): ChannelSplitterNode +BaseAudioContext[JT] def createConvolver(): ConvolverNode +BaseAudioContext[JT] def createDelay(maxDelayTime: Int): DelayNode +BaseAudioContext[JT] def createDynamicsCompressor(): DynamicsCompressorNode +BaseAudioContext[JT] def createGain(): GainNode +BaseAudioContext[JT] def createOscillator(): OscillatorNode +BaseAudioContext[JT] def createPanner(): PannerNode +BaseAudioContext[JT] def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave +BaseAudioContext[JT] def createStereoPanner(): StereoPannerNode +BaseAudioContext[JT] def createWaveShaper(): WaveShaperNode +BaseAudioContext[JT] def currentTime: Double +BaseAudioContext[JT] def decodeAudioData(audioData: js.typedarray.ArrayBuffer, successCallback: js.Function1[AudioBuffer, _]?, errorCallback: js.Function0[_]?): js.Promise[AudioBuffer] +BaseAudioContext[JT] val destination: AudioDestinationNode +BaseAudioContext[JT] def dispatchEvent(evt: Event): Boolean +BaseAudioContext[JT] val listener: AudioListener +BaseAudioContext[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BaseAudioContext[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] val sampleRate: Double +BaseAudioContext[JT] def state: String BeforeUnloadEvent[JC] def bubbles: Boolean BeforeUnloadEvent[JC] def cancelBubble: Boolean BeforeUnloadEvent[JC] def cancelable: Boolean @@ -579,8 +652,8 @@ BiquadFilterNode[JT] val Q: AudioParam BiquadFilterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit BiquadFilterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit BiquadFilterNode[JT] var channelCount: Int -BiquadFilterNode[JT] var channelCountMode: Int -BiquadFilterNode[JT] var channelInterpretation: String +BiquadFilterNode[JT] var channelCountMode: AudioNodeChannelCountMode +BiquadFilterNode[JT] var channelInterpretation: AudioNodeChannelInterpretation BiquadFilterNode[JT] def connect(audioNode: AudioNode): Unit BiquadFilterNode[JT] def connect(audioParam: AudioParam): Unit BiquadFilterNode[JT] val context: AudioContext @@ -1138,8 +1211,8 @@ CanvasRenderingContext2D[JC] def translate(x: Double, y: Double): Unit ChannelMergerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ChannelMergerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ChannelMergerNode[JT] var channelCount: Int -ChannelMergerNode[JT] var channelCountMode: Int -ChannelMergerNode[JT] var channelInterpretation: String +ChannelMergerNode[JT] var channelCountMode: AudioNodeChannelCountMode +ChannelMergerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ChannelMergerNode[JT] def connect(audioNode: AudioNode): Unit ChannelMergerNode[JT] def connect(audioParam: AudioParam): Unit ChannelMergerNode[JT] val context: AudioContext @@ -1152,8 +1225,8 @@ ChannelMergerNode[JT] def removeEventListener[T <: Event](`type`: String, listen ChannelSplitterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ChannelSplitterNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ChannelSplitterNode[JT] var channelCount: Int -ChannelSplitterNode[JT] var channelCountMode: Int -ChannelSplitterNode[JT] var channelInterpretation: String +ChannelSplitterNode[JT] var channelCountMode: AudioNodeChannelCountMode +ChannelSplitterNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ChannelSplitterNode[JT] def connect(audioNode: AudioNode): Unit ChannelSplitterNode[JT] def connect(audioParam: AudioParam): Unit ChannelSplitterNode[JT] val context: AudioContext @@ -1383,14 +1456,35 @@ Console[JT] def time(label: String): Unit Console[JT] def timeEnd(label: String): Unit Console[JT] def trace(): Unit Console[JT] def warn(message: Any, optionalParams: Any*): Unit +ConstantSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +ConstantSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +ConstantSourceNode[JC] var channelCount: Int +ConstantSourceNode[JC] var channelCountMode: AudioNodeChannelCountMode +ConstantSourceNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +ConstantSourceNode[JC] def connect(audioNode: AudioNode): Unit +ConstantSourceNode[JC] def connect(audioParam: AudioParam): Unit +ConstantSourceNode[JC] val context: AudioContext +ConstantSourceNode[JC] def disconnect(output: AudioNode?): Unit +ConstantSourceNode[JC] def dispatchEvent(evt: Event): Boolean +ConstantSourceNode[JC] val numberOfInputs: Int +ConstantSourceNode[JC] val numberOfOutputs: Int +ConstantSourceNode[JC] val offset: AudioParam +ConstantSourceNode[JC] var onended: js.Function1[Event, _] +ConstantSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +ConstantSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +ConstantSourceNode[JC] def start(): Unit +ConstantSourceNode[JC] def start(when: Double): Unit +ConstantSourceNode[JC] def stop(): Unit +ConstantSourceNode[JC] def stop(when: Double): Unit +ConstantSourceNodeOptions[JT] var offset: js.UndefOr[Double] ConvertToBlobOptions[JT] var quality: js.UndefOr[Double] ConvertToBlobOptions[JT] var `type`: js.UndefOr[String] ConvolverNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit ConvolverNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit ConvolverNode[JT] var buffer: AudioBuffer ConvolverNode[JT] var channelCount: Int -ConvolverNode[JT] var channelCountMode: Int -ConvolverNode[JT] var channelInterpretation: String +ConvolverNode[JT] var channelCountMode: AudioNodeChannelCountMode +ConvolverNode[JT] var channelInterpretation: AudioNodeChannelInterpretation ConvolverNode[JT] def connect(audioNode: AudioNode): Unit ConvolverNode[JT] def connect(audioParam: AudioParam): Unit ConvolverNode[JT] val context: AudioContext @@ -1598,8 +1692,8 @@ DedicatedWorkerGlobalScope[JT] def setTimeout(handler: js.Function0[Any], timeou DelayNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit DelayNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit DelayNode[JT] var channelCount: Int -DelayNode[JT] var channelCountMode: Int -DelayNode[JT] var channelInterpretation: String +DelayNode[JT] var channelCountMode: AudioNodeChannelCountMode +DelayNode[JT] var channelInterpretation: AudioNodeChannelInterpretation DelayNode[JT] def connect(audioNode: AudioNode): Unit DelayNode[JT] def connect(audioParam: AudioParam): Unit DelayNode[JT] val context: AudioContext @@ -1924,8 +2018,8 @@ DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, list DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit DynamicsCompressorNode[JT] val attack: AudioParam DynamicsCompressorNode[JT] var channelCount: Int -DynamicsCompressorNode[JT] var channelCountMode: Int -DynamicsCompressorNode[JT] var channelInterpretation: String +DynamicsCompressorNode[JT] var channelCountMode: AudioNodeChannelCountMode +DynamicsCompressorNode[JT] var channelInterpretation: AudioNodeChannelInterpretation DynamicsCompressorNode[JT] def connect(audioNode: AudioNode): Unit DynamicsCompressorNode[JT] def connect(audioParam: AudioParam): Unit DynamicsCompressorNode[JT] val context: AudioContext @@ -2299,8 +2393,8 @@ FullscreenOptions[JT] var navigationUI: js.UndefOr[String] GainNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit GainNode[JT] var channelCount: Int -GainNode[JT] var channelCountMode: Int -GainNode[JT] var channelInterpretation: String +GainNode[JT] var channelCountMode: AudioNodeChannelCountMode +GainNode[JT] var channelInterpretation: AudioNodeChannelInterpretation GainNode[JT] def connect(audioNode: AudioNode): Unit GainNode[JT] def connect(audioParam: AudioParam): Unit GainNode[JT] val context: AudioContext @@ -2311,6 +2405,11 @@ GainNode[JT] val numberOfInputs: Int GainNode[JT] val numberOfOutputs: Int GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +GainNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions]?): GainNode +GainNodeOptions[JT] var channelCount: js.UndefOr[Int] +GainNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +GainNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +GainNodeOptions[JT] var gain: js.UndefOr[Double] Gamepad[JT] val axes: js.Array[Double] Gamepad[JT] val buttons: js.Array[GamepadButton] Gamepad[JT] val connected: Boolean @@ -16075,17 +16174,23 @@ MediaDevices[JT] def removeEventListener[T <: Event](`type`: String, listener: j MediaElementAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaElementAudioSourceNode[JT] var channelCount: Int -MediaElementAudioSourceNode[JT] var channelCountMode: Int -MediaElementAudioSourceNode[JT] var channelInterpretation: String +MediaElementAudioSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaElementAudioSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaElementAudioSourceNode[JT] def connect(audioNode: AudioNode): Unit MediaElementAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaElementAudioSourceNode[JT] val context: AudioContext MediaElementAudioSourceNode[JT] def disconnect(output: AudioNode?): Unit MediaElementAudioSourceNode[JT] def dispatchEvent(evt: Event): Boolean +MediaElementAudioSourceNode[JT] val mediaElement: HTMLMediaElement MediaElementAudioSourceNode[JT] val numberOfInputs: Int MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaElementAudioSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[MediaElementAudioSourceNodeOptions]?): MediaElementAudioSourceNode +MediaElementAudioSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] +MediaElementAudioSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +MediaElementAudioSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +MediaElementAudioSourceNodeOptions[JT] var mediaElement: HTMLMediaElement MediaError[JC] def code: Int MediaError[JO] val MEDIA_ERR_ABORTED: Int MediaError[JO] val MEDIA_ERR_DECODE: Int @@ -16149,8 +16254,8 @@ MediaStream[JC] def removeTrack(track: MediaStreamTrack): Unit MediaStreamAudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaStreamAudioDestinationNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaStreamAudioDestinationNode[JT] var channelCount: Int -MediaStreamAudioDestinationNode[JT] var channelCountMode: Int -MediaStreamAudioDestinationNode[JT] var channelInterpretation: String +MediaStreamAudioDestinationNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaStreamAudioDestinationNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaStreamAudioDestinationNode[JT] def connect(audioNode: AudioNode): Unit MediaStreamAudioDestinationNode[JT] def connect(audioParam: AudioParam): Unit MediaStreamAudioDestinationNode[JT] val context: AudioContext @@ -16164,8 +16269,8 @@ MediaStreamAudioDestinationNode[JT] var stream: MediaStream MediaStreamAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaStreamAudioSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaStreamAudioSourceNode[JT] var channelCount: Int -MediaStreamAudioSourceNode[JT] var channelCountMode: Int -MediaStreamAudioSourceNode[JT] var channelInterpretation: String +MediaStreamAudioSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode +MediaStreamAudioSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation MediaStreamAudioSourceNode[JT] def connect(audioNode: AudioNode): Unit MediaStreamAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaStreamAudioSourceNode[JT] val context: AudioContext @@ -16577,7 +16682,6 @@ OfflineAudioCompletionEvent[JT] def timeStamp: Double OfflineAudioCompletionEvent[JT] def `type`: String OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -OfflineAudioContext[JC] def close(): js.Promise[Unit] OfflineAudioContext[JC] def createAnalyser(): AnalyserNode OfflineAudioContext[JC] def createBiquadFilter(): BiquadFilterNode OfflineAudioContext[JC] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -16588,9 +16692,6 @@ OfflineAudioContext[JC] def createConvolver(): ConvolverNode OfflineAudioContext[JC] def createDelay(maxDelayTime: Int): DelayNode OfflineAudioContext[JC] def createDynamicsCompressor(): DynamicsCompressorNode OfflineAudioContext[JC] def createGain(): GainNode -OfflineAudioContext[JC] def createMediaElementSource(myMediaElement: HTMLMediaElement): MediaElementAudioSourceNode -OfflineAudioContext[JC] def createMediaStreamDestination(): MediaStreamAudioDestinationNode -OfflineAudioContext[JC] def createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode OfflineAudioContext[JC] def createOscillator(): OscillatorNode OfflineAudioContext[JC] def createPanner(): PannerNode OfflineAudioContext[JC] def createPeriodicWave(real: js.typedarray.Float32Array, imag: js.typedarray.Float32Array): PeriodicWave @@ -16603,11 +16704,10 @@ OfflineAudioContext[JC] def dispatchEvent(evt: Event): Boolean OfflineAudioContext[JC] val listener: AudioListener OfflineAudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -OfflineAudioContext[JC] def resume(): js.Promise[Unit] OfflineAudioContext[JC] val sampleRate: Double OfflineAudioContext[JC] def startRendering(): js.Promise[AudioBuffer] OfflineAudioContext[JC] def state: String -OfflineAudioContext[JC] def suspend(): js.Promise[Unit] +OfflineAudioContext[JC] def suspend(suspendTime: Double): js.Promise[Unit] OffscreenCanvas[JC] def convertToBlob(options: ConvertToBlobOptions?): js.Promise[Blob] OffscreenCanvas[JC] def getContext(contextType: String): js.Dynamic OffscreenCanvas[JC] def getContext(contextType: String, contextAttributes: TwoDContextAttributes): js.Dynamic @@ -16616,8 +16716,8 @@ OffscreenCanvas[JC] def transferToImageBitmap(): ImageBitmap OscillatorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OscillatorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit OscillatorNode[JT] var channelCount: Int -OscillatorNode[JT] var channelCountMode: Int -OscillatorNode[JT] var channelInterpretation: String +OscillatorNode[JT] var channelCountMode: AudioNodeChannelCountMode +OscillatorNode[JT] var channelInterpretation: AudioNodeChannelInterpretation OscillatorNode[JT] def connect(audioNode: AudioNode): Unit OscillatorNode[JT] def connect(audioParam: AudioParam): Unit OscillatorNode[JT] val context: AudioContext @@ -16631,9 +16731,25 @@ OscillatorNode[JT] var onended: js.Function1[Event, _] OscillatorNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OscillatorNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit OscillatorNode[JT] def setPeriodicWave(wave: PeriodicWave): Unit -OscillatorNode[JT] def start(when: Double?): Unit -OscillatorNode[JT] def stop(when: Double?): Unit -OscillatorNode[JT] var `type`: String +OscillatorNode[JT] def start(): Unit +OscillatorNode[JT] def start(when: Double): Unit +OscillatorNode[JT] def stop(): Unit +OscillatorNode[JT] def stop(when: Double): Unit +OscillatorNode[JT] var `type`: OscillatorNodeType +OscillatorNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions]?): OscillatorNode +OscillatorNodeOptions[JT] var channelCount: js.UndefOr[Int] +OscillatorNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] +OscillatorNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] +OscillatorNodeOptions[JT] var detune: js.UndefOr[Double] +OscillatorNodeOptions[JT] var frequency: js.UndefOr[Double] +OscillatorNodeOptions[JT] var periodicWave: js.UndefOr[PeriodicWave] +OscillatorNodeOptions[JT] var `type`: js.UndefOr[OscillatorNodeType] +OscillatorNodeType[JT] +OscillatorNodeType[SO] val custom: OscillatorNodeType +OscillatorNodeType[SO] val sawtooth: OscillatorNodeType +OscillatorNodeType[SO] val sine: OscillatorNodeType +OscillatorNodeType[SO] val square: OscillatorNodeType +OscillatorNodeType[SO] val triangle: OscillatorNodeType PageTransitionEvent[JT] def bubbles: Boolean PageTransitionEvent[JT] def cancelBubble: Boolean PageTransitionEvent[JT] def cancelable: Boolean @@ -16655,8 +16771,8 @@ PageVisibility[JT] var visibilitychange: js.Function1[Event, _] PannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit PannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit PannerNode[JT] var channelCount: Int -PannerNode[JT] var channelCountMode: Int -PannerNode[JT] var channelInterpretation: String +PannerNode[JT] var channelCountMode: AudioNodeChannelCountMode +PannerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation PannerNode[JT] var coneInnerAngle: Double PannerNode[JT] var coneOuterAngle: Double PannerNode[JT] var coneOuterGain: Double @@ -25823,8 +25939,8 @@ StaticRangeInit[JT] val startOffset: Int StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit StereoPannerNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit StereoPannerNode[JT] var channelCount: Int -StereoPannerNode[JT] var channelCountMode: Int -StereoPannerNode[JT] var channelInterpretation: String +StereoPannerNode[JT] var channelCountMode: AudioNodeChannelCountMode +StereoPannerNode[JT] var channelInterpretation: AudioNodeChannelInterpretation StereoPannerNode[JT] def connect(audioNode: AudioNode): Unit StereoPannerNode[JT] def connect(audioParam: AudioParam): Unit StereoPannerNode[JT] val context: AudioContext @@ -26230,8 +26346,8 @@ VisibilityState[SO] val visible: VisibilityState WaveShaperNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit WaveShaperNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit WaveShaperNode[JT] var channelCount: Int -WaveShaperNode[JT] var channelCountMode: Int -WaveShaperNode[JT] var channelInterpretation: String +WaveShaperNode[JT] var channelCountMode: AudioNodeChannelCountMode +WaveShaperNode[JT] var channelInterpretation: AudioNodeChannelInterpretation WaveShaperNode[JT] def connect(audioNode: AudioNode): Unit WaveShaperNode[JT] def connect(audioParam: AudioParam): Unit WaveShaperNode[JT] val context: AudioContext From 081534dd2fe311b4da38be02cedec6074dd53a9b Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 8 Oct 2023 15:50:44 +0100 Subject: [PATCH 08/42] BlobEvent and MediaRecorder. --- .../main/scala/org/scalajs/dom/BlobEvent.scala | 11 +++++++++++ .../scala/org/scalajs/dom/MediaRecorder.scala | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 dom/src/main/scala/org/scalajs/dom/BlobEvent.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala new file mode 100644 index 000000000..3095e92c0 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala @@ -0,0 +1,11 @@ +package org.scalajs.dom + +import scala.scalajs.js + +/** The AnimationEvent interface represents events providing information related to animations. */ +@js.native +trait BlobEvent extends Event { + + def data: Blob = js.native + +} diff --git a/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala b/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala new file mode 100644 index 000000000..5f7ce1c43 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala @@ -0,0 +1,18 @@ +/** https://www.w3.org/TR/2016/CR-mediacapture-streams-20160519/ */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@js.native +@JSGlobal +class MediaRecorder(stream: MediaStream) extends EventTarget { + var ondataavailable: js.Function1[Event, Any] = js.native + var onerror: js.Function1[Event, Any] = js.native + var onstop: js.Function1[Event, Any] = js.native + + def resume(): Unit = js.native + def start(): Unit = js.native + def stop(): Unit = js.native + +} From fca67132987cd2238de227e001ec0fec397724ac Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sun, 8 Oct 2023 16:06:58 +0100 Subject: [PATCH 09/42] Make sure `BlobEvent` is class. --- dom/src/main/scala/org/scalajs/dom/BlobEvent.scala | 13 +++++++++++-- .../main/scala/org/scalajs/dom/BlobEventInit.scala | 8 ++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala index 3095e92c0..bbe42c59e 100644 --- a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala +++ b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala @@ -1,11 +1,20 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ /** The AnimationEvent interface represents events providing information related to animations. */ +@JSGlobal @js.native -trait BlobEvent extends Event { +class BlobEvent(typeArg: String, init: js.UndefOr[BlobEventInit]) extends Event(typeArg, init) { - def data: Blob = js.native + def this(typeArg: String) = { + this(typeArg, js.undefined) + } + def this() = { + this("dataavailable", js.undefined) + } + + val data: Blob = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala new file mode 100644 index 000000000..a8d3bba3f --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala @@ -0,0 +1,8 @@ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +trait BlobEventInit extends EventInit { + var data: js.UndefOr[Blob] +} From 4dda4bf40aef8ee43b3744cea9060699279b1041 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Sun, 8 Oct 2023 16:20:58 +0100 Subject: [PATCH 10/42] `data` is required. --- dom/src/main/scala/org/scalajs/dom/BlobEvent.scala | 12 ++++-------- .../main/scala/org/scalajs/dom/BlobEventInit.scala | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala index bbe42c59e..1a2fb89cf 100644 --- a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala +++ b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala @@ -6,15 +6,11 @@ import scala.scalajs.js.annotation._ /** The AnimationEvent interface represents events providing information related to animations. */ @JSGlobal @js.native -class BlobEvent(typeArg: String, init: js.UndefOr[BlobEventInit]) extends Event(typeArg, init) { +class BlobEvent(typeArg: String, init: BlobEventInit) extends Event(typeArg, init) { - def this(typeArg: String) = { - this(typeArg, js.undefined) + def this(init: BlobEventInit) = { + this("dataavailable", init) } - def this() = { - this("dataavailable", js.undefined) - } - - val data: Blob = js.native + def data: Blob = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala index a8d3bba3f..8172e518e 100644 --- a/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala +++ b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala @@ -4,5 +4,5 @@ import scala.scalajs.js @js.native trait BlobEventInit extends EventInit { - var data: js.UndefOr[Blob] + var data: Blob } From a4cfb9aee0d1af1357ca72cf6a76325cd1bf4668 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 13:37:25 +0000 Subject: [PATCH 11/42] Add `AudioWorkletNode` and associated options. --- .../org/scalajs/dom/AudioWorkletNode.scala | 17 ++++++++++++++ .../scalajs/dom/AudioWorkletNodeOptions.scala | 20 ++++++++++++++++ .../scalajs/dom/AudioWorkletProcessor.scala | 23 +++++++++++++++++++ .../dom/AudioWorkletProcessorOptions.scala | 21 +++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala new file mode 100644 index 000000000..e44e663e4 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -0,0 +1,17 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@JSGlobal +@js.native +abstract class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) extends AudioNode { + + def port: MessagePort +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala new file mode 100644 index 000000000..87776ee94 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala @@ -0,0 +1,20 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js + +trait AudioWorkletNodeOptions extends js.Any { + + /** The value to initialize the [[AudioNode#numberOfInputs]] property. Defaults to 1. */ + var numberOfInputs: js.UndefOr[Int] = js.undefined + /** The value to initialize the [[AudioNode#numberOfOutputs]] property. Defaults to 1. */ + var numberOfOutputs: js.UndefOr[Int] = js.undefined + var outputChannelCount: js.UndefOr[js.Array[Int]] = js.undefined + var parameterData: js.UndefOr[js.Object] = js.undefined + var processorOptions: js.UndefOr[js.Any] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala new file mode 100644 index 000000000..0909ccde0 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -0,0 +1,23 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@js.native +@JSGlobal +abstract class AudioWorkletProcessor(options: AudioWorkletProcessorOptions) extends js.Object { + + /** The [[MessagePort]] object that is connecting the [[AudioWorkletProcessor]] and the associated + * [[AudioWorkletNode]]. + */ + def port: MessagePort = js.native + + def process(inputs: js.typedarray.Float32Array, outputs: js.typedarray.Float32Array, parameters: js.Object): Boolean + +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala new file mode 100644 index 000000000..4bd919d9e --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala @@ -0,0 +1,21 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js + +trait AudioWorkletProcessorOptions extends js.Any { + + /** The value to initialize the [[AudioNode#numberOfInputs]] property. Defaults to 1. */ + var numberOfInputs: Int + + /** The value to initialize the [[AudioNode#numberOfOutputs]] property. Defaults to 1. */ + var numberOfOutputs: Int + var outputChannelCount: js.Array[Int] + var parameterData: js.UndefOr[js.Object] = js.undefined + var processorOptions: js.UndefOr[js.Any] = js.undefined +} From 0099ad3287625daef254f9eb68ffd7acc183c39f Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 14:12:44 +0000 Subject: [PATCH 12/42] Add `Worklet` and `AudioWorklet`. --- .../scala/org/scalajs/dom/AudioWorklet.scala | 15 +++++++++++++++ .../scala/org/scalajs/dom/AudioWorkletNode.scala | 5 +++-- .../scalajs/dom/AudioWorkletNodeOptions.scala | 1 + .../org/scalajs/dom/AudioWorkletProcessor.scala | 2 +- .../scala/org/scalajs/dom/BaseAudioContext.scala | 5 +++++ dom/src/main/scala/org/scalajs/dom/Worklet.scala | 16 ++++++++++++++++ .../scala/org/scalajs/dom/WorkletOptions.scala | 13 +++++++++++++ 7 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/Worklet.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala new file mode 100644 index 000000000..ebc351c46 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala @@ -0,0 +1,15 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@JSGlobal +@js.native +abstract class AudioWorklet extends Worklet { +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala index e44e663e4..45e8746cd 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -11,7 +11,8 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native -abstract class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) extends AudioNode { +abstract class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) + extends AudioNode { - def port: MessagePort + val port: MessagePort = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala index 87776ee94..d96fe5464 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala @@ -12,6 +12,7 @@ trait AudioWorkletNodeOptions extends js.Any { /** The value to initialize the [[AudioNode#numberOfInputs]] property. Defaults to 1. */ var numberOfInputs: js.UndefOr[Int] = js.undefined + /** The value to initialize the [[AudioNode#numberOfOutputs]] property. Defaults to 1. */ var numberOfOutputs: js.UndefOr[Int] = js.undefined var outputChannelCount: js.UndefOr[js.Array[Int]] = js.undefined diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala index 0909ccde0..aa6612f48 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -16,7 +16,7 @@ abstract class AudioWorkletProcessor(options: AudioWorkletProcessorOptions) exte /** The [[MessagePort]] object that is connecting the [[AudioWorkletProcessor]] and the associated * [[AudioWorkletNode]]. */ - def port: MessagePort = js.native + val port: MessagePort = js.native def process(inputs: js.typedarray.Float32Array, outputs: js.typedarray.Float32Array, parameters: js.Object): Boolean diff --git a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala index bc648984b..645724a09 100644 --- a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala @@ -34,6 +34,11 @@ trait BaseAudioContext extends EventTarget { */ val sampleRate: Double = js.native + /** Returns an instance of [[AudioWorklet]] that can be used for adding [[AudioWorketProcessor]]-derived classes which + * implement custom audio processing. + */ + val audioWorklet: AudioWorklet = js.native + /** Returns the current state of the AudioContext. */ def state: String = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/Worklet.scala b/dom/src/main/scala/org/scalajs/dom/Worklet.scala new file mode 100644 index 000000000..46c52e0d1 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/Worklet.scala @@ -0,0 +1,16 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@JSGlobal +@js.native +abstract class Worklet extends js.Object { + def addModule(moduleURL: String, options: WorkletOptions = js.native): js.Promise[Unit] = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala new file mode 100644 index 000000000..362b5c6d2 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala @@ -0,0 +1,13 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js + +trait WorkletOptions extends js.Any { + var credentials: js.UndefOr[RequestCredentials] = js.undefined +} From e8b3650e812f522de0dd2aa94c4705876e1a5750 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 15:48:44 +0000 Subject: [PATCH 13/42] Fix signature --- dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala | 3 +-- dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala | 3 ++- dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala index ebc351c46..1cbbd3ac0 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala @@ -11,5 +11,4 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native -abstract class AudioWorklet extends Worklet { -} +abstract class AudioWorklet extends Worklet {} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala index aa6612f48..abbd01a95 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -18,6 +18,7 @@ abstract class AudioWorkletProcessor(options: AudioWorkletProcessorOptions) exte */ val port: MessagePort = js.native - def process(inputs: js.typedarray.Float32Array, outputs: js.typedarray.Float32Array, parameters: js.Object): Boolean + def process(inputs: js.Array[js.typedarray.Float32Array], outputs: js.Array[js.typedarray.Float32Array], + parameters: js.Object): Boolean } diff --git a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala index 645724a09..f3de877bb 100644 --- a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala @@ -34,7 +34,7 @@ trait BaseAudioContext extends EventTarget { */ val sampleRate: Double = js.native - /** Returns an instance of [[AudioWorklet]] that can be used for adding [[AudioWorketProcessor]]-derived classes which + /** Returns an instance of [[AudioWorklet]] that can be used for adding [[AudioWorkletProcessor]]-derived classes which * implement custom audio processing. */ val audioWorklet: AudioWorklet = js.native From 11789350a46c643937f1e4931a9cc91bec038ad8 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 16:00:05 +0000 Subject: [PATCH 14/42] Add `AudioParamDescriptor`. --- .../dom/AudioParamAutomationRate.scala | 21 +++++++++++++++++++ .../scalajs/dom/AudioParamDescriptor.scala | 21 +++++++++++++++++++ .../org/scalajs/dom/BaseAudioContext.scala | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala new file mode 100644 index 000000000..7139b0de4 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala @@ -0,0 +1,21 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +sealed trait AudioParamAutomationRate extends js.Any + +object AudioParamAutomationRate { + + /** An a-rate [[AudioParam]] takes the current audio parameter value for each sample frame of the audio signal. */ + val `a-rate`: AudioParamAutomationRate = "a-rate".asInstanceOf[AudioParamAutomationRate] + + /** A k-rate [[AudioParam]] uses the same initial audio parameter value for the whole block processed; that is, 128 + * sample frames. In other words, the same value applies to every frame in the audio as it's processed by the node. + */ + val `k-rate`: AudioParamAutomationRate = "k-rate".asInstanceOf[AudioParamAutomationRate] +} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala new file mode 100644 index 000000000..4de2ce90d --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala @@ -0,0 +1,21 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js + +trait AudioParamDescriptor extends js.Any { + + /** The string which represents the name of the [[AudioParam]]. Under this name the [[AudioParam]] will be available + * in the parameters property of the node, and under this name the [[AudioWorkletProcessor#process]] method will + * acquire the calculated values of this [[AudioParam]]. + */ + var name: String + var minValue: js.UndefOr[Double] = js.undefined + var maxValue: js.UndefOr[Double] = js.undefined + var automationRate: js.UndefOr[AudioParamAutomationRate] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala index f3de877bb..e9ce9114f 100644 --- a/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala @@ -34,8 +34,8 @@ trait BaseAudioContext extends EventTarget { */ val sampleRate: Double = js.native - /** Returns an instance of [[AudioWorklet]] that can be used for adding [[AudioWorkletProcessor]]-derived classes which - * implement custom audio processing. + /** Returns an instance of [[AudioWorklet]] that can be used for adding [[AudioWorkletProcessor]]-derived classes + * which implement custom audio processing. */ val audioWorklet: AudioWorklet = js.native From fdb9aad58ceb74d83692baf92c69e63c164b778c Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 16:01:04 +0000 Subject: [PATCH 15/42] Add `defaultValue` for `AudioParamDescriptor`. --- dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala index 4de2ce90d..cd0057d1e 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala @@ -17,5 +17,6 @@ trait AudioParamDescriptor extends js.Any { var name: String var minValue: js.UndefOr[Double] = js.undefined var maxValue: js.UndefOr[Double] = js.undefined + var defaultValue: js.UndefOr[Double] = js.undefined var automationRate: js.UndefOr[AudioParamAutomationRate] = js.undefined } From c067de20153c970ba64d283c3c4947c281fc284b Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 16:04:00 +0000 Subject: [PATCH 16/42] Make sure to extend `js.Object`. --- dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala | 2 +- .../main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala | 2 +- .../scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala index cd0057d1e..af046ed7e 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala @@ -8,7 +8,7 @@ package org.scalajs.dom import scala.scalajs.js -trait AudioParamDescriptor extends js.Any { +trait AudioParamDescriptor extends js.Object { /** The string which represents the name of the [[AudioParam]]. Under this name the [[AudioParam]] will be available * in the parameters property of the node, and under this name the [[AudioWorkletProcessor#process]] method will diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala index d96fe5464..47d62641b 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala @@ -8,7 +8,7 @@ package org.scalajs.dom import scala.scalajs.js -trait AudioWorkletNodeOptions extends js.Any { +trait AudioWorkletNodeOptions extends js.Object { /** The value to initialize the [[AudioNode#numberOfInputs]] property. Defaults to 1. */ var numberOfInputs: js.UndefOr[Int] = js.undefined diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala index 4bd919d9e..eb9bae26b 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala @@ -8,7 +8,7 @@ package org.scalajs.dom import scala.scalajs.js -trait AudioWorkletProcessorOptions extends js.Any { +trait AudioWorkletProcessorOptions extends js.Object { /** The value to initialize the [[AudioNode#numberOfInputs]] property. Defaults to 1. */ var numberOfInputs: Int From ba8f6194b47c562aa592fff103beb53c90bacd41 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Wed, 15 Nov 2023 20:20:40 +0000 Subject: [PATCH 17/42] Add `AudioWorkletGlobalScope`. --- .../scalajs/dom/AudioWorkletGlobalScope.scala | 28 +++++++++++++++++++ .../org/scalajs/dom/WorkletGlobalScope.scala | 13 +++++++++ 2 files changed, 41 insertions(+) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala new file mode 100644 index 000000000..809dee09b --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -0,0 +1,28 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@js.native +trait AudioWorkletGlobalScope extends WorkletGlobalScope { + + def currentFrame: Int + + def currentTime: Double + + def sampleRate: Float + + def registerProcessor(name: String, processorCtor: js.Dynamic): Unit = js.native +} + +@js.native +@JSGlobalScope +object AudioWorkletGlobalScope extends js.Object { + def self: AudioWorkletGlobalScope = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala new file mode 100644 index 000000000..a09091b77 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala @@ -0,0 +1,13 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +trait WorkletGlobalScope extends js.Object { +} From 3e32f25dd24537158c16498df29ac8af758afc78 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Thu, 16 Nov 2023 14:54:59 +0000 Subject: [PATCH 18/42] `AudioWorkletNode` should not be abstract. --- .../scala/org/scalajs/dom/AudioParamMap.scala | 14 ++++++++++ .../org/scalajs/dom/AudioWorkletNode.scala | 2 +- .../org/scalajs/dom/RTCStatsReport.scala | 4 +-- .../org/scalajs/dom/ReadOnlyMapLike.scala | 27 +++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala create mode 100644 dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala new file mode 100644 index 000000000..3ccdeb24e --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala @@ -0,0 +1,14 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@JSGlobal +@js.native +class AudioParamMap extends ReadOnlyMapLike[String, AudioParam] { } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala index 45e8746cd..120e167f6 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -11,7 +11,7 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native -abstract class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) +class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) extends AudioNode { val port: MessagePort = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala b/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala index 0d5c65884..984837291 100644 --- a/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala +++ b/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala @@ -5,6 +5,4 @@ import scala.scalajs.js //https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCStatsReport @js.native -trait RTCStatsReport extends js.Object { - def apply(id: String): RTCStats = js.native -} +trait RTCStatsReport extends ReadOnlyMapLike[String, RTCStats] { } diff --git a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala new file mode 100644 index 000000000..d2fcd2eb0 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala @@ -0,0 +1,27 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ + +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +@js.native +trait ReadOnlyMapLike[K, V] extends js.Object { + + @JSBracketAccess + def apply(index: K): V = js.native + + /** Returns a boolean indicating whether a value has been associated with the passed key in the Map object or not. */ + def has(key: K): Boolean = js.native + + def forEach(callbackFn: js.Function2[K, V, Unit]): Unit = js.native + + def size: Int = js.native + + def keys(): js.Iterator[K] = js.native + +} From 42275a78f2015c564a077e3950fd697d92bc4e41 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Thu, 16 Nov 2023 15:03:31 +0000 Subject: [PATCH 19/42] Make `ReadOnlyMapLike` extend `js.Iterable`. --- dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala index d2fcd2eb0..c238c9a03 100644 --- a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala +++ b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala @@ -10,7 +10,7 @@ import scala.scalajs.js import scala.scalajs.js.annotation._ @js.native -trait ReadOnlyMapLike[K, V] extends js.Object { +trait ReadOnlyMapLike[K, V] extends js.Iterable[js.Tuple2[K, V]] { @JSBracketAccess def apply(index: K): V = js.native @@ -24,4 +24,11 @@ trait ReadOnlyMapLike[K, V] extends js.Object { def keys(): js.Iterator[K] = js.native + def entries(): js.Iterator[js.Tuple2[K, V]] = js.native + + def values(): js.Iterator[V] = js.native + + @JSName(js.Symbol.iterator) + override def jsIterator(): js.Iterator[js.Tuple2[K, V]] = js.native + } From 0e908000a4f8c0ed7242a8749b511c64c7bb9703 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Thu, 16 Nov 2023 16:31:38 +0000 Subject: [PATCH 20/42] `self` does not yet exist within the `Worklet` contexts. --- .../main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala index 809dee09b..5643cdd0c 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -24,5 +24,6 @@ trait AudioWorkletGlobalScope extends WorkletGlobalScope { @js.native @JSGlobalScope object AudioWorkletGlobalScope extends js.Object { - def self: AudioWorkletGlobalScope = js.native + /** See issue https://github.com/whatwg/html/issues/6059 */ + def globalThis: AudioWorkletGlobalScope = js.native } From f860eaae95e6a3bfaa832a8ca010146816b25202 Mon Sep 17 00:00:00 2001 From: Yilin Wei Date: Thu, 16 Nov 2023 19:56:22 +0000 Subject: [PATCH 21/42] Correct `ReadOnlyMapLike` signature `forEach`. --- .../main/scala/org/scalajs/dom/AudioParamMap.scala | 2 +- .../org/scalajs/dom/AudioWorkletGlobalScope.scala | 1 + .../scala/org/scalajs/dom/AudioWorkletNode.scala | 12 ++++++++++++ .../main/scala/org/scalajs/dom/RTCStatsReport.scala | 2 +- .../main/scala/org/scalajs/dom/ReadOnlyMapLike.scala | 2 +- .../scala/org/scalajs/dom/WorkletGlobalScope.scala | 3 +-- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala index 3ccdeb24e..576bef1d5 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala @@ -11,4 +11,4 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native -class AudioParamMap extends ReadOnlyMapLike[String, AudioParam] { } +class AudioParamMap extends ReadOnlyMapLike[String, AudioParam] {} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala index 5643cdd0c..74cbfd6da 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -24,6 +24,7 @@ trait AudioWorkletGlobalScope extends WorkletGlobalScope { @js.native @JSGlobalScope object AudioWorkletGlobalScope extends js.Object { + /** See issue https://github.com/whatwg/html/issues/6059 */ def globalThis: AudioWorkletGlobalScope = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala index 120e167f6..d519e8c34 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -14,5 +14,17 @@ import scala.scalajs.js.annotation._ class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWorkletNodeOptions = js.native) extends AudioNode { + /** The [[MessagePort]] object that is connecting the [[AudioWorkletNode]] and its associated + * [[AudioWorkletProcessor]]. + */ val port: MessagePort = js.native + + /** The [[AudioParamMap]] object containing [[AudioParam]] instances. They can be automated in the same way as with + * default [[AudioNode]], and their calculated values can be used in the [[AudioWorkletProcessor#process]] method of + * your [[AudioWorkletProcessor]]. + */ + val parameters: AudioParamMap = js.native + + var onprocessorerror: js.Function1[Event, _] = js.native + } diff --git a/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala b/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala index 984837291..94b93c8d2 100644 --- a/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala +++ b/dom/src/main/scala/org/scalajs/dom/RTCStatsReport.scala @@ -5,4 +5,4 @@ import scala.scalajs.js //https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCStatsReport @js.native -trait RTCStatsReport extends ReadOnlyMapLike[String, RTCStats] { } +trait RTCStatsReport extends ReadOnlyMapLike[String, RTCStats] {} diff --git a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala index c238c9a03..14fe42240 100644 --- a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala +++ b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala @@ -18,7 +18,7 @@ trait ReadOnlyMapLike[K, V] extends js.Iterable[js.Tuple2[K, V]] { /** Returns a boolean indicating whether a value has been associated with the passed key in the Map object or not. */ def has(key: K): Boolean = js.native - def forEach(callbackFn: js.Function2[K, V, Unit]): Unit = js.native + def forEach(callbackFn: js.Function2[V, K, Unit]): Unit = js.native def size: Int = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala index a09091b77..65e1b7838 100644 --- a/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala @@ -9,5 +9,4 @@ package org.scalajs.dom import scala.scalajs.js @js.native -trait WorkletGlobalScope extends js.Object { -} +trait WorkletGlobalScope extends js.Object {} From b548118df40d7ac195cc98b2d2d687bb78a180eb Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sat, 2 Dec 2023 13:24:30 +0000 Subject: [PATCH 22/42] Add docs. --- .../dom/AudioBufferSourceNodeOptions.scala | 45 +++++++++++++++++++ .../scala/org/scalajs/dom/AudioContext.scala | 7 ++- .../scala/org/scalajs/dom/AudioNode.scala | 2 - .../dom/AudioNodeChannelCountMode.scala | 13 ++++++ .../dom/AudioNodeChannelInterpretation.scala | 12 +++++ .../scala/org/scalajs/dom/AudioParam.scala | 2 + .../scalajs/dom/AudioParamDescriptor.scala | 14 ++++++ 7 files changed, 91 insertions(+), 4 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala index 480b3cffc..4d43745c4 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala @@ -8,13 +8,58 @@ package org.scalajs.dom import scala.scalajs.js trait AudioBufferSourceNodeOptions extends js.Object { + + /** An instance of [[AudioBuffer]] to be played. */ var buffer: js.UndefOr[AudioBuffer] = js.undefined + + /** Indicates whether the audio should play in a loop. The default is false. If the loop is dynamically + * modified during playback, the new value will take effect on the next processing block of audio. + */ var loop: js.UndefOr[Boolean] = js.undefined + + /** An optional value in seconds, where looping should begin if the loop attribute is true. The default is 0. It's + * sensible to set this to a value between 0 and the duration of the buffer. If loopStart is less than 0, looping + * will begin at 0. If loopStart is greater than the duration of the buffer, looping will begin at the end of the + * buffer. This attribute is converted to an exact sample frame offset within the buffer, by multiplying by the + * buffer's sample rate and rounding to the nearest integer value. Thus, its behavior is independent of the value of + * the playbackRate parameter. + */ var loopStart: js.UndefOr[Double] = js.undefined + + /** An optional value, in seconds, where looping should end if the loop attribute is true. The default is 0. Its value + * is exclusive to the content of the loop. The sample frames, comprising the loop, run from the values loopStart to + * loopEnd-(1/sampleRate). It's sensible to set this to a value between 0 and the duration of the buffer. If loopEnd + * is less than 0, looping will end at 0. If loopEnd is greater than the duration of the buffer, looping will end at + * the end of the buffer. This attribute is converted to an exact sample frame offset within the buffer, by + * multiplying by the buffer's sample rate and rounding to the nearest integer value. Thus, its behavior is + * independent of the value of the playbackRate parameter. + */ var loopEnd: js.UndefOr[Double] = js.undefined + + /** A value in cents to modulate the speed of audio stream rendering. Its nominal range is (-∞ to +∞). The default is + * 0. + */ var detune: js.UndefOr[Double] = js.undefined + + /** The speed at which to render the audio stream. Its default value is 1. This parameter is k-rate. This is a + * compound parameter with detune. Its nominal range is (-∞ to +∞). + */ var playbackRate: js.UndefOr[Double] = js.undefined + + /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to + * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend + * on the value of channelCountMode. + */ var channelCount: js.UndefOr[Int] = js.undefined + + /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. + * (See AudioNode.channelCountMode for more information including default values.) + */ var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + + /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio + * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See + * AudioNode.channelCountMode for more information including default values.) + */ var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala index 0f0d31295..150f21959 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioContext.scala @@ -19,7 +19,9 @@ import scala.scalajs.js.annotation._ @JSGlobal class AudioContext extends BaseAudioContext { - // Returns the number of seconds of processing latency incurred by the AudioContext passing the audio from the AudioDestinationNode to the aud io subsystem. + /** Returns the number of seconds of processing latency incurred by the AudioContext passing the audio from the + * AudioDestinationNode to the audio subsystem. + */ def baseLatency: Double = js.native /** Returns an estimation of the output latency of the current audio context. */ @@ -57,6 +59,7 @@ class AudioContext extends BaseAudioContext { /** Closes the audio context, releasing any system audio resources that it uses. */ def close(): js.Promise[Unit] = js.native - // TODO docs + /** Returns a new AudioTimestamp object containing two audio timestamp values relating to the current audio context. + */ def getOutputTimestamp: AudioTimestamp = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala index 6d107417b..9bd380287 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNode.scala @@ -51,8 +51,6 @@ trait AudioNode extends EventTarget { /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio * up-mixing and down-mixing will happen. - * - * The possible values are "speakers" or "discrete". */ var channelInterpretation: AudioNodeChannelInterpretation = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala index d41252c10..2f442f012 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala @@ -8,10 +8,23 @@ package org.scalajs.dom import scala.scalajs.js @js.native +/** Represents an enumerated value describing the way channels must be matched between the AudioNode's inputs and + * outputs. + */ sealed trait AudioNodeChannelCountMode extends js.Any object AudioNodeChannelCountMode { + + /** The number of channels is equal to the maximum number of channels of all connections. In this case, channelCount + * is ignored and only up-mixing happens. + */ val max: AudioNodeChannelCountMode = "max".asInstanceOf[AudioNodeChannelCountMode] + + /** The number of channels is equal to the maximum number of channels of all connections, clamped to the value of + * channelCount. + */ val `clamped-max`: AudioNodeChannelCountMode = "clamped-max".asInstanceOf[AudioNodeChannelCountMode] + + /** The number of channels is defined by the value of channelCount. */ val explicit: AudioNodeChannelCountMode = "explicit".asInstanceOf[AudioNodeChannelCountMode] } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala index 7708e2770..a229d6e00 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala @@ -8,9 +8,21 @@ package org.scalajs.dom import scala.scalajs.js @js.native +/** Represents an enumerated value describing how input channels are mapped to output channels when the number of + * inputs/outputs is different. For example, this setting defines how a mono input will be up-mixed to a stereo or 5.1 + * channel output, or how a quad channel input will be down-mixed to a stereo or mono output. + */ sealed trait AudioNodeChannelInterpretation extends js.Any object AudioNodeChannelInterpretation { + + /** Use set of "standard" mappings for combinations of common speaker input and outputs setups (mono, stereo, quad, + * 5.1). For example, with this setting a mono channel input will output to both channels of a stereo output. + */ val speakers: AudioNodeChannelInterpretation = "speakers".asInstanceOf[AudioNodeChannelInterpretation] + + /** Input channels are mapped to output channels in order. If there are more inputs that outputs the additional inputs + * are dropped; if there are fewer than the unused outputs are silent. + */ val discrete: AudioNodeChannelInterpretation = "discrete".asInstanceOf[AudioNodeChannelInterpretation] } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParam.scala b/dom/src/main/scala/org/scalajs/dom/AudioParam.scala index b2e65ab3a..2a5d1bd37 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParam.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParam.scala @@ -36,8 +36,10 @@ trait AudioParam extends AudioNode { /** Represents the initial value of the attributes as defined by the specific AudioNode creating the AudioParam. */ val defaultValue: Double = js.native + /** Represents the maximum possible value for the parameter's nominal (effective) range. */ val maxValue: Double = js.native + /** Represents the minimum possible value for the parameter's nominal (effective) range. */ val minValue: Double = js.native /** Schedules an instant change to the value of the AudioParam at a precise time, as measured against diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala index af046ed7e..1b7e777f8 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala @@ -8,6 +8,12 @@ package org.scalajs.dom import scala.scalajs.js +/** Specifies properties for AudioParam objects. + * + * It is used to create custom AudioParams on an AudioWorkletNode. If the underlying AudioWorkletProcessor has a + * parameterDescriptors static getter, then the returned array of objects based on this dictionary is used internally + * by AudioWorkletNode constructor to populate its parameters property accordingly. + */ trait AudioParamDescriptor extends js.Object { /** The string which represents the name of the [[AudioParam]]. Under this name the [[AudioParam]] will be available @@ -15,8 +21,16 @@ trait AudioParamDescriptor extends js.Object { * acquire the calculated values of this [[AudioParam]]. */ var name: String + + /** Defaults to -3.4028235e38. */ var minValue: js.UndefOr[Double] = js.undefined + + /** Defaults to 3.4028235e38. */ var maxValue: js.UndefOr[Double] = js.undefined + + /** Represents initial value of the AudioParam. Defaults to 0. */ var defaultValue: js.UndefOr[Double] = js.undefined + + /** Represents an automation rate of this AudioParam. Defaults to "a-rate". */ var automationRate: js.UndefOr[AudioParamAutomationRate] = js.undefined } From 2d1f2400ef0912833050f5d8b67700eeaebde625 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sat, 2 Dec 2023 13:28:46 +0000 Subject: [PATCH 23/42] Add docs. --- .../scala/org/scalajs/dom/AudioScheduledSourceNode.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala index 0d23e3329..ef16c3331 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala @@ -8,6 +8,14 @@ package org.scalajs.dom import scala.scalajs.js @js.native +/** A parent interface for several types of audio source node + * interfaces which share the ability to be started and stopped, + * optionally at specified times. Unless stated otherwise, nodes + * based upon AudioScheduledSourceNode output silence when not + * playing (that is, before start() is called and after stop() is + * called). Silence is represented, as always, by a stream of samples + * with the value zero (0). + */ trait AudioScheduledSourceNode extends AudioNode { /** This method specifies the exact time to start playing the tone. */ From f7adab353e500578f6f77981f57b2998efb3dbfa Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 19:49:32 +0000 Subject: [PATCH 24/42] Doc improvements. --- .../dom/AudioBufferSourceNodeOptions.scala | 4 ++-- .../dom/AudioScheduledSourceNode.scala | 11 ++++------- .../org/scalajs/dom/AudioTimestamp.scala | 10 ++++++++++ .../scala/org/scalajs/dom/AudioWorklet.scala | 8 ++++++++ .../scalajs/dom/AudioWorkletGlobalScope.scala | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala index 4d43745c4..1da57b32b 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala @@ -12,8 +12,8 @@ trait AudioBufferSourceNodeOptions extends js.Object { /** An instance of [[AudioBuffer]] to be played. */ var buffer: js.UndefOr[AudioBuffer] = js.undefined - /** Indicates whether the audio should play in a loop. The default is false. If the loop is dynamically - * modified during playback, the new value will take effect on the next processing block of audio. + /** Indicates whether the audio should play in a loop. The default is false. If the loop is dynamically modified + * during playback, the new value will take effect on the next processing block of audio. */ var loop: js.UndefOr[Boolean] = js.undefined diff --git a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala index ef16c3331..dc6812bc7 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala @@ -8,13 +8,10 @@ package org.scalajs.dom import scala.scalajs.js @js.native -/** A parent interface for several types of audio source node - * interfaces which share the ability to be started and stopped, - * optionally at specified times. Unless stated otherwise, nodes - * based upon AudioScheduledSourceNode output silence when not - * playing (that is, before start() is called and after stop() is - * called). Silence is represented, as always, by a stream of samples - * with the value zero (0). +/** A parent interface for several types of audio source node interfaces which share the ability to be started and + * stopped, optionally at specified times. Unless stated otherwise, nodes based upon AudioScheduledSourceNode output + * silence when not playing (that is, before start() is called and after stop() is called). Silence is represented, as + * always, by a stream of samples with the value zero (0). */ trait AudioScheduledSourceNode extends AudioNode { diff --git a/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala index 63aca71c4..c1fc04c80 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala @@ -8,6 +8,16 @@ package org.scalajs.dom import scala.scalajs.js trait AudioTimestamp extends js.Object { + + /** The time of the sample frame currently being rendered by the audio output device (i.e., output audio stream + * position), in the same units and origin as the context's AudioContext.currentTime. Basically, this is the time + * after the audio context was first created. + */ var contextTime: Double + + /** An estimation of the moment when the sample frame corresponding to the stored contextTime value was rendered by + * the audio output device, in the same units and origin as performance.now(). This is the time after the document + * containing the audio context was first rendered. + */ var performanceTime: Double } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala index 1cbbd3ac0..9aa81f0ad 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala @@ -9,6 +9,14 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ +/** Used to supply custom audio processing scripts that execute in a separate thread to provide very low latency audio + * processing. + * + * The worklet's code is run in the AudioWorkletGlobalScope global execution context, using a separate Web Audio thread + * which is shared by the worklet and other audio nodes. + * + * Access the audio context's instance of AudioWorklet through the BaseAudioContext.audioWorklet property. + */ @JSGlobal @js.native abstract class AudioWorklet extends Worklet {} diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala index 74cbfd6da..ba8ec3a5b 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -9,15 +9,34 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ +/** Represents a global execution context for user-supplied code, which defines custom AudioWorkletProcessor-derived + * classes. + * + * Each BaseAudioContext has a single AudioWorklet available under the audioWorklet property, which runs its code in a + * single AudioWorkletGlobalScope. + * + * As the global execution context is shared across the current BaseAudioContext, it's possible to define any other + * variables and perform any actions allowed in worklets — apart from defining AudioWorkletProcessor derived classes. + */ @js.native trait AudioWorkletGlobalScope extends WorkletGlobalScope { + /** Returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. It + * is incremented by 128 (the size of a render quantum) after the processing of each audio block. + */ def currentFrame: Int + /** Returns a double that represents the ever-increasing context time of the audio block being processed. It is equal + * to the currentTime property of the BaseAudioContext the worklet belongs to. + */ def currentTime: Double + /** Returns a float that represents the sample rate of the associated BaseAudioContext. */ def sampleRate: Float + /** Registers a class derived from the AudioWorkletProcessor interface. The class can then be used by creating an + * AudioWorkletNode, providing its registered name. + */ def registerProcessor(name: String, processorCtor: js.Dynamic): Unit = js.native } From 56d513ba2f1978d1e01e65f9d431dad03887a918 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 19:49:56 +0000 Subject: [PATCH 25/42] Add js.native annotation to AudioParamAutomationRate. --- .../main/scala/org/scalajs/dom/AudioParamAutomationRate.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala index 7139b0de4..2b2b22eae 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala @@ -7,6 +7,7 @@ package org.scalajs.dom import scala.scalajs.js +@js.native sealed trait AudioParamAutomationRate extends js.Any object AudioParamAutomationRate { From 67815654b62ab59f176b2d6ebab72a1fff13063c Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 21:46:48 +0000 Subject: [PATCH 26/42] More docs. --- .../org/scalajs/dom/AudioWorkletNode.scala | 3 +++ .../scalajs/dom/AudioWorkletNodeOptions.scala | 11 +++++++++ .../dom/AudioWorkletProcessorOptions.scala | 11 +++++++++ .../scala/org/scalajs/dom/BlobEvent.scala | 5 +++- .../scala/org/scalajs/dom/BlobEventInit.scala | 2 ++ .../org/scalajs/dom/ConstantSourceNode.scala | 9 ++++++- .../dom/ConstantSourceNodeOptions.scala | 4 ++++ .../org/scalajs/dom/GainNodeOptions.scala | 16 +++++++++++++ .../MediaElementAudioSourceNodeOptions.scala | 16 +++++++++++++ .../org/scalajs/dom/OfflineAudioContext.scala | 3 ++- .../scalajs/dom/OscillatorNodeOptions.scala | 24 +++++++++++++++++++ .../org/scalajs/dom/OscillatorNodeType.scala | 12 ++++++++++ .../main/scala/org/scalajs/dom/Worklet.scala | 8 +++++++ .../org/scalajs/dom/WorkletGlobalScope.scala | 3 +++ 14 files changed, 124 insertions(+), 3 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala index d519e8c34..0bd73542d 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -25,6 +25,9 @@ class AudioWorkletNode(context: BaseAudioContext, name: String, options: AudioWo */ val parameters: AudioParamMap = js.native + /** Fires when the underlying [[AudioWorkletProcessor]] behind the node throws an exception in its constructor, the + * process method, or any user-defined class method. + */ var onprocessorerror: js.Function1[Event, _] = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala index 47d62641b..7012f0416 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala @@ -15,7 +15,18 @@ trait AudioWorkletNodeOptions extends js.Object { /** The value to initialize the [[AudioNode#numberOfOutputs]] property. Defaults to 1. */ var numberOfOutputs: js.UndefOr[Int] = js.undefined + + /** An array defining the number of channels for each output. For example, outputChannelCount: [n, m] specifies the + * number of channels in the first output to be n and the second output to be m. The array length must match + * numberOfOutputs. + */ var outputChannelCount: js.UndefOr[js.Array[Int]] = js.undefined + + /** An object containing the initial values of custom AudioParam objects on this node (in its parameters property), + * with key being the name of a custom parameter and value being its initial value. + */ var parameterData: js.UndefOr[js.Object] = js.undefined + + /** Any additional data that can be used for custom initialization of the underlying AudioWorkletProcessor. */ var processorOptions: js.UndefOr[js.Any] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala index eb9bae26b..0b4668691 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala @@ -15,7 +15,18 @@ trait AudioWorkletProcessorOptions extends js.Object { /** The value to initialize the [[AudioNode#numberOfOutputs]] property. Defaults to 1. */ var numberOfOutputs: Int + + /** An array defining the number of channels for each output. For example, outputChannelCount: [n, m] specifies the + * number of channels in the first output to be n and the second output to be m. The array length must match + * numberOfOutputs. + */ var outputChannelCount: js.Array[Int] + + /** An object containing the initial values of custom AudioParam objects on this node (in its parameters property), + * with key being the name of a custom parameter and value being its initial value. + */ var parameterData: js.UndefOr[js.Object] = js.undefined + + /** Any additional data that can be used for custom initialization of the underlying AudioWorkletProcessor. */ var processorOptions: js.UndefOr[js.Any] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala index 1a2fb89cf..0e67a32ca 100644 --- a/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala +++ b/dom/src/main/scala/org/scalajs/dom/BlobEvent.scala @@ -3,7 +3,9 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ -/** The AnimationEvent interface represents events providing information related to animations. */ +/** The BlobEvent interface represents events associated with a Blob. These blobs are typically, but not necessarily, + * associated with media content. + */ @JSGlobal @js.native class BlobEvent(typeArg: String, init: BlobEventInit) extends Event(typeArg, init) { @@ -12,5 +14,6 @@ class BlobEvent(typeArg: String, init: BlobEventInit) extends Event(typeArg, ini this("dataavailable", init) } + /** Represents a Blob associated with the event. */ def data: Blob = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala index 8172e518e..866bfca4b 100644 --- a/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala +++ b/dom/src/main/scala/org/scalajs/dom/BlobEventInit.scala @@ -4,5 +4,7 @@ import scala.scalajs.js @js.native trait BlobEventInit extends EventInit { + + /** The Blob associated with the event. */ var data: Blob } diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala index d9fc2d642..e0b490c81 100644 --- a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala @@ -10,10 +10,17 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native +/** Represents an audio source (based upon AudioScheduledSourceNode) whose output is single unchanging value. This makes + * it useful for cases in which you need a constant value coming in from an audio source. In addition, it can be used + * like a constructible AudioParam by automating the value of its offset or by connecting another node to it; see + * Controlling multiple parameters with ConstantSourceNode. + */ class ConstantSourceNode(context: BaseAudioContext, options: ConstantSourceNodeOptions = js.native) extends AudioScheduledSourceNode { - // TODO + /** Returns a AudioParam object indicating the numeric a-rate value which is always returned by the source when asked + * for the next sample. + */ val offset: AudioParam = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala index a1632da3e..af6c73cfe 100644 --- a/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/ConstantSourceNodeOptions.scala @@ -8,5 +8,9 @@ package org.scalajs.dom import scala.scalajs.js trait ConstantSourceNodeOptions extends js.Object { + + /** A read-only AudioParam specifying the constant value generated by the source. The default is 1.0. The normal range + * is -1.0 to 1.0, but the value can be anywhere in the range from -Infinity to +Infinity. + */ var offset: js.UndefOr[Double] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala index 3315ba381..7dc1c35ac 100644 --- a/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala @@ -8,8 +8,24 @@ package org.scalajs.dom import scala.scalajs.js trait GainNodeOptions extends js.Object { + + /** The amount of gain to apply. This parameter is a- rate and it's nominal range is (-∞,+∞). The default is 1 */ var gain: js.UndefOr[Double] = js.undefined + + /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to + * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend + * on the value of channelCountMode. + */ var channelCount: js.UndefOr[Int] = js.undefined + + /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. + * (See AudioNode.channelCountMode for more information including default values.) + */ var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + + /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio + * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See + * AudioNode.channelCountMode for more information including default values.) + */ var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala index b5c6e8bf4..e6868122b 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala @@ -8,8 +8,24 @@ package org.scalajs.dom import scala.scalajs.js trait MediaElementAudioSourceNodeOptions extends js.Object { + + /** An HTMLMediaElement that will be used as the source for the audio. */ var mediaElement: HTMLMediaElement + + /** An integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs + * to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend on the + * value of channelCountMode. + */ var channelCount: js.UndefOr[Int] = js.undefined + + /** Describes the way channels must be matched between the node's inputs and outputs. (See AudioNode.channelCountMode + * for more information including default values.) + */ var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + + /** Describes the meaning of the channels. This interpretation will define how audio up-mixing and down-mixing will + * happen. The possible values are "speakers" or "discrete". (See AudioNode.channelInterpretation for more + * information including default values.) + */ var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala index f996739cc..72668a61f 100644 --- a/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala +++ b/dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala @@ -42,7 +42,8 @@ class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) exte */ def startRendering(): js.Promise[AudioBuffer] = js.native - // Schedules a suspension of the time progression in the audio context at the specified time and returns a promise. + /** Schedules a suspension of the time progression in the audio context at the specified time and returns a promise. + */ def suspend(suspendTime: Double): js.Promise[Unit] = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala index 7dac9665e..c3c8d631e 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala @@ -8,11 +8,35 @@ package org.scalajs.dom import scala.scalajs.js trait OscillatorNodeOptions extends js.Object { + + /** The shape of the wave produced by the node. Valid values are 'sine', 'square', 'sawtooth', 'triangle' and + * 'custom'. The default is 'sine'. + */ var `type`: js.UndefOr[OscillatorNodeType] = js.undefined + + /** A detuning value (in cents) which will offset the frequency by the given amount. Its default is 0. */ var detune: js.UndefOr[Double] = js.undefined + + /** The frequency (in hertz) of the periodic waveform. Its default is 440. */ var frequency: js.UndefOr[Double] = js.undefined + + /** An arbitrary period waveform described by a PeriodicWave object. */ var periodicWave: js.UndefOr[PeriodicWave] = js.undefined + + /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to + * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend + * on the value of channelCountMode. + */ var channelCount: js.UndefOr[Int] = js.undefined + + /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. + * (See AudioNode.channelCountMode for more information including default values.) + */ var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined + + /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio + * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See + * AudioNode.channelCountMode for more information including default values.) + */ var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala index 05e3446a1..de4b2dcf6 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala @@ -11,9 +11,21 @@ import scala.scalajs.js sealed trait OscillatorNodeType extends js.Any object OscillatorNodeType { + + /** A sine wave. This is the default value. */ val sine: OscillatorNodeType = "sine".asInstanceOf[OscillatorNodeType] + + /** A square wave with a duty cycle of 0.5; that is, the signal is "high" for half of each period. */ val square: OscillatorNodeType = "square".asInstanceOf[OscillatorNodeType] + + /** A sawtooth wave. */ val sawtooth: OscillatorNodeType = "sawtooth".asInstanceOf[OscillatorNodeType] + + /** A triangle wave. */ val triangle: OscillatorNodeType = "triangle".asInstanceOf[OscillatorNodeType] + + /** A custom waveform. You never set type to custom manually; instead, use the setPeriodicWave() method to provide the + * data representing the waveform. Doing so automatically sets the type to custom. + */ val custom: OscillatorNodeType = "custom".asInstanceOf[OscillatorNodeType] } diff --git a/dom/src/main/scala/org/scalajs/dom/Worklet.scala b/dom/src/main/scala/org/scalajs/dom/Worklet.scala index 46c52e0d1..7c3de29aa 100644 --- a/dom/src/main/scala/org/scalajs/dom/Worklet.scala +++ b/dom/src/main/scala/org/scalajs/dom/Worklet.scala @@ -11,6 +11,14 @@ import scala.scalajs.js.annotation._ @JSGlobal @js.native +/** The Worklet interface is a lightweight version of Web Workers and gives developers access to low-level parts of the + * rendering pipeline. + */ abstract class Worklet extends js.Object { + + /** loads the module in the given JavaScript file and adds it to the current Worklet. + * @param moduleURL + * A String containing the URL of a JavaScript file with the module to add. + */ def addModule(moduleURL: String, options: WorkletOptions = js.native): js.Promise[Unit] = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala index 65e1b7838..b191a537f 100644 --- a/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/WorkletGlobalScope.scala @@ -9,4 +9,7 @@ package org.scalajs.dom import scala.scalajs.js @js.native +/** An abstract class that specific worklet scope classes inherit from. Each WorkletGlobalScope defines a new global + * environment. + */ trait WorkletGlobalScope extends js.Object {} From 7d6eb4e7516dc79ccbac1264fefb658a2cf70d4c Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 21:46:58 +0000 Subject: [PATCH 27/42] Add js.native annotation to AudioTimestamp. --- dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala index c1fc04c80..d374bdf25 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioTimestamp.scala @@ -7,6 +7,7 @@ package org.scalajs.dom import scala.scalajs.js +@js.native trait AudioTimestamp extends js.Object { /** The time of the sample frame currently being rendered by the audio output device (i.e., output audio stream From d159170506ce8b97a7ccfa7aaea13ce3994de2f5 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 21:47:18 +0000 Subject: [PATCH 28/42] Correct type of params for AudioWorkletProcessor. --- .../scalajs/dom/AudioWorkletProcessor.scala | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala index abbd01a95..6a423a6d6 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -18,7 +18,37 @@ abstract class AudioWorkletProcessor(options: AudioWorkletProcessorOptions) exte */ val port: MessagePort = js.native - def process(inputs: js.Array[js.typedarray.Float32Array], outputs: js.Array[js.typedarray.Float32Array], - parameters: js.Object): Boolean + /** Implements the audio processing algorithm for the audio processor worklet. + * + * The method is called synchronously from the audio rendering thread, once for each block of audio (also known as a + * rendering quantum) being directed through the processor's corresponding AudioWorkletNode. In other words, every + * time a new block of audio is ready for your processor to manipulate, your process() function is invoked to do so. + * @param inputs + * An array of inputs connected to the node, each item of which is, in turn, an array of channels. Each channel is + * a Float32Array containing 128 samples. For example, inputs[n][m][i] will access n-th input, m-th channel of that + * input, and i-th sample of that channel. Each sample value is in range of [-1 .. 1]. The number of inputs and + * thus the length of that array is fixed at the construction of the node (see AudioWorkletNode). If there is no + * active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels + * available). The number of channels in each input may vary, depending on channelCount and channelCountMode + * properties. + * @param outputs + * An array of outputs that is similar to the inputs parameter in structure. It is intended to be filled during the + * execution of the process() method. Each of the output channels is filled with zeros by default — the processor + * will output silence unless the output arrays are modified. + * @param parameters + * An object containing string keys and Float32Array values. For each custom AudioParam defined using the + * parameterDescriptors getter, the key in the object is a name of that AudioParam, and the value is a + * Float32Array. The values of the array are calculated by taking scheduled automation events into consideration. + * If the automation rate of the parameter is "a-rate", the array will contain 128 values — one for each frame in + * the current audio block. If there's no automation happening during the time represented by the current block, + * the array may contain a single value that is constant for the entire block, instead of 128 identical values. If + * the automation rate is "k-rate", the array will contain a single value, which is to be used for each of 128 + * frames. + * @returns + * A Boolean value indicating whether or not to force the AudioWorkletNode to remain active even if the user + * agent's internal logic would otherwise decide that it's safe to shut down the node. + */ + def process(inputs: js.Array[js.Array[js.typedarray.Float32Array]], + outputs: js.Array[js.Array[js.typedarray.Float32Array]], parameters: js.Object): Boolean } From 3bac38d31bd4f4c0f4295271ca9509ef45233143 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 21:47:36 +0000 Subject: [PATCH 29/42] WorkletOptions should extend js.Object. --- dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala index 362b5c6d2..d8b8de37a 100644 --- a/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala @@ -8,6 +8,10 @@ package org.scalajs.dom import scala.scalajs.js -trait WorkletOptions extends js.Any { +trait WorkletOptions extends js.Object { + + /** Indicates whether to send credentials (e.g. cookies and HTTP authentication) when loading the module. Can be one + * of "omit", "same-origin", or "include". Defaults to "same-origin". See also Request.credentials. + */ var credentials: js.UndefOr[RequestCredentials] = js.undefined } From e32a80cf5107cb0b39725842e26d5edbaadbd506 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 21:47:55 +0000 Subject: [PATCH 30/42] Add MediaRecorder and options. --- .../scala/org/scalajs/dom/MediaRecorder.scala | 31 +++++++++++++++++-- .../scalajs/dom/MediaRecorderOptions.scala | 23 ++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 dom/src/main/scala/org/scalajs/dom/MediaRecorderOptions.scala diff --git a/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala b/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala index 5f7ce1c43..61c27a535 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaRecorder.scala @@ -1,4 +1,8 @@ -/** https://www.w3.org/TR/2016/CR-mediacapture-streams-20160519/ */ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ package org.scalajs.dom import scala.scalajs.js @@ -6,13 +10,34 @@ import scala.scalajs.js.annotation._ @js.native @JSGlobal -class MediaRecorder(stream: MediaStream) extends EventTarget { - var ondataavailable: js.Function1[Event, Any] = js.native +/** Provides functionality to easily record media */ +class MediaRecorder(stream: MediaStream, options: MediaRecorderOptions) extends EventTarget { + + /** Fires periodically each time timeslice milliseconds of media have been recorded (or when the entire media has been + * recorded, if timeslice wasn't specified). The event, of type BlobEvent, contains the recorded media in its data + * property. + */ + var ondataavailable: js.Function1[BlobEvent, Any] = js.native + + /** Fired when there are fatal errors that stop recording. The received event is based on the MediaRecorderErrorEvent + * interface, whose error property contains a DOMException that describes the actual error that occurred. + */ var onerror: js.Function1[Event, Any] = js.native + + /** Fired when media recording ends, either when the MediaStream ends, or after the MediaRecorder.stop() method is + * called. + */ var onstop: js.Function1[Event, Any] = js.native + def this(stream: MediaStream) = this(stream, js.native) + + /** Used to resume media recording when it has been previously paused. */ def resume(): Unit = js.native + + /** Begins recording media into one or more Blob objects. */ def start(): Unit = js.native + + /** Used to stop media capture. */ def stop(): Unit = js.native } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaRecorderOptions.scala b/dom/src/main/scala/org/scalajs/dom/MediaRecorderOptions.scala new file mode 100644 index 000000000..d71d31644 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/MediaRecorderOptions.scala @@ -0,0 +1,23 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +trait MediaRecorderOptions extends js.Object { + + /** The chosen bitrate for the audio component of the media. */ + var audioBitsPerSecond: js.UndefOr[Long] = js.undefined + + /** The chosen bitrate for the video component of the media. */ + var videoBitsPerSecond: js.UndefOr[Long] = js.undefined + + /** The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two + * properties. If this is specified along with one or the other of the above properties, this will be used for the + * one that isn't specified. + */ + var bitsPerSecond: js.UndefOr[Long] = js.undefined +} From c221e2be7884c92ad45f9c16b6ea7e13c94f9e7d Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 22:11:35 +0000 Subject: [PATCH 31/42] Correct scaladoc. --- dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala index 6a423a6d6..33d6e34c0 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -44,7 +44,7 @@ abstract class AudioWorkletProcessor(options: AudioWorkletProcessorOptions) exte * the array may contain a single value that is constant for the entire block, instead of 128 identical values. If * the automation rate is "k-rate", the array will contain a single value, which is to be used for each of 128 * frames. - * @returns + * @return * A Boolean value indicating whether or not to force the AudioWorkletNode to remain active even if the user * agent's internal logic would otherwise decide that it's safe to shut down the node. */ From 824092d2659a87b07e4fe2be61813516eb69d458 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 18 Dec 2023 22:11:45 +0000 Subject: [PATCH 32/42] Api reports. --- api-reports/2_12.txt | 108 ++++++++++++++++++++++++++++++++++++++++++- api-reports/2_13.txt | 108 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 214 insertions(+), 2 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index e90cd6118..6dbd0d8f6 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -459,6 +459,7 @@ AudioBufferSourceNodeOptions[JT] var loopStart: js.UndefOr[Double] AudioBufferSourceNodeOptions[JT] var playbackRate: js.UndefOr[Double] AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioContext[JC] val audioWorklet: AudioWorklet AudioContext[JC] def baseLatency: Double AudioContext[JC] def close(): js.Promise[Unit] AudioContext[JC] def createAnalyser(): AnalyserNode @@ -570,6 +571,22 @@ AudioParam[JT] def setTargetAtTime(target: Double, startTime: Double, timeConsta AudioParam[JT] def setValueAtTime(value: Double, startTime: Double): Unit AudioParam[JT] def setValueCurveAtTime(values: js.typedarray.Float32Array, startTime: Double, duration: Double): Unit AudioParam[JT] var value: Double +AudioParamAutomationRate[JT] +AudioParamAutomationRate[SO] val `a-rate`: AudioParamAutomationRate +AudioParamAutomationRate[SO] val `k-rate`: AudioParamAutomationRate +AudioParamDescriptor[JT] var automationRate: js.UndefOr[AudioParamAutomationRate] +AudioParamDescriptor[JT] var defaultValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var maxValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var minValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var name: String +AudioParamMap[JC] @JSBracketAccess def apply(index: K): V +AudioParamMap[JC] def entries(): js.Iterator[js.Tuple2[K, V]] +AudioParamMap[JC] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +AudioParamMap[JC] def has(key: K): Boolean +AudioParamMap[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +AudioParamMap[JC] def keys(): js.Iterator[K] +AudioParamMap[JC] def size: Int +AudioParamMap[JC] def values(): js.Iterator[V] AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioScheduledSourceNode[JT] var channelCount: Int @@ -607,8 +624,44 @@ AudioTrackList[JT] var onchange: js.Function1[Event, Any] AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +AudioWorkletGlobalScope[JO] def globalThis: AudioWorkletGlobalScope +AudioWorkletGlobalScope[JT] def currentFrame: Int +AudioWorkletGlobalScope[JT] def currentTime: Double +AudioWorkletGlobalScope[JT] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit +AudioWorkletGlobalScope[JT] def sampleRate: Float +AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorkletNode[JC] var channelCount: Int +AudioWorkletNode[JC] var channelCountMode: AudioNodeChannelCountMode +AudioWorkletNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +AudioWorkletNode[JC] def connect(audioNode: AudioNode): Unit +AudioWorkletNode[JC] def connect(audioParam: AudioParam): Unit +AudioWorkletNode[JC] val context: AudioContext +AudioWorkletNode[JC] def disconnect(output: AudioNode?): Unit +AudioWorkletNode[JC] def dispatchEvent(evt: Event): Boolean +AudioWorkletNode[JC] val numberOfInputs: Int +AudioWorkletNode[JC] val numberOfOutputs: Int +AudioWorkletNode[JC] var onprocessorerror: js.Function1[Event, _] +AudioWorkletNode[JC] val parameters: AudioParamMap +AudioWorkletNode[JC] val port: MessagePort +AudioWorkletNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioWorkletNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorkletNodeOptions[JT] var numberOfInputs: js.UndefOr[Int] +AudioWorkletNodeOptions[JT] var numberOfOutputs: js.UndefOr[Int] +AudioWorkletNodeOptions[JT] var outputChannelCount: js.UndefOr[js.Array[Int]] +AudioWorkletNodeOptions[JT] var parameterData: js.UndefOr[js.Object] +AudioWorkletNodeOptions[JT] var processorOptions: js.UndefOr[js.Any] +AudioWorkletProcessor[JC] val port: MessagePort +AudioWorkletProcessor[JC] def process(inputs: js.Array[js.Array[js.typedarray.Float32Array]], outputs: js.Array[js.Array[js.typedarray.Float32Array]], parameters: js.Object): Boolean +AudioWorkletProcessorOptions[JT] var numberOfInputs: Int +AudioWorkletProcessorOptions[JT] var numberOfOutputs: Int +AudioWorkletProcessorOptions[JT] var outputChannelCount: js.Array[Int] +AudioWorkletProcessorOptions[JT] var parameterData: js.UndefOr[js.Object] +AudioWorkletProcessorOptions[JT] var processorOptions: js.UndefOr[js.Any] BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] val audioWorklet: AudioWorklet BaseAudioContext[JT] def createAnalyser(): AnalyserNode BaseAudioContext[JT] def createBiquadFilter(): BiquadFilterNode BaseAudioContext[JT] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -676,6 +729,26 @@ Blob[JC] def stream(): ReadableStream[Uint8Array] Blob[JC] def text(): js.Promise[String] Blob[JC] def `type`: String Blob[JO] +BlobEvent[JC] def bubbles: Boolean +BlobEvent[JC] def cancelBubble: Boolean +BlobEvent[JC] def cancelable: Boolean +BlobEvent[JC] def composed: Boolean +BlobEvent[JC] def currentTarget: EventTarget +BlobEvent[JC] def data: Blob +BlobEvent[JC] def defaultPrevented: Boolean +BlobEvent[JC] def eventPhase: Int +BlobEvent[JC] def isTrusted: Boolean +BlobEvent[JC] def preventDefault(): Unit +BlobEvent[JC] def stopImmediatePropagation(): Unit +BlobEvent[JC] def stopPropagation(): Unit +BlobEvent[JC] def target: EventTarget +BlobEvent[JC] def timeStamp: Double +BlobEvent[JC] def `type`: String +BlobEventInit[JT] var bubbles: js.UndefOr[Boolean] +BlobEventInit[JT] var cancelable: js.UndefOr[Boolean] +BlobEventInit[JT] var composed: js.UndefOr[Boolean] +BlobEventInit[JT] var data: Blob +BlobEventInit[JT] var scoped: js.UndefOr[Boolean] BlobPropertyBag[JT] var endings: js.UndefOr[EndingType] BlobPropertyBag[JT] var `type`: js.UndefOr[String] BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag (@deprecated in 2.0.0) @@ -16213,6 +16286,20 @@ MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaQueryList[JT] def removeListener(listener: MediaQueryListListener): Unit (@deprecated in 2.4.0) MediaQueryListListener[JT] def apply(mql: MediaQueryList): Unit (@deprecated in 2.4.0) +MediaRecorder[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +MediaRecorder[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaRecorder[JC] def dispatchEvent(evt: Event): Boolean +MediaRecorder[JC] var ondataavailable: js.Function1[BlobEvent, Any] +MediaRecorder[JC] var onerror: js.Function1[Event, Any] +MediaRecorder[JC] var onstop: js.Function1[Event, Any] +MediaRecorder[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +MediaRecorder[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaRecorder[JC] def resume(): Unit +MediaRecorder[JC] def start(): Unit +MediaRecorder[JC] def stop(): Unit +MediaRecorderOptions[JT] var audioBitsPerSecond: js.UndefOr[Long] +MediaRecorderOptions[JT] var bitsPerSecond: js.UndefOr[Long] +MediaRecorderOptions[JT] var videoBitsPerSecond: js.UndefOr[Long] MediaSource[JC] def activeSourceBuffers: SourceBufferList MediaSource[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaSource[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -16682,6 +16769,7 @@ OfflineAudioCompletionEvent[JT] def timeStamp: Double OfflineAudioCompletionEvent[JT] def `type`: String OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +OfflineAudioContext[JC] val audioWorklet: AudioWorklet OfflineAudioContext[JC] def createAnalyser(): AnalyserNode OfflineAudioContext[JC] def createBiquadFilter(): BiquadFilterNode OfflineAudioContext[JC] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -17297,7 +17385,14 @@ RTCSignalingState[SO] val stable: RTCSignalingState RTCStats[JT] val id: String RTCStats[JT] val timestamp: Double RTCStats[JT] val `type`: RTCStatsType -RTCStatsReport[JT] def apply(id: String): RTCStats +RTCStatsReport[JT] @JSBracketAccess def apply(index: K): V +RTCStatsReport[JT] def entries(): js.Iterator[js.Tuple2[K, V]] +RTCStatsReport[JT] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +RTCStatsReport[JT] def has(key: K): Boolean +RTCStatsReport[JT] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +RTCStatsReport[JT] def keys(): js.Iterator[K] +RTCStatsReport[JT] def size: Int +RTCStatsReport[JT] def values(): js.Iterator[V] RTCStatsType[JT] RTCStatsType[SO] val `inbound-rtp` = "inbound-rtp".asInstanceOf[RTCStatsType] RTCStatsType[SO] val `outbound-rtp` = "outbound-rtp".asInstanceOf[RTCStatsType] @@ -17335,6 +17430,14 @@ Range[JO] val END_TO_END: Int Range[JO] val END_TO_START: Int Range[JO] val START_TO_END: Int Range[JO] val START_TO_START: Int +ReadOnlyMapLike[JT] @JSBracketAccess def apply(index: K): V +ReadOnlyMapLike[JT] def entries(): js.Iterator[js.Tuple2[K, V]] +ReadOnlyMapLike[JT] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +ReadOnlyMapLike[JT] def has(key: K): Boolean +ReadOnlyMapLike[JT] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +ReadOnlyMapLike[JT] def keys(): js.Iterator[K] +ReadOnlyMapLike[JT] def size: Int +ReadOnlyMapLike[JT] def values(): js.Iterator[V] ReadableStream[JT] def cancel(reason: js.UndefOr[Any]?): js.Promise[Unit] ReadableStream[JT] def getReader(): ReadableStreamReader[T] ReadableStream[JT] def locked: Boolean @@ -27177,6 +27280,9 @@ WorkerOptions[JT] var `type`: js.UndefOr[WorkerType] WorkerType[JT] WorkerType[SO] val classic: WorkerType WorkerType[SO] val module: WorkerType +Worklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +WorkletGlobalScope[JT] +WorkletOptions[JT] var credentials: js.UndefOr[RequestCredentials] WriteableState[JT] WriteableState[SO] val closed: WriteableState WriteableState[SO] val closing: WriteableState diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index e90cd6118..6dbd0d8f6 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -459,6 +459,7 @@ AudioBufferSourceNodeOptions[JT] var loopStart: js.UndefOr[Double] AudioBufferSourceNodeOptions[JT] var playbackRate: js.UndefOr[Double] AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioContext[JC] val audioWorklet: AudioWorklet AudioContext[JC] def baseLatency: Double AudioContext[JC] def close(): js.Promise[Unit] AudioContext[JC] def createAnalyser(): AnalyserNode @@ -570,6 +571,22 @@ AudioParam[JT] def setTargetAtTime(target: Double, startTime: Double, timeConsta AudioParam[JT] def setValueAtTime(value: Double, startTime: Double): Unit AudioParam[JT] def setValueCurveAtTime(values: js.typedarray.Float32Array, startTime: Double, duration: Double): Unit AudioParam[JT] var value: Double +AudioParamAutomationRate[JT] +AudioParamAutomationRate[SO] val `a-rate`: AudioParamAutomationRate +AudioParamAutomationRate[SO] val `k-rate`: AudioParamAutomationRate +AudioParamDescriptor[JT] var automationRate: js.UndefOr[AudioParamAutomationRate] +AudioParamDescriptor[JT] var defaultValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var maxValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var minValue: js.UndefOr[Double] +AudioParamDescriptor[JT] var name: String +AudioParamMap[JC] @JSBracketAccess def apply(index: K): V +AudioParamMap[JC] def entries(): js.Iterator[js.Tuple2[K, V]] +AudioParamMap[JC] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +AudioParamMap[JC] def has(key: K): Boolean +AudioParamMap[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +AudioParamMap[JC] def keys(): js.Iterator[K] +AudioParamMap[JC] def size: Int +AudioParamMap[JC] def values(): js.Iterator[V] AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioScheduledSourceNode[JT] var channelCount: Int @@ -607,8 +624,44 @@ AudioTrackList[JT] var onchange: js.Function1[Event, Any] AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +AudioWorkletGlobalScope[JO] def globalThis: AudioWorkletGlobalScope +AudioWorkletGlobalScope[JT] def currentFrame: Int +AudioWorkletGlobalScope[JT] def currentTime: Double +AudioWorkletGlobalScope[JT] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit +AudioWorkletGlobalScope[JT] def sampleRate: Float +AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorkletNode[JC] var channelCount: Int +AudioWorkletNode[JC] var channelCountMode: AudioNodeChannelCountMode +AudioWorkletNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +AudioWorkletNode[JC] def connect(audioNode: AudioNode): Unit +AudioWorkletNode[JC] def connect(audioParam: AudioParam): Unit +AudioWorkletNode[JC] val context: AudioContext +AudioWorkletNode[JC] def disconnect(output: AudioNode?): Unit +AudioWorkletNode[JC] def dispatchEvent(evt: Event): Boolean +AudioWorkletNode[JC] val numberOfInputs: Int +AudioWorkletNode[JC] val numberOfOutputs: Int +AudioWorkletNode[JC] var onprocessorerror: js.Function1[Event, _] +AudioWorkletNode[JC] val parameters: AudioParamMap +AudioWorkletNode[JC] val port: MessagePort +AudioWorkletNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioWorkletNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioWorkletNodeOptions[JT] var numberOfInputs: js.UndefOr[Int] +AudioWorkletNodeOptions[JT] var numberOfOutputs: js.UndefOr[Int] +AudioWorkletNodeOptions[JT] var outputChannelCount: js.UndefOr[js.Array[Int]] +AudioWorkletNodeOptions[JT] var parameterData: js.UndefOr[js.Object] +AudioWorkletNodeOptions[JT] var processorOptions: js.UndefOr[js.Any] +AudioWorkletProcessor[JC] val port: MessagePort +AudioWorkletProcessor[JC] def process(inputs: js.Array[js.Array[js.typedarray.Float32Array]], outputs: js.Array[js.Array[js.typedarray.Float32Array]], parameters: js.Object): Boolean +AudioWorkletProcessorOptions[JT] var numberOfInputs: Int +AudioWorkletProcessorOptions[JT] var numberOfOutputs: Int +AudioWorkletProcessorOptions[JT] var outputChannelCount: js.Array[Int] +AudioWorkletProcessorOptions[JT] var parameterData: js.UndefOr[js.Object] +AudioWorkletProcessorOptions[JT] var processorOptions: js.UndefOr[js.Any] BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit BaseAudioContext[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BaseAudioContext[JT] val audioWorklet: AudioWorklet BaseAudioContext[JT] def createAnalyser(): AnalyserNode BaseAudioContext[JT] def createBiquadFilter(): BiquadFilterNode BaseAudioContext[JT] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -676,6 +729,26 @@ Blob[JC] def stream(): ReadableStream[Uint8Array] Blob[JC] def text(): js.Promise[String] Blob[JC] def `type`: String Blob[JO] +BlobEvent[JC] def bubbles: Boolean +BlobEvent[JC] def cancelBubble: Boolean +BlobEvent[JC] def cancelable: Boolean +BlobEvent[JC] def composed: Boolean +BlobEvent[JC] def currentTarget: EventTarget +BlobEvent[JC] def data: Blob +BlobEvent[JC] def defaultPrevented: Boolean +BlobEvent[JC] def eventPhase: Int +BlobEvent[JC] def isTrusted: Boolean +BlobEvent[JC] def preventDefault(): Unit +BlobEvent[JC] def stopImmediatePropagation(): Unit +BlobEvent[JC] def stopPropagation(): Unit +BlobEvent[JC] def target: EventTarget +BlobEvent[JC] def timeStamp: Double +BlobEvent[JC] def `type`: String +BlobEventInit[JT] var bubbles: js.UndefOr[Boolean] +BlobEventInit[JT] var cancelable: js.UndefOr[Boolean] +BlobEventInit[JT] var composed: js.UndefOr[Boolean] +BlobEventInit[JT] var data: Blob +BlobEventInit[JT] var scoped: js.UndefOr[Boolean] BlobPropertyBag[JT] var endings: js.UndefOr[EndingType] BlobPropertyBag[JT] var `type`: js.UndefOr[String] BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag (@deprecated in 2.0.0) @@ -16213,6 +16286,20 @@ MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaQueryList[JT] def removeListener(listener: MediaQueryListListener): Unit (@deprecated in 2.4.0) MediaQueryListListener[JT] def apply(mql: MediaQueryList): Unit (@deprecated in 2.4.0) +MediaRecorder[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +MediaRecorder[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaRecorder[JC] def dispatchEvent(evt: Event): Boolean +MediaRecorder[JC] var ondataavailable: js.Function1[BlobEvent, Any] +MediaRecorder[JC] var onerror: js.Function1[Event, Any] +MediaRecorder[JC] var onstop: js.Function1[Event, Any] +MediaRecorder[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +MediaRecorder[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +MediaRecorder[JC] def resume(): Unit +MediaRecorder[JC] def start(): Unit +MediaRecorder[JC] def stop(): Unit +MediaRecorderOptions[JT] var audioBitsPerSecond: js.UndefOr[Long] +MediaRecorderOptions[JT] var bitsPerSecond: js.UndefOr[Long] +MediaRecorderOptions[JT] var videoBitsPerSecond: js.UndefOr[Long] MediaSource[JC] def activeSourceBuffers: SourceBufferList MediaSource[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaSource[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -16682,6 +16769,7 @@ OfflineAudioCompletionEvent[JT] def timeStamp: Double OfflineAudioCompletionEvent[JT] def `type`: String OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit OfflineAudioContext[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +OfflineAudioContext[JC] val audioWorklet: AudioWorklet OfflineAudioContext[JC] def createAnalyser(): AnalyserNode OfflineAudioContext[JC] def createBiquadFilter(): BiquadFilterNode OfflineAudioContext[JC] def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer @@ -17297,7 +17385,14 @@ RTCSignalingState[SO] val stable: RTCSignalingState RTCStats[JT] val id: String RTCStats[JT] val timestamp: Double RTCStats[JT] val `type`: RTCStatsType -RTCStatsReport[JT] def apply(id: String): RTCStats +RTCStatsReport[JT] @JSBracketAccess def apply(index: K): V +RTCStatsReport[JT] def entries(): js.Iterator[js.Tuple2[K, V]] +RTCStatsReport[JT] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +RTCStatsReport[JT] def has(key: K): Boolean +RTCStatsReport[JT] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +RTCStatsReport[JT] def keys(): js.Iterator[K] +RTCStatsReport[JT] def size: Int +RTCStatsReport[JT] def values(): js.Iterator[V] RTCStatsType[JT] RTCStatsType[SO] val `inbound-rtp` = "inbound-rtp".asInstanceOf[RTCStatsType] RTCStatsType[SO] val `outbound-rtp` = "outbound-rtp".asInstanceOf[RTCStatsType] @@ -17335,6 +17430,14 @@ Range[JO] val END_TO_END: Int Range[JO] val END_TO_START: Int Range[JO] val START_TO_END: Int Range[JO] val START_TO_START: Int +ReadOnlyMapLike[JT] @JSBracketAccess def apply(index: K): V +ReadOnlyMapLike[JT] def entries(): js.Iterator[js.Tuple2[K, V]] +ReadOnlyMapLike[JT] def forEach(callbackFn: js.Function2[V, K, Unit]): Unit +ReadOnlyMapLike[JT] def has(key: K): Boolean +ReadOnlyMapLike[JT] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[K, V]] +ReadOnlyMapLike[JT] def keys(): js.Iterator[K] +ReadOnlyMapLike[JT] def size: Int +ReadOnlyMapLike[JT] def values(): js.Iterator[V] ReadableStream[JT] def cancel(reason: js.UndefOr[Any]?): js.Promise[Unit] ReadableStream[JT] def getReader(): ReadableStreamReader[T] ReadableStream[JT] def locked: Boolean @@ -27177,6 +27280,9 @@ WorkerOptions[JT] var `type`: js.UndefOr[WorkerType] WorkerType[JT] WorkerType[SO] val classic: WorkerType WorkerType[SO] val module: WorkerType +Worklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +WorkletGlobalScope[JT] +WorkletOptions[JT] var credentials: js.UndefOr[RequestCredentials] WriteableState[JT] WriteableState[SO] val closed: WriteableState WriteableState[SO] val closing: WriteableState From e637830d99c06262e7494ae85c4b8eae764568ad Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 29 Dec 2023 12:42:54 +0000 Subject: [PATCH 33/42] AudioWorkletGlobalScope should be an abstract class. --- .../main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala index ba8ec3a5b..34e4256fd 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -19,7 +19,8 @@ import scala.scalajs.js.annotation._ * variables and perform any actions allowed in worklets — apart from defining AudioWorkletProcessor derived classes. */ @js.native -trait AudioWorkletGlobalScope extends WorkletGlobalScope { +@JSGlobal +abstract class AudioWorkletGlobalScope extends WorkletGlobalScope { /** Returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. It * is incremented by 128 (the size of a render quantum) after the processing of each audio block. From 314c67b63b63fc8afde026ccdecc94580ae6262c Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 29 Dec 2023 16:42:13 +0000 Subject: [PATCH 34/42] AudioScheduledSourceNode should be an abstract class. --- .../main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala index dc6812bc7..d860b3237 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioScheduledSourceNode.scala @@ -6,6 +6,7 @@ package org.scalajs.dom import scala.scalajs.js +import scala.scalajs.js.annotation._ @js.native /** A parent interface for several types of audio source node interfaces which share the ability to be started and @@ -13,7 +14,8 @@ import scala.scalajs.js * silence when not playing (that is, before start() is called and after stop() is called). Silence is represented, as * always, by a stream of samples with the value zero (0). */ -trait AudioScheduledSourceNode extends AudioNode { +@JSGlobal +abstract class AudioScheduledSourceNode extends AudioNode { /** This method specifies the exact time to start playing the tone. */ def start(): Unit = js.native From 9923b6be333ec402dc6cd0d2501f671a4d0fc2ff Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 29 Dec 2023 16:44:17 +0000 Subject: [PATCH 35/42] MediaElementAudioSourceNode mediaElement should be a def. --- api-reports/2_12.txt | 2 +- api-reports/2_13.txt | 2 +- .../scala/org/scalajs/dom/MediaElementAudioSourceNode.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 6dbd0d8f6..eaa0b410d 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -16254,7 +16254,7 @@ MediaElementAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaElementAudioSourceNode[JT] val context: AudioContext MediaElementAudioSourceNode[JT] def disconnect(output: AudioNode?): Unit MediaElementAudioSourceNode[JT] def dispatchEvent(evt: Event): Boolean -MediaElementAudioSourceNode[JT] val mediaElement: HTMLMediaElement +MediaElementAudioSourceNode[JT] def mediaElement: HTMLMediaElement MediaElementAudioSourceNode[JT] val numberOfInputs: Int MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 6dbd0d8f6..eaa0b410d 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -16254,7 +16254,7 @@ MediaElementAudioSourceNode[JT] def connect(audioParam: AudioParam): Unit MediaElementAudioSourceNode[JT] val context: AudioContext MediaElementAudioSourceNode[JT] def disconnect(output: AudioNode?): Unit MediaElementAudioSourceNode[JT] def dispatchEvent(evt: Event): Boolean -MediaElementAudioSourceNode[JT] val mediaElement: HTMLMediaElement +MediaElementAudioSourceNode[JT] def mediaElement: HTMLMediaElement MediaElementAudioSourceNode[JT] val numberOfInputs: Int MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala index 5604e4029..f306ef8cb 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala @@ -22,7 +22,7 @@ import scala.scalajs.js */ @js.native trait MediaElementAudioSourceNode extends AudioNode { - val mediaElement: HTMLMediaElement = js.native + def mediaElement: HTMLMediaElement = js.native } object MediaElementAudioSourceNode { From 98af177c0175aa1c51dc5e68e139289dbdf38d78 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 29 Dec 2023 16:44:29 +0000 Subject: [PATCH 36/42] Regenerate api reports. --- api-reports/2_12.txt | 46 ++++++++++++++++++++++---------------------- api-reports/2_13.txt | 46 ++++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index eaa0b410d..e04a4792b 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -587,25 +587,25 @@ AudioParamMap[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iter AudioParamMap[JC] def keys(): js.Iterator[K] AudioParamMap[JC] def size: Int AudioParamMap[JC] def values(): js.Iterator[V] -AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit -AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioScheduledSourceNode[JT] var channelCount: Int -AudioScheduledSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode -AudioScheduledSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation -AudioScheduledSourceNode[JT] def connect(audioNode: AudioNode): Unit -AudioScheduledSourceNode[JT] def connect(audioParam: AudioParam): Unit -AudioScheduledSourceNode[JT] val context: AudioContext -AudioScheduledSourceNode[JT] def disconnect(output: AudioNode?): Unit -AudioScheduledSourceNode[JT] def dispatchEvent(evt: Event): Boolean -AudioScheduledSourceNode[JT] val numberOfInputs: Int -AudioScheduledSourceNode[JT] val numberOfOutputs: Int -AudioScheduledSourceNode[JT] var onended: js.Function1[Event, _] -AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit -AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioScheduledSourceNode[JT] def start(): Unit -AudioScheduledSourceNode[JT] def start(when: Double): Unit -AudioScheduledSourceNode[JT] def stop(): Unit -AudioScheduledSourceNode[JT] def stop(when: Double): Unit +AudioScheduledSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JC] var channelCount: Int +AudioScheduledSourceNode[JC] var channelCountMode: AudioNodeChannelCountMode +AudioScheduledSourceNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +AudioScheduledSourceNode[JC] def connect(audioNode: AudioNode): Unit +AudioScheduledSourceNode[JC] def connect(audioParam: AudioParam): Unit +AudioScheduledSourceNode[JC] val context: AudioContext +AudioScheduledSourceNode[JC] def disconnect(output: AudioNode?): Unit +AudioScheduledSourceNode[JC] def dispatchEvent(evt: Event): Boolean +AudioScheduledSourceNode[JC] val numberOfInputs: Int +AudioScheduledSourceNode[JC] val numberOfOutputs: Int +AudioScheduledSourceNode[JC] var onended: js.Function1[Event, _] +AudioScheduledSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JC] def start(): Unit +AudioScheduledSourceNode[JC] def start(when: Double): Unit +AudioScheduledSourceNode[JC] def stop(): Unit +AudioScheduledSourceNode[JC] def stop(when: Double): Unit AudioTimestamp[JT] var contextTime: Double AudioTimestamp[JT] var performanceTime: Double AudioTrack[JT] var enabled: Boolean @@ -625,11 +625,11 @@ AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioWorklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +AudioWorkletGlobalScope[JC] def currentFrame: Int +AudioWorkletGlobalScope[JC] def currentTime: Double +AudioWorkletGlobalScope[JC] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit +AudioWorkletGlobalScope[JC] def sampleRate: Float AudioWorkletGlobalScope[JO] def globalThis: AudioWorkletGlobalScope -AudioWorkletGlobalScope[JT] def currentFrame: Int -AudioWorkletGlobalScope[JT] def currentTime: Double -AudioWorkletGlobalScope[JT] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit -AudioWorkletGlobalScope[JT] def sampleRate: Float AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioWorkletNode[JC] var channelCount: Int diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index eaa0b410d..e04a4792b 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -587,25 +587,25 @@ AudioParamMap[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iter AudioParamMap[JC] def keys(): js.Iterator[K] AudioParamMap[JC] def size: Int AudioParamMap[JC] def values(): js.Iterator[V] -AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit -AudioScheduledSourceNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioScheduledSourceNode[JT] var channelCount: Int -AudioScheduledSourceNode[JT] var channelCountMode: AudioNodeChannelCountMode -AudioScheduledSourceNode[JT] var channelInterpretation: AudioNodeChannelInterpretation -AudioScheduledSourceNode[JT] def connect(audioNode: AudioNode): Unit -AudioScheduledSourceNode[JT] def connect(audioParam: AudioParam): Unit -AudioScheduledSourceNode[JT] val context: AudioContext -AudioScheduledSourceNode[JT] def disconnect(output: AudioNode?): Unit -AudioScheduledSourceNode[JT] def dispatchEvent(evt: Event): Boolean -AudioScheduledSourceNode[JT] val numberOfInputs: Int -AudioScheduledSourceNode[JT] val numberOfOutputs: Int -AudioScheduledSourceNode[JT] var onended: js.Function1[Event, _] -AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit -AudioScheduledSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit -AudioScheduledSourceNode[JT] def start(): Unit -AudioScheduledSourceNode[JT] def start(when: Double): Unit -AudioScheduledSourceNode[JT] def stop(): Unit -AudioScheduledSourceNode[JT] def stop(when: Double): Unit +AudioScheduledSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JC] var channelCount: Int +AudioScheduledSourceNode[JC] var channelCountMode: AudioNodeChannelCountMode +AudioScheduledSourceNode[JC] var channelInterpretation: AudioNodeChannelInterpretation +AudioScheduledSourceNode[JC] def connect(audioNode: AudioNode): Unit +AudioScheduledSourceNode[JC] def connect(audioParam: AudioParam): Unit +AudioScheduledSourceNode[JC] val context: AudioContext +AudioScheduledSourceNode[JC] def disconnect(output: AudioNode?): Unit +AudioScheduledSourceNode[JC] def dispatchEvent(evt: Event): Boolean +AudioScheduledSourceNode[JC] val numberOfInputs: Int +AudioScheduledSourceNode[JC] val numberOfOutputs: Int +AudioScheduledSourceNode[JC] var onended: js.Function1[Event, _] +AudioScheduledSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +AudioScheduledSourceNode[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +AudioScheduledSourceNode[JC] def start(): Unit +AudioScheduledSourceNode[JC] def start(when: Double): Unit +AudioScheduledSourceNode[JC] def stop(): Unit +AudioScheduledSourceNode[JC] def stop(when: Double): Unit AudioTimestamp[JT] var contextTime: Double AudioTimestamp[JT] var performanceTime: Double AudioTrack[JT] var enabled: Boolean @@ -625,11 +625,11 @@ AudioTrackList[JT] var onremovetrack: js.Function1[TrackEvent, Any] AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioWorklet[JC] def addModule(moduleURL: String, options: WorkletOptions?): js.Promise[Unit] +AudioWorkletGlobalScope[JC] def currentFrame: Int +AudioWorkletGlobalScope[JC] def currentTime: Double +AudioWorkletGlobalScope[JC] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit +AudioWorkletGlobalScope[JC] def sampleRate: Float AudioWorkletGlobalScope[JO] def globalThis: AudioWorkletGlobalScope -AudioWorkletGlobalScope[JT] def currentFrame: Int -AudioWorkletGlobalScope[JT] def currentTime: Double -AudioWorkletGlobalScope[JT] def registerProcessor(name: String, processorCtor: js.Dynamic): Unit -AudioWorkletGlobalScope[JT] def sampleRate: Float AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit AudioWorkletNode[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit AudioWorkletNode[JC] var channelCount: Int From 18a6f7d05cf41a11fb1d68bd39aed0a7e5c4fb0b Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 29 Dec 2023 16:46:32 +0000 Subject: [PATCH 37/42] Add docs for ReadOnlyMapLike. --- dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala index 14fe42240..d4ba7e1a4 100644 --- a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala +++ b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala @@ -9,6 +9,12 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ +/** Browser Map-like objects (or "maplike objects") are Web API interfaces that behave in many ways like a Map. + * + * Just like Map, entries can be iterated in the same order that they were added to the object. Map-like objects and + * Map also have properties and methods that share the same name and behavior. However unlike Map they only allow + * specific predefined types for the keys and values of each entry. + */ @js.native trait ReadOnlyMapLike[K, V] extends js.Iterable[js.Tuple2[K, V]] { From df8e9cf1d7e93a9310b9e957388b36886a75cc5f Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 28 Jan 2024 18:22:55 +0000 Subject: [PATCH 38/42] Reformat doc comments. --- dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala | 1 - dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala | 1 - .../scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala | 1 - dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala | 1 - dom/src/main/scala/org/scalajs/dom/Worklet.scala | 1 - dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala | 1 - 11 files changed, 11 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala index 1b7e777f8..d411a50a6 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamDescriptor.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala index 576bef1d5..2bc770d8f 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioParamMap.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala index 9aa81f0ad..14d73a144 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorklet.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala index 34e4256fd..4293a69c0 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletGlobalScope.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala index 0bd73542d..36eb67896 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNode.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala index 7012f0416..493facbce 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletNodeOptions.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala index 33d6e34c0..795b2c372 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessor.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala index 0b4668691..f2f190920 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioWorkletProcessorOptions.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala index d4ba7e1a4..cf274c2aa 100644 --- a/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala +++ b/dom/src/main/scala/org/scalajs/dom/ReadOnlyMapLike.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/Worklet.scala b/dom/src/main/scala/org/scalajs/dom/Worklet.scala index 7c3de29aa..918cb7650 100644 --- a/dom/src/main/scala/org/scalajs/dom/Worklet.scala +++ b/dom/src/main/scala/org/scalajs/dom/Worklet.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js diff --git a/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala index d8b8de37a..0d872ba3c 100644 --- a/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/WorkletOptions.scala @@ -3,7 +3,6 @@ * * Everything else is under the MIT License http://opensource.org/licenses/MIT */ - package org.scalajs.dom import scala.scalajs.js From 523266a5a61507fe84ac8581ab4027d78f608a73 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 28 Jan 2024 18:24:32 +0000 Subject: [PATCH 39/42] Remove redundant comment. --- dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala index 46dc5e8e6..b7d99be58 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala @@ -33,7 +33,7 @@ trait OscillatorNode extends AudioScheduledSourceNode { var detune: AudioParam = js.native /** Represents the shape of the oscillator wave generated. Different waves will produce different tones. */ - var `type`: OscillatorNodeType = js.native // Not sure if this is correct ... + var `type`: OscillatorNodeType = js.native /** Used to point to a PeriodicWave defining a periodic waveform that can be used to shape the oscillator's output, * when type = "custom" is used. From 07dcf43db80a874c807b78ef834b71c1033650c5 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 28 Jan 2024 18:36:59 +0000 Subject: [PATCH 40/42] Remove channelCount, channelCountMode and channelInterpretation. --- .../dom/AudioBufferSourceNodeOptions.scala | 17 ----------------- .../scala/org/scalajs/dom/GainNodeOptions.scala | 17 ----------------- .../MediaElementAudioSourceNodeOptions.scala | 16 ---------------- .../org/scalajs/dom/OscillatorNodeOptions.scala | 17 ----------------- 4 files changed, 67 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala index 1da57b32b..1f0239d3e 100644 --- a/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala @@ -45,21 +45,4 @@ trait AudioBufferSourceNodeOptions extends js.Object { * compound parameter with detune. Its nominal range is (-∞ to +∞). */ var playbackRate: js.UndefOr[Double] = js.undefined - - /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to - * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend - * on the value of channelCountMode. - */ - var channelCount: js.UndefOr[Int] = js.undefined - - /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. - * (See AudioNode.channelCountMode for more information including default values.) - */ - var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined - - /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio - * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See - * AudioNode.channelCountMode for more information including default values.) - */ - var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala index 7dc1c35ac..feaf889ec 100644 --- a/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala @@ -11,21 +11,4 @@ trait GainNodeOptions extends js.Object { /** The amount of gain to apply. This parameter is a- rate and it's nominal range is (-∞,+∞). The default is 1 */ var gain: js.UndefOr[Double] = js.undefined - - /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to - * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend - * on the value of channelCountMode. - */ - var channelCount: js.UndefOr[Int] = js.undefined - - /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. - * (See AudioNode.channelCountMode for more information including default values.) - */ - var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined - - /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio - * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See - * AudioNode.channelCountMode for more information including default values.) - */ - var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala index e6868122b..6fe47b069 100644 --- a/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala @@ -12,20 +12,4 @@ trait MediaElementAudioSourceNodeOptions extends js.Object { /** An HTMLMediaElement that will be used as the source for the audio. */ var mediaElement: HTMLMediaElement - /** An integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs - * to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend on the - * value of channelCountMode. - */ - var channelCount: js.UndefOr[Int] = js.undefined - - /** Describes the way channels must be matched between the node's inputs and outputs. (See AudioNode.channelCountMode - * for more information including default values.) - */ - var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined - - /** Describes the meaning of the channels. This interpretation will define how audio up-mixing and down-mixing will - * happen. The possible values are "speakers" or "discrete". (See AudioNode.channelInterpretation for more - * information including default values.) - */ - var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala index c3c8d631e..83e999a82 100644 --- a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala @@ -22,21 +22,4 @@ trait OscillatorNodeOptions extends js.Object { /** An arbitrary period waveform described by a PeriodicWave object. */ var periodicWave: js.UndefOr[PeriodicWave] = js.undefined - - /** Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to - * any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend - * on the value of channelCountMode. - */ - var channelCount: js.UndefOr[Int] = js.undefined - - /** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. - * (See AudioNode.channelCountMode for more information including default values.) - */ - var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined - - /** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio - * up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See - * AudioNode.channelCountMode for more information including default values.) - */ - var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined } From b3a694e2aef3b7463f794fc5a7d6d4f53449ab9f Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 28 Jan 2024 18:50:16 +0000 Subject: [PATCH 41/42] Refactor enums for Scala 3. --- .../dom/AudioNodeChannelCountMode.scala | 0 .../dom/AudioNodeChannelInterpretation.scala | 0 .../dom/AudioParamAutomationRate.scala | 0 .../org/scalajs/dom/OscillatorNodeType.scala | 0 .../dom/AudioNodeChannelCountMode.scala | 29 ++++++++++++++++++ .../dom/AudioNodeChannelInterpretation.scala | 27 +++++++++++++++++ .../dom/AudioParamAutomationRate.scala | 21 +++++++++++++ .../org/scalajs/dom/OscillatorNodeType.scala | 30 +++++++++++++++++++ 8 files changed, 107 insertions(+) rename dom/src/main/{scala => scala-2}/org/scalajs/dom/AudioNodeChannelCountMode.scala (100%) rename dom/src/main/{scala => scala-2}/org/scalajs/dom/AudioNodeChannelInterpretation.scala (100%) rename dom/src/main/{scala => scala-2}/org/scalajs/dom/AudioParamAutomationRate.scala (100%) rename dom/src/main/{scala => scala-2}/org/scalajs/dom/OscillatorNodeType.scala (100%) create mode 100644 dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelCountMode.scala create mode 100644 dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelInterpretation.scala create mode 100644 dom/src/main/scala-3/org/scalajs/dom/AudioParamAutomationRate.scala create mode 100644 dom/src/main/scala-3/org/scalajs/dom/OscillatorNodeType.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala b/dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelCountMode.scala similarity index 100% rename from dom/src/main/scala/org/scalajs/dom/AudioNodeChannelCountMode.scala rename to dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelCountMode.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala b/dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelInterpretation.scala similarity index 100% rename from dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala rename to dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelInterpretation.scala diff --git a/dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala b/dom/src/main/scala-2/org/scalajs/dom/AudioParamAutomationRate.scala similarity index 100% rename from dom/src/main/scala/org/scalajs/dom/AudioParamAutomationRate.scala rename to dom/src/main/scala-2/org/scalajs/dom/AudioParamAutomationRate.scala diff --git a/dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala b/dom/src/main/scala-2/org/scalajs/dom/OscillatorNodeType.scala similarity index 100% rename from dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala rename to dom/src/main/scala-2/org/scalajs/dom/OscillatorNodeType.scala diff --git a/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelCountMode.scala b/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelCountMode.scala new file mode 100644 index 000000000..be34d2342 --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelCountMode.scala @@ -0,0 +1,29 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +/** Represents an enumerated value describing the way channels must be matched between the AudioNode's inputs and + * outputs. + */ +opaque type AudioNodeChannelCountMode <: String = String + +object AudioNodeChannelCountMode { + + /** The number of channels is equal to the maximum number of channels of all connections. In this case, channelCount + * is ignored and only up-mixing happens. + */ + val max: AudioNodeChannelCountMode = "max" + + /** The number of channels is equal to the maximum number of channels of all connections, clamped to the value of + * channelCount. + */ + val `clamped-max`: AudioNodeChannelCountMode = "clamped-max" + + /** The number of channels is defined by the value of channelCount. */ + val explicit: AudioNodeChannelCountMode = "explicit" +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelInterpretation.scala b/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelInterpretation.scala new file mode 100644 index 000000000..bcf5485d0 --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelInterpretation.scala @@ -0,0 +1,27 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +/** Represents an enumerated value describing how input channels are mapped to output channels when the number of + * inputs/outputs is different. For example, this setting defines how a mono input will be up-mixed to a stereo or 5.1 + * channel output, or how a quad channel input will be down-mixed to a stereo or mono output. + */ +opaque type AudioNodeChannelInterpretation <: String = String + +object AudioNodeChannelInterpretation { + + /** Use set of "standard" mappings for combinations of common speaker input and outputs setups (mono, stereo, quad, + * 5.1). For example, with this setting a mono channel input will output to both channels of a stereo output. + */ + val speakers: AudioNodeChannelInterpretation = "speakers" + + /** Input channels are mapped to output channels in order. If there are more inputs that outputs the additional inputs + * are dropped; if there are fewer than the unused outputs are silent. + */ + val discrete: AudioNodeChannelInterpretation = "discrete" +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/AudioParamAutomationRate.scala b/dom/src/main/scala-3/org/scalajs/dom/AudioParamAutomationRate.scala new file mode 100644 index 000000000..7778ac94e --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/AudioParamAutomationRate.scala @@ -0,0 +1,21 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +opaque type AudioParamAutomationRate <: String = String + +object AudioParamAutomationRate { + + /** An a-rate [[AudioParam]] takes the current audio parameter value for each sample frame of the audio signal. */ + val `a-rate`: AudioParamAutomationRate = "a-rate" + + /** A k-rate [[AudioParam]] uses the same initial audio parameter value for the whole block processed; that is, 128 + * sample frames. In other words, the same value applies to every frame in the audio as it's processed by the node. + */ + val `k-rate`: AudioParamAutomationRate = "k-rate" +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/OscillatorNodeType.scala b/dom/src/main/scala-3/org/scalajs/dom/OscillatorNodeType.scala new file mode 100644 index 000000000..e0dd4d09a --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/OscillatorNodeType.scala @@ -0,0 +1,30 @@ +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js + +opaque type OscillatorNodeType <: String = String + +object OscillatorNodeType { + + /** A sine wave. This is the default value. */ + val sine: OscillatorNodeType = "sine" + + /** A square wave with a duty cycle of 0.5; that is, the signal is "high" for half of each period. */ + val square: OscillatorNodeType = "square" + + /** A sawtooth wave. */ + val sawtooth: OscillatorNodeType = "sawtooth" + + /** A triangle wave. */ + val triangle: OscillatorNodeType = "triangle" + + /** A custom waveform. You never set type to custom manually; instead, use the setPeriodicWave() method to provide the + * data representing the waveform. Doing so automatically sets the type to custom. + */ + val custom: OscillatorNodeType = "custom" +} From e3051296b602f4a378fa0e947334dbd845a5d3a5 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Sun, 28 Jan 2024 19:02:12 +0000 Subject: [PATCH 42/42] Regenerate API reports. --- api-reports/2_12.txt | 12 ------------ api-reports/2_13.txt | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index e04a4792b..17d292297 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -449,9 +449,6 @@ AudioBufferSourceNode[JT] def stop(): Unit AudioBufferSourceNode[JT] def stop(when: Double): Unit AudioBufferSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[AudioBufferSourceNodeOptions]?): AudioBufferSourceNode AudioBufferSourceNodeOptions[JT] var buffer: js.UndefOr[AudioBuffer] -AudioBufferSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] -AudioBufferSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -AudioBufferSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] AudioBufferSourceNodeOptions[JT] var detune: js.UndefOr[Double] AudioBufferSourceNodeOptions[JT] var loop: js.UndefOr[Boolean] AudioBufferSourceNodeOptions[JT] var loopEnd: js.UndefOr[Double] @@ -2479,9 +2476,6 @@ GainNode[JT] val numberOfOutputs: Int GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit GainNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions]?): GainNode -GainNodeOptions[JT] var channelCount: js.UndefOr[Int] -GainNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -GainNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] GainNodeOptions[JT] var gain: js.UndefOr[Double] Gamepad[JT] val axes: js.Array[Double] Gamepad[JT] val buttons: js.Array[GamepadButton] @@ -16260,9 +16254,6 @@ MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaElementAudioSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[MediaElementAudioSourceNodeOptions]?): MediaElementAudioSourceNode -MediaElementAudioSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] -MediaElementAudioSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -MediaElementAudioSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] MediaElementAudioSourceNodeOptions[JT] var mediaElement: HTMLMediaElement MediaError[JC] def code: Int MediaError[JO] val MEDIA_ERR_ABORTED: Int @@ -16825,9 +16816,6 @@ OscillatorNode[JT] def stop(): Unit OscillatorNode[JT] def stop(when: Double): Unit OscillatorNode[JT] var `type`: OscillatorNodeType OscillatorNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions]?): OscillatorNode -OscillatorNodeOptions[JT] var channelCount: js.UndefOr[Int] -OscillatorNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -OscillatorNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] OscillatorNodeOptions[JT] var detune: js.UndefOr[Double] OscillatorNodeOptions[JT] var frequency: js.UndefOr[Double] OscillatorNodeOptions[JT] var periodicWave: js.UndefOr[PeriodicWave] diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index e04a4792b..17d292297 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -449,9 +449,6 @@ AudioBufferSourceNode[JT] def stop(): Unit AudioBufferSourceNode[JT] def stop(when: Double): Unit AudioBufferSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[AudioBufferSourceNodeOptions]?): AudioBufferSourceNode AudioBufferSourceNodeOptions[JT] var buffer: js.UndefOr[AudioBuffer] -AudioBufferSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] -AudioBufferSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -AudioBufferSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] AudioBufferSourceNodeOptions[JT] var detune: js.UndefOr[Double] AudioBufferSourceNodeOptions[JT] var loop: js.UndefOr[Boolean] AudioBufferSourceNodeOptions[JT] var loopEnd: js.UndefOr[Double] @@ -2479,9 +2476,6 @@ GainNode[JT] val numberOfOutputs: Int GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit GainNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit GainNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions]?): GainNode -GainNodeOptions[JT] var channelCount: js.UndefOr[Int] -GainNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -GainNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] GainNodeOptions[JT] var gain: js.UndefOr[Double] Gamepad[JT] val axes: js.Array[Double] Gamepad[JT] val buttons: js.Array[GamepadButton] @@ -16260,9 +16254,6 @@ MediaElementAudioSourceNode[JT] val numberOfOutputs: Int MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit MediaElementAudioSourceNode[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit MediaElementAudioSourceNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[MediaElementAudioSourceNodeOptions]?): MediaElementAudioSourceNode -MediaElementAudioSourceNodeOptions[JT] var channelCount: js.UndefOr[Int] -MediaElementAudioSourceNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -MediaElementAudioSourceNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] MediaElementAudioSourceNodeOptions[JT] var mediaElement: HTMLMediaElement MediaError[JC] def code: Int MediaError[JO] val MEDIA_ERR_ABORTED: Int @@ -16825,9 +16816,6 @@ OscillatorNode[JT] def stop(): Unit OscillatorNode[JT] def stop(when: Double): Unit OscillatorNode[JT] var `type`: OscillatorNodeType OscillatorNode[SO] def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions]?): OscillatorNode -OscillatorNodeOptions[JT] var channelCount: js.UndefOr[Int] -OscillatorNodeOptions[JT] var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] -OscillatorNodeOptions[JT] var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] OscillatorNodeOptions[JT] var detune: js.UndefOr[Double] OscillatorNodeOptions[JT] var frequency: js.UndefOr[Double] OscillatorNodeOptions[JT] var periodicWave: js.UndefOr[PeriodicWave]