Playing Sounds in J2ME .. quicker?
I'm using basic code to play sounds inside of my project.
public void playsnd() {
try {
InputStream is = getClass().getResourceAsStream("/res/test.wav");
Player p = Manager.createPlayer(is, "audio/x-wav");
p.prefetch();
p.start();
}
catch (IOException ex) {}
catch (MediaException ex) {}
}
The problem I'm having is that I have 4 sounds that I want to play, in progression, and they always seem to be "lagged" whenever I try to load them.
Is there a way to load the player / sound when you start the app and then just play them so they dont' have to load everytime you want to play them?
|