11package org .teachingextensions .logo ;
22
3+ import java .awt .Toolkit ;
4+ import java .net .URL ;
5+
36import javax .sound .sampled .AudioInputStream ;
47import javax .sound .sampled .AudioSystem ;
58import javax .sound .sampled .Clip ;
6- import java .awt .*;
7- import java .net .URL ;
89
910/**
1011 * <img src="http://www.spellzone.com/images/sound-icon.gif" style="text-align: left" alt="A speaker with sound waves" >
1112 * Sound allows you to play a sound, like a 'beep' or the sound from a file
1213 */
1314public class Sound
14-
1515{
1616 private URL soundUrl = null ;
17-
18- public Sound () {
17+ public Sound ()
18+ {
1919 this (TKPSound .Yay );
2020 }
21-
22- public Sound ( TKPSound sound ) {
21+ public Sound ( TKPSound sound )
22+ {
2323 this .setSound (sound );
2424 }
25-
2625 /**
2726 * Plays a beep through your speakers. BEEP!<br>
2827 * <b>Example:</b> {@code Sound.playBeep()}
@@ -31,7 +30,6 @@ public static void playBeep()
3130 {
3231 Toolkit .getDefaultToolkit ().beep ();
3332 }
34-
3533 /**
3634 * Sets a sound that you can play through your speakers.
3735 * Use a TKPSound (there is a list)<br>
@@ -48,7 +46,6 @@ public synchronized void setSound(TKPSound mySound)
4846 if (resource == null ) { throw new IllegalStateException ("Could not get TKPSound: " + sound ); }
4947 this .soundUrl = resource ;
5048 }
51-
5249 /**
5350 * Plays a TKPSound through your speakers.
5451 * You must first set the TKPSound <br>
@@ -80,7 +77,8 @@ public void run()
8077 * Check out our cool sounds - thanks to http://www.wavsource.com/
8178 */
8279 public enum TKPSound {
83- Ahem , Applause , BrainIsGone , CatMeow , Cheering , Crickets , DoctorMccoy , Fanfare , FargoYah , Gong , LLCoolJYaKnow ,
84- LosingPower , Malfunction , Pizza , RunAway , SheerIgnorance , SoBeIt , StrangePerson , Stubborn , Yahoo , Yay
80+ Ahem , Applause , BrainIsGone , CatMeow , Cheering , Crickets , DoctorMccoy , Fanfare , FargoYah ,
81+ Gong , LLCoolJYaKnow , LosingPower , LoveBeingATurtle , Malfunction , Pizza , RunAway ,
82+ SheerIgnorance , SoBeIt , StrangePerson , Stubborn , Yahoo , Yay
8583 }
8684}
0 commit comments