adding some test cases for the event queue

This commit is contained in:
Mihály Kuprivecz
2017-04-28 10:38:40 +02:00
parent 152b2762c3
commit 6e8eaf7593
3 changed files with 120 additions and 16 deletions

View File

@ -24,12 +24,9 @@
package com.iluwatar.event.queue;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
/**
@ -51,17 +48,12 @@ public class App {
* @throws UnsupportedAudioFileException when the loaded audio file is unsupported
*/
public static void main(String[] args) throws UnsupportedAudioFileException, IOException {
Audio.playSound(getAudioStream("./etc/Bass-Drum-1.wav"), -10.0f);
Audio.playSound(getAudioStream("./etc/Closed-Hi-Hat-1.wav"), -8.0f);
Audio.playSound(Audio.getAudioStream("./etc/Bass-Drum-1.wav"), -10.0f);
Audio.playSound(Audio.getAudioStream("./etc/Closed-Hi-Hat-1.wav"), -8.0f);
System.out.println("Press Enter key to stop the program...");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.read();
Audio.stopService();
}
public static AudioInputStream getAudioStream(String filePath)
throws UnsupportedAudioFileException, IOException {
return AudioSystem.getAudioInputStream(new File(filePath).getAbsoluteFile());
}
}