From 9793ee3b52a7055b58a43e2d5aeab4df34d18ecb Mon Sep 17 00:00:00 2001 From: GrandpaBond <89019204+GrandpaBond@users.noreply.github.com> Date: Fri, 4 Aug 2023 08:49:40 +0100 Subject: [PATCH] Fixed test --- test.ts | 118 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/test.ts b/test.ts index 123a796..2e54725 100644 --- a/test.ts +++ b/test.ts @@ -1,10 +1,9 @@ // *********** test codes ********** -music.setBuiltInSpeakerEnabled(false); // perform the simple built-in chime flexFX -flexFX.performFlexFX("Ting", Note.G5, 250, 400, false); -flexFX.performFlexFX("Ting", Note.E5, 250, 400, false); -flexFX.performFlexFX("Ting", Note.C5, 250, 1600, false); +flexFX.performFlexFX("Ting", Note.G5, 250, 400, true); +flexFX.performFlexFX("Ting", Note.E5, 250, 400, true); +flexFX.performFlexFX("Ting", Note.C5, 250, 1600, true); pause(1000); @@ -12,11 +11,11 @@ pause(1000); flexFX.create2PartFlexFX("Miaow", 70, 50, Wave.SAWTOOTH, Attack.MEDIUM, Effect.NONE, 100, 100, Wave.SAWTOOTH, Attack.SLOW, Effect.NONE, 90, 80, 30); -flexFX.performFlexFX("Miaow", 900, 255, 1000, true); +flexFX.performFlexFX("Miaow", 900, 255, 1000, false); pause(300); -flexFX.performFlexFX("Miaow", 1100, 255, 500, true); +flexFX.performFlexFX("Miaow", 1100, 255, 500, false); pause(300); -flexFX.performFlexFX("Miaow", 800, 255, 1500, true); +flexFX.performFlexFX("Miaow", 800, 255, 1500, false); pause(1000); @@ -24,17 +23,17 @@ pause(1000); flexFX.create2PartFlexFX("Horn", 5, 50, Wave.SAWTOOTH, Attack.FAST, Effect.NONE, 100, 100, Wave.SINE, Attack.SLOW, Effect.NONE, 100, 80, 7); -flexFX.performFlexFX("Horn", Note.E3, 255, 900, true); -flexFX.performFlexFX("Horn", Note.G3, 255, 300, true); -flexFX.performFlexFX("Horn", Note.G3, 255, 1200, true); -flexFX.performFlexFX("Horn", Note.E3, 255, 900, true); -flexFX.performFlexFX("Horn", Note.D3, 255, 300, true); -flexFX.performFlexFX("Horn", Note.C3, 255, 1200, true); -flexFX.performFlexFX("Horn", Note.D3, 255, 600, true); -flexFX.performFlexFX("Horn", Note.E3, 255, 600, true); -flexFX.performFlexFX("Horn", Note.G3, 255, 600, true); -flexFX.performFlexFX("Horn", Note.E3, 255, 600, true); -flexFX.performFlexFX("Horn", Note.D3, 255, 2400, true); +flexFX.performFlexFX("Horn", Note.E3, 255, 900, false); +flexFX.performFlexFX("Horn", Note.G3, 255, 300, false); +flexFX.performFlexFX("Horn", Note.G3, 255, 1200, false); +flexFX.performFlexFX("Horn", Note.E3, 255, 900, false); +flexFX.performFlexFX("Horn", Note.D3, 255, 300, false); +flexFX.performFlexFX("Horn", Note.C3, 255, 1200, false); +flexFX.performFlexFX("Horn", Note.D3, 255, 600, false); +flexFX.performFlexFX("Horn", Note.E3, 255, 600, false); +flexFX.performFlexFX("Horn", Note.G3, 255, 600, false); +flexFX.performFlexFX("Horn", Note.E3, 255, 600, false); +flexFX.performFlexFX("Horn", Note.D3, 255, 2400, false); pause(1000); //flexFX.suspendPlaying(); @@ -43,16 +42,16 @@ pause(1000); flexFX.createDoubleFlexFX("NeeNaw", 95, 80, Wave.SAWTOOTH, Attack.SLOW, Effect.NONE, 100, 100, 70, 100, Wave.SAWTOOTH, Attack.SLOW, Effect.NONE, 75, 80, 45, 10); -flexFX.performFlexFX("NeeNaw", 800, 16, 1000, false); -flexFX.performFlexFX("NeeNaw", 800, 32, 1000, false); -flexFX.performFlexFX("NeeNaw", 800, 64, 1000, false); -flexFX.performFlexFX("NeeNaw", 800, 128, 1000, false); -flexFX.performFlexFX("NeeNaw", 800, 255, 1000, false); -flexFX.performFlexFX("NeeNaw", 790, 255, 1000, false); -flexFX.performFlexFX("NeeNaw", 780, 128, 1000, false); -flexFX.performFlexFX("NeeNaw", 780, 64, 1000, false); -flexFX.performFlexFX("NeeNaw", 780, 32, 1000, false); -flexFX.performFlexFX("NeeNaw", 780, 16, 1000, false); +flexFX.performFlexFX("NeeNaw", 800, 16, 1000, true); +flexFX.performFlexFX("NeeNaw", 800, 32, 1000, true); +flexFX.performFlexFX("NeeNaw", 800, 64, 1000, true); +flexFX.performFlexFX("NeeNaw", 800, 128, 1000, true); +flexFX.performFlexFX("NeeNaw", 800, 255, 1000, true); +flexFX.performFlexFX("NeeNaw", 790, 255, 1000, true); +flexFX.performFlexFX("NeeNaw", 780, 128, 1000, true); +flexFX.performFlexFX("NeeNaw", 780, 64, 1000, true); +flexFX.performFlexFX("NeeNaw", 780, 32, 1000, true); +flexFX.performFlexFX("NeeNaw", 780, 16, 1000, true); while(flexFX.isActive()) { // flash the blue light (sort of) basic.showIcon(IconNames.SmallDiamond); basic.showIcon(IconNames.Diamond); @@ -67,52 +66,55 @@ flexFX.create3PartFlexFX("Violin", 1, 100, Wave.SAWTOOTH, Attack.SLOW, Effect.NONE, 100, 75, Wave.SAWTOOTH, Attack.SLOW, Effect.NONE, 10, 100, 10, 85); -flexFX.performFlexFX("Violin", Note.E5, 250, 300, false); -flexFX.performFlexFX("Violin", Note.A5, 250, 900, false); -flexFX.performFlexFX("Violin", Note.E5, 250, 300, false); -flexFX.performFlexFX("Violin", Note.F5, 250, 900, false); -flexFX.performFlexFX("Violin", Note.D5, 250, 300, false); -flexFX.performFlexFX("Violin", Note.E5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.D5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.C5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.E5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.D5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.C5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.B4, 250, 150, false); -flexFX.performFlexFX("Violin", Note.D5, 250, 150, false); -flexFX.performFlexFX("Violin", Note.C5, 250, 300, false); -flexFX.performFlexFX("Violin", Note.A4, 250, 900, false); +flexFX.performFlexFX("Violin", Note.E5, 250, 300, true); +flexFX.performFlexFX("Violin", Note.A5, 250, 900, true); +flexFX.performFlexFX("Violin", Note.E5, 250, 300, true); +flexFX.performFlexFX("Violin", Note.F5, 250, 900, true); +flexFX.performFlexFX("Violin", Note.D5, 250, 300, true); +flexFX.performFlexFX("Violin", Note.E5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.D5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.C5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.E5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.D5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.C5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.B4, 250, 150, true); +flexFX.performFlexFX("Violin", Note.D5, 250, 150, true); +flexFX.performFlexFX("Violin", Note.C5, 250, 300, true); +flexFX.performFlexFX("Violin", Note.A4, 250, 900, true); //flexFX.startPlaying(); while (flexFX.isActive()) { // jiggle a note around + images.iconImage(IconNames.QuarterNote).showImage(-2, 150); images.iconImage(IconNames.QuarterNote).showImage(-1, 150); images.iconImage(IconNames.QuarterNote).showImage(0, 150); - images.iconImage(IconNames.QuarterNote).showImage(1, 150); - images.iconImage(IconNames.QuarterNote).showImage(0, 150); + images.iconImage(IconNames.QuarterNote).showImage(-1, 150); } //flexFX.finish(); // make sure everything has finished playing pause(1000); // create and perform a flowing 3-part flexFX -flexFX.create3PartFlexFX("SIREN", 50, 50, +flexFX.create3PartFlexFX("Cry", 50, 50, Wave.SQUARE, Attack.SLOW, Effect.NONE, 200, 100, Wave.SQUARE, Attack.SLOW, Effect.NONE, 100, 100, Wave.SQUARE, Attack.SLOW, Effect.NONE, 150, 50, 33, 33); -flexFX.performFlexFX("SIREN", 200, 250, 1000, false); -flexFX.performSilence(400,false); -flexFX.performFlexFX("SIREN", 300, 250, 1000, false); -flexFX.performSilence(400, false); -flexFX.performFlexFX("SIREN", 400, 250, 1000, false); -flexFX.performSilence(400, false); -flexFX.performFlexFX("SIREN", 600, 250, 1000, false); -flexFX.performSilence(400, false); -flexFX.performFlexFX("SIREN", 800, 250, 1000, false); +flexFX.performFlexFX("Cry", 200, 250, 1000, true); +flexFX.performSilence(2000); +flexFX.performFlexFX("Cry", 300, 250, 1000, true); +flexFX.performSilence(1000); +flexFX.performFlexFX("Cry", 400, 250, 1000, true); +flexFX.performSilence(1000); +flexFX.performFlexFX("Cry", 600, 250, 1000, true); +flexFX.performSilence(1000); +flexFX.performFlexFX("Cry", 800, 250, 1000, true); // choreograph faces to sounds -while(flexFX.isActive){ - basic.showIcon(IconNames.Happy); +basic.showIcon(IconNames.Sad); +while(flexFX.isActive) { flexFX.awaitPlayStart(); - basic.showIcon(IconNames.Surprised); + basic.showIcon(IconNames.Surprised); // takes too long! flexFX.awaitPlayFinish(); + basic.showIcon(IconNames.Sad); } +flexFX.awaitAllFinished(); +basic.showIcon(IconNames.Happy);