Skip to content

Commit 2246983

Browse files
Experiment - why do we recreate this?
1 parent 7b05a18 commit 2246983

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/board/audio/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ export class Audio {
6767
}
6868

6969
async createAudioContextFromUserInteraction(): Promise<void> {
70-
this.context = new (window.AudioContext || window.webkitAudioContext)({
71-
// The highest rate is the sound expression synth.
72-
sampleRate: 44100,
73-
});
70+
this.context =
71+
this.context ??
72+
new (window.AudioContext || window.webkitAudioContext)({
73+
// The highest rate is the sound expression synth.
74+
sampleRate: 44100,
75+
});
7476
if (this.context.state === "suspended") {
7577
return this.context.resume();
7678
}

0 commit comments

Comments
 (0)