Hi, guys!
I’m developnig a simle arcade game with J2ME. I’ve already done with the engine and now I’m a bit confused with the sound.
I want to loop a midi sample as a background music and I also want to have some sound effects: explosions, shots… etc. The problem is - I can not do that with my Nokia 6230i. I’ve tried to run my game on the Nokia emulator and everything worked just fine. Is there any limitations on simultaneous midi playback?
Here is the piece of code I use for sound playback:
private Effects(){
instance = this;
try {
boomSound = Manager.createPlayer(getClass().getResourceAsStream(
"/effect.mid"), "audio/midi");
laserSound = Manager.createPlayer(getClass().getResourceAsStream(
"/effect.mid"), "audio/midi");
missileSound = Manager.createPlayer(getClass().getResourceAsStream(
"/effect.mid"), "audio/midi");
} catch (Exception e) {
e.printStackTrace();
}
}
.....
public void playGameBG(){
if (!MainMenu.settingsMusic)
return;
try {
if (bgSound != null && bgSound.getState() == Player.PREFETCHED)
bgSound.deallocate();
bgSound = Manager.createPlayer(getClass().getResourceAsStream("/game.mid"),
"audio/midi");
bgSound.setLoopCount(-1);
bgSound.start();
}catch (Exception e) {
e.printStackTrace();
}
}