-
Notifications
You must be signed in to change notification settings - Fork 161
Audio API changes #797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yilinwei
wants to merge
42
commits into
scala-js:main
Choose a base branch
from
yilinwei:base-audio
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Audio API changes #797
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
4f524b8
backup
yilinwei 8b1d132
backup
yilinwei b44eaa8
backup
yilinwei 2aaf2ed
Switch back to using traits for now.
yilinwei b91df37
typo.
yilinwei a4edff5
Switch encoding for mima.
yilinwei 9887ce0
Check-in API report
yilinwei 081534d
BlobEvent and MediaRecorder.
zainab-ali fca6713
Make sure `BlobEvent` is class.
yilinwei 4dda4bf
`data` is required.
yilinwei a4cfb9a
Add `AudioWorkletNode` and associated options.
yilinwei 0099ad3
Add `Worklet` and `AudioWorklet`.
yilinwei e8b3650
Fix signature
yilinwei 1178935
Add `AudioParamDescriptor`.
yilinwei fdb9aad
Add `defaultValue` for `AudioParamDescriptor`.
yilinwei c067de2
Make sure to extend `js.Object`.
yilinwei ba8f619
Add `AudioWorkletGlobalScope`.
yilinwei 3e32f25
`AudioWorkletNode` should not be abstract.
yilinwei 42275a7
Make `ReadOnlyMapLike` extend `js.Iterable`.
yilinwei 0e90800
`self` does not yet exist within the `Worklet` contexts.
yilinwei f860eaa
Correct `ReadOnlyMapLike` signature `forEach`.
yilinwei b548118
Add docs.
zainab-ali 2d1f240
Add docs.
zainab-ali f7adab3
Doc improvements.
zainab-ali 56d513b
Add js.native annotation to AudioParamAutomationRate.
zainab-ali 6781565
More docs.
zainab-ali 7d6eb4e
Add js.native annotation to AudioTimestamp.
zainab-ali d159170
Correct type of params for AudioWorkletProcessor.
zainab-ali 3bac38d
WorkletOptions should extend js.Object.
zainab-ali e32a80c
Add MediaRecorder and options.
zainab-ali c221e2b
Correct scaladoc.
zainab-ali 824092d
Api reports.
zainab-ali e637830
AudioWorkletGlobalScope should be an abstract class.
zainab-ali 314c67b
AudioScheduledSourceNode should be an abstract class.
zainab-ali 9923b6b
MediaElementAudioSourceNode mediaElement should be a def.
zainab-ali 98af177
Regenerate api reports.
zainab-ali 18a6f7d
Add docs for ReadOnlyMapLike.
zainab-ali df8e9cf
Reformat doc comments.
zainab-ali 523266a
Remove redundant comment.
zainab-ali 07dcf43
Remove channelCount, channelCountMode and channelInterpretation.
zainab-ali b3a694e
Refactor enums for Scala 3.
zainab-ali e305129
Regenerate API reports.
zainab-ali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelCountMode.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
@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] | ||
} |
28 changes: 28 additions & 0 deletions
28
dom/src/main/scala-2/org/scalajs/dom/AudioNodeChannelInterpretation.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
/** 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] | ||
} |
22 changes: 22 additions & 0 deletions
22
dom/src/main/scala-2/org/scalajs/dom/AudioParamAutomationRate.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** 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 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] | ||
} |
31 changes: 31 additions & 0 deletions
31
dom/src/main/scala-2/org/scalajs/dom/OscillatorNodeType.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** 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 { | ||
|
||
/** 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] | ||
} |
29 changes: 29 additions & 0 deletions
29
dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelCountMode.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
27 changes: 27 additions & 0 deletions
27
dom/src/main/scala-3/org/scalajs/dom/AudioNodeChannelInterpretation.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
21 changes: 21 additions & 0 deletions
21
dom/src/main/scala-3/org/scalajs/dom/AudioParamAutomationRate.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
30 changes: 30 additions & 0 deletions
30
dom/src/main/scala-3/org/scalajs/dom/OscillatorNodeType.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNodeOptions.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** 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 { | ||
|
||
/** 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 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.