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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| 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