Problem with AudioClip

Hello folks. I wrote a sound manager, and it works great for small sounds. However, when I try to play a music file ( ~5 min ), it seems to constantly restart the file. I am left with a giant jumble of 100 versions of the wave playing at once.

My SoundManager class looks like this:


public class SoundManager {
	private static AudioClip [] sounds;
	
	public static int ARROW      = 0;
	public static int CANNONBALL = 1;
	public static int DOOM       = 2;
	
	
	public static void init(){
		sounds = new AudioClip[ 10 ];
		
		sounds[ARROW] = Applet.newAudioClip( MediaUtil.getResource( "media/arrow.wav" ) );
		sounds[CANNONBALL] = Applet.newAudioClip( MediaUtil.getResource( "media/cannon.wav" ) );
		sounds[DOOM] = Applet.newAudioClip( MediaUtil.getResource( "media/doom.wav" ) );
	}
	

	public static void play( int i ) {
		sounds[i].play();
	}
}

when I play Doom, the problem occurs. I had the method play print out something, so I know it’s only being run once.

What gives?

Thanks,
Nick

Are you loading the sounds over a network connection? If so, make sure that the file is completely loaded before you play it.

Nah, it’s not from a network.