Java examples for javax.sound.sampled:Audio
Audio to alert the kindergartner when the selection is wrong
//package com.java2s; import java.applet.AudioClip; public class Main { static AudioClip gameClip, rightClip, wrongClip; /**/* ww w . j a va2s . c o m*/ * Audio to alert the kindergartner when the selection is wrong */ static void playWrong() { try { stopGameMusic(); Thread.sleep(200); wrongClip.play(); Thread.sleep(1000); } catch (Exception e) { System.out.println("playWrong caught exception" + e.getMessage()); } } /** * The music needs to be stopped to play other sounds like right or wrong */ static void stopGameMusic() { try { gameClip.stop(); } catch (Exception e) { System.out.println("stopGameMusic caught exception" + e.getMessage()); } } }