Skip to content

Commit 01e6b8f

Browse files
maciejmakowski2003Maciej Makowski
and
Maciej Makowski
authored
Fix/piano example (#153)
* feat: declared macros in CMakeLists.txt * feat: implemented VectorMath * feat: introduce VectorMath methods in audio processing functions * refactor: small refactoring in VectorMath.cpp * refactor: yarn format * fix: removed nodes disconnect and added closing context --------- Co-authored-by: Maciej Makowski <maciej.makowski@swmansion.com>
1 parent f20aa62 commit 01e6b8f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

apps/common-app/src/examples/Piano/Piano.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ const Piano: FC = () => {
3030
});
3131

3232
notesRef.current = newNotes as Record<KeyName, PianoNote>;
33+
34+
return () => {
35+
audioContextRef.current?.close();
36+
};
3337
}, []);
3438

3539
return (

apps/common-app/src/examples/Piano/PianoNote.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ class PianoNote {
4949

5050
this.oscillator.stop(tNow + 0.1);
5151

52-
this.gain.disconnect(this.audioContext.destination);
53-
this.oscillator.disconnect(this.gain);
54-
5552
this.oscillator = null;
5653
this.gain = null;
5754
}

apps/common-app/src/examples/SharedUtils/soundEngines/HiHat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class HiHat implements SoundEngine {
4141
gain.gain.exponentialRampToValueAtTime(this.volume * 0.33, time + 0.03);
4242
gain.gain.exponentialRampToValueAtTime(this.volume * 0.0001, time + 0.3);
4343
gain.gain.setValueAtTime(0, time + 0.3 + 0.001);
44-
//number of inputs of filter is 1 on android- check it
44+
4545
oscillator.connect(bandpassFilter);
4646
bandpassFilter.connect(highpassFilter);
4747
highpassFilter.connect(gain);

0 commit comments

Comments
 (0)