Hi guys, I'm writing a J2ME game and I want a sound (midi) to play every time the player picks up a bonus :) Natural way to do this, I thought, was to prepare all the resources somewhere at the loading stage, create a sort of 'sound-player' object and use it repeatedly throughout the game. So I came across javax.microedition.media.Player. The manual suggests it releases it's resources after playback and therefore shouldn't be used more than once. I came up with a temporary solution like:
tone1 = this.getClass().getResourceAsStream("/my_tone.mid");
pl1 = Manager.createPlayer(tone1, "audio/midi");
It works, but I don't like the idea of creating a new player and having it fetch the stream each time, say, a snake eats an apple. So what's the right way to prefetch and re-use sounds?