We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a338ef commit 09d8c84Copy full SHA for 09d8c84
src/board/audio/index.ts
@@ -125,10 +125,7 @@ export class Audio {
125
}
126
127
setAmplitudeU10(amplitudeU10: number) {
128
- if (this.oscillator) {
129
- this.oscillator.stop();
130
- this.oscillator = undefined;
131
- }
+ this.stopOscillator();
132
if (amplitudeU10) {
133
this.oscillator = this.context!.createOscillator();
134
this.oscillator.type = "sine";
@@ -139,7 +136,14 @@ export class Audio {
139
136
140
137
141
138
boardStopped() {
142
- this.oscillator?.stop();
+ }
+
+ private stopOscillator() {
143
+ if (this.oscillator) {
144
+ this.oscillator.stop();
145
+ this.oscillator = undefined;
146
147
148
149
0 commit comments