Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
yilinwei committed Jul 22, 2023
1 parent 8b1d132 commit 6e3657b
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Original file line number Diff line number Diff line change
Expand Up @@ -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]

}
4 changes: 4 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/AudioParam.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 5 additions & 2 deletions dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.)
Expand All @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/OscillatorNodeOptions.scala
Original file line number Diff line number Diff line change
@@ -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

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
}

19 changes: 19 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/OscillatorNodeType.scala
Original file line number Diff line number Diff line change
@@ -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]
}

0 comments on commit 6e3657b

Please sign in to comment.