Skip to content

Commit

Permalink
Now with sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
isidore committed Dec 10, 2020
1 parent 6abb0b7 commit c8d1972
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Java/fakeit/src/test/java/kata/fakeit/TestCounter.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package kata.fakeit;

import com.spun.util.LambdaThreadLauncher;
import com.spun.util.ThreadUtils;
import com.spun.util.io.FileUtils;
import com.spun.util.tests.TestUtils;
import org.lambda.actions.Action0;

import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;

public class TestCounter {

Expand All @@ -13,10 +17,25 @@ public class TestCounter {
public static final File failFile = new File("fakeit.counter.fail.txt");

public static void IncrementSuccess() {
playSound("..\\..\\sounds\\SwordIn-001.wav");
Increment(passFile);
}

private static void playSound(String wavFile) {
try {
File file = new File(wavFile).getCanonicalFile();
AudioInputStream input = AudioSystem.getAudioInputStream(file);
Clip clip = AudioSystem.getClip();
clip.open(input);
clip.start();
ThreadUtils.sleep(600);
} catch (Exception e) {
e.printStackTrace();
}
}

public static void IncrementFailure() {
playSound("..\\..\\sounds\\Crickets-000.wav");
Increment(failFile);
}

Expand Down
Binary file added sounds/Crickets-000.wav
Binary file not shown.
Binary file added sounds/SwordIn-001.wav
Binary file not shown.

0 comments on commit c8d1972

Please sign in to comment.