https://jacomp3player.sourceforge.net/guide.html
jaco mp3 라이브러리를 사용,
public static File convertInputStreamToFile(InputStream inputStream) throws IOException {
File tempFile = File.createTempFile(String.valueOf(inputStream.hashCode()), ".tmp");
// jvm 종료 시 같이 지워지도록
tempFile.deleteOnExit();
copyInputStreamToFile(inputStream, tempFile);
return tempFile;
}
public void GoodBeep() {
//기존에는 rfid reader 기기 내에 있는 비프음이 들리게 했다.
// 그러나 비프음이 너무 작아 불편하다는 의견이 있어서 주석처리함.
// RFIDLibrary rfid = RFIDLibrary.INSTANCE;
// String sendProtocol = new String("43012020202020202020202020202020202042");
// byte[] output = new byte[39];
// try{
// rfid.ccr_data_transceive_ex(sendProtocol, output);
// System.out.println("GOOD Beep");
// }catch(Exception e){
// System.out.println("error : " + e);
// }
// jaco mp3 player 를 이용한 비프음
try {
InputStream inputStream = new ClassPathResource("beep.mp3").getInputStream();
File file = convertInputStreamToFile(inputStream);
MP3Player mp3Player = new MP3Player(file);
mp3Player.play();
while (!mp3Player.isStopped()) {
Thread.sleep(5000);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
}