Skip to content

Commit 8b1d132

Browse files
committed
backup
1 parent 4f524b8 commit 8b1d132

13 files changed

+65
-25
lines changed

dom/src/main/scala/org/scalajs/dom/AudioBufferSourceNode.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.scalajs.dom
77

88
import scala.scalajs.js
9+
import scala.scalajs.js.annotation._
910

1011
/** AudioBufferSourceNode has no input and exactly one output. The number of channels in the output corresponds to the
1112
* 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
2324
* - Number of outputs: 1
2425
* - Channel count: defined by the associated AudioBuffer
2526
*/
27+
@JSGlobal
2628
@js.native
27-
trait AudioBufferSourceNode extends AudioScheduledSourceNode {
29+
class AudioBufferSourceNode(context: BaseAudioContext, options: AudioBufferSourceNodeOptions = js.native)
30+
extends AudioScheduledSourceNode {
2831

2932
/** Is an AudioBuffer that defines the audio asset to be played, or when set to the value null, defines a single
3033
* channel of silence.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available
2+
* under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/
3+
*
4+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
5+
*/
6+
package org.scalajs.dom
7+
8+
import scala.scalajs.js
9+
10+
trait AudioBufferSourceNodeOptions extends js.Object {
11+
var buffer: js.UndefOr[AudioBuffer] = js.undefined
12+
var loop: js.UndefOr[Boolean] = js.undefined
13+
var loopStart: js.UndefOr[Double] = js.undefined
14+
var loopEnd: js.UndefOr[Double] = js.undefined
15+
var detune: js.UndefOr[Double] = js.undefined
16+
var playbackRate: js.UndefOr[Double] = js.undefined
17+
}
18+

dom/src/main/scala/org/scalajs/dom/AudioContext.scala

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class AudioContext extends BaseAudioContext {
5757
/** Closes the audio context, releasing any system audio resources that it uses. */
5858
def close(): js.Promise[Unit] = js.native
5959

60-
6160
// TODO docs
6261
def getOutputTimestamp: AudioTimestamp = js.native
6362
}

dom/src/main/scala/org/scalajs/dom/AudioNode.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ trait AudioNode extends EventTarget {
4747

4848
/** Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs.
4949
*/
50-
var channelCountMode: ChannelCountMode = js.native
50+
var channelCountMode: AudioNodeChannelCountMode = js.native
5151

5252
/** Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio
5353
* up-mixing and down-mixing will happen.
5454
*
5555
* The possible values are "speakers" or "discrete".
5656
*/
57-
var channelInterpretation: ChannelInterpretation = js.native
57+
var channelInterpretation: AudioNodeChannelInterpretation = js.native
5858

5959
/** Allows us to connect one output of this node to one input of another node. */
6060
def connect(audioNode: AudioNode): Unit = js.native
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available
2+
* under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/
3+
*
4+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
5+
*/
6+
package org.scalajs.dom
7+
8+
import scala.scalajs.js
9+
10+
@js.native
11+
sealed trait AudioNodeChannelCountMode extends js.Any
12+
13+
object AudioNodeChannelCountMode {
14+
val max: AudioNodeChannelCountMode = "max".asInstanceOf[AudioNodeChannelCountMode]
15+
val `clamped-max`: AudioNodeChannelCountMode = "clamped-max".asInstanceOf[AudioNodeChannelCountMode]
16+
val explicit: AudioNodeChannelCountMode = "explicit".asInstanceOf[AudioNodeChannelCountMode]
17+
18+
}

dom/src/main/scala/org/scalajs/dom/ChannelCountMode.scala renamed to dom/src/main/scala/org/scalajs/dom/AudioNodeChannelInterpretation.scala

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ package org.scalajs.dom
88
import scala.scalajs.js
99

1010
@js.native
11-
sealed trait ChannelCountMode extends js.Any
12-
13-
object ChannelCountMode {
14-
val max: ChannelCountMode = "max".asInstanceOf[ChannelCountMode]
15-
val `clamped-max`: ChannelCountMode = "clamped-max".asInstanceOf[ChannelCountMode]
16-
val explicit: ChannelCountMode = "explicit".asInstanceOf[ChannelCountMode]
11+
sealed trait AudioNodeChannelInterpretation extends js.Any
1712

13+
object AudioNodeChannelInterpretation {
14+
val speakers: AudioNodeChannelInterpretation = "speakers".asInstanceOf[AudioNodeChannelInterpretation]
15+
val discrete: AudioNodeChannelInterpretation = "discrete".asInstanceOf[AudioNodeChannelInterpretation]
1816
}

dom/src/main/scala/org/scalajs/dom/BaseAudioContext.scala

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ package org.scalajs.dom
77

88
import scala.scalajs.js
99

10-
/** 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.
11-
12-
A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. */
10+
/** The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline
11+
* audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use
12+
* BaseAudioContext directly — you'd use its features via one of these two inheriting interfaces.
13+
*
14+
* A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface.
15+
*/
1316
@js.native
1417
trait BaseAudioContext extends EventTarget {
1518

dom/src/main/scala/org/scalajs/dom/ConstantSourceNode.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import scala.scalajs.js
1010
@js.native
1111
trait ConstantSourceNode extends AudioScheduledSourceNode {
1212

13-
// TODO
13+
// TODO
1414
val offset: AudioParam = js.native
1515

1616
}

dom/src/main/scala/org/scalajs/dom/GainNode.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.scalajs.dom
77

88
import scala.scalajs.js
9+
import scala.scalajs.js.annotation._
910

1011
/** The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given
1112
* 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
2324
* - Channel count: 2 (not used in the default count mode)
2425
* - Channel interpretation: "speakers"
2526
*/
27+
@JSGlobal
2628
@js.native
27-
trait GainNode extends AudioNode {
29+
class GainNode(context: BaseAudioContext, options: GainNodeOptions = js.native) extends AudioNode {
2830

2931
/** Is an a-rate AudioParam representing the amount of gain to apply. */
3032
val gain: AudioParam = js.native

dom/src/main/scala/org/scalajs/dom/ChannelInterpretation.scala renamed to dom/src/main/scala/org/scalajs/dom/GainNodeOptions.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ package org.scalajs.dom
77

88
import scala.scalajs.js
99

10-
@js.native
11-
sealed trait ChannelInterpretation extends js.Any
12-
13-
object ChannelInterpretation {
14-
val speakers: ChannelInterpretation = "speakers".asInstanceOf[ChannelInterpretation]
15-
val discrete: ChannelInterpretation = "discrete".asInstanceOf[ChannelInterpretation]
10+
trait GainNodeOptions extends js.Object {
11+
var gain: js.UndefOr[Double] = js.undefined
12+
var channelCount: js.UndefOr[Int] = js.undefined
13+
var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined
14+
var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined
1615
}

dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNode.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import scala.scalajs.js.annotation._
2323
*/
2424
@JSGlobal
2525
@js.native
26-
class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions) extends AudioNode {
26+
class MediaElementAudioSourceNode(ctx: BaseAudioContext, options: MediaElementAudioSourceNodeOptions)
27+
extends AudioNode {
2728
val mediaElement: HTMLMediaElement = js.native
2829
}

dom/src/main/scala/org/scalajs/dom/MediaElementAudioSourceNodeOptions.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import scala.scalajs.js
1010
trait MediaElementAudioSourceNodeOptions extends js.Object {
1111
var mediaElement: HTMLMediaElement
1212
var channelCount: js.UndefOr[Int] = js.undefined
13-
var channelCountMode: js.UndefOr[ChannelCountMode] = js.undefined
14-
var channelInterpretation: js.UndefOr[ChannelInterpretation] = js.undefined
13+
var channelCountMode: js.UndefOr[AudioNodeChannelCountMode] = js.undefined
14+
var channelInterpretation: js.UndefOr[AudioNodeChannelInterpretation] = js.undefined
1515
}

dom/src/main/scala/org/scalajs/dom/OfflineAudioContext.scala

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class OfflineAudioContext(numOfChannels: Int, length: Int, sampleRate: Int) exte
4242
*/
4343
def startRendering(): js.Promise[AudioBuffer] = js.native
4444

45-
4645
// Schedules a suspension of the time progression in the audio context at the specified time and returns a promise.
4746
def suspend(suspendTime: Double): js.Promise[Unit] = js.native
4847

0 commit comments

Comments
 (0)