// load an audio clip and play it

import java.applet.*;
import java.awt.*;

public class LoadAudio extends Applet {

	private AudioClip sound;
	private Button playSound, loopSound, stopSound;
	
   public void init()
// load the sound when the applet begins executing
     	{
		sound = getAudioClip( getDocumentBase(), "spacemusic.au");
		playSound = new Button( "Play" );
		loopSound = new Button( "Loop" );
		stopSound = new Button( "Stop" );

		add( playSound );
		add( loopSound );
		add( stopSound );
	}

   public boolean action( Event e, Object o)
	{
		if ( e.target == playSound )
			sound.play();
		else if ( e.target == loopSound )
			sound.loop();
		else if ( e.target == stopSound )
			sound.stop();
		return true;
	}
 }