Skip to content

Commit 45ad9b8

Browse files
authored
Merge pull request #83 from julien-deoux/AudioDestinationNode
Introduction of the AudioDestinationNode module
2 parents 094da2c + 966e80f commit 45ad9b8

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

src/WebAudioAPI/AudioDestinationNode.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
open WebAudioAPI
2+
3+
include AudioNode.Impl({
4+
type t = audioDestinationNode
5+
})

tests/WebAudioAPI/AudioDestinationNode__.test.js

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
open WebAudioAPI
2+
3+
let ctx = AudioContext.make()
4+
5+
let destinationNode = ctx.destination->AudioDestinationNode.asAudioNode
6+
let context = AudioContext.asBaseAudioContext(ctx)
7+
8+
let osc = OscillatorNode.make(
9+
~context,
10+
~options={
11+
type_: Sine,
12+
frequency: 440.0,
13+
},
14+
)
15+
let gain = GainNode.make(
16+
~context,
17+
~options={
18+
gain: 0.3,
19+
},
20+
)
21+
let _ = gain->GainNode.connect(~destinationNode)
22+
let _ =
23+
osc
24+
->OscillatorNode.asAudioScheduledSourceNode
25+
->AudioScheduledSourceNode.connect(~destinationNode=gain->GainNode.asAudioNode)
26+
27+
osc->OscillatorNode.start

0 commit comments

Comments
 (0)