Hi all,
I'm currently having some problems with playing sound effects in our current game. I'm using the Mobile Media API. I have MIDI files playing fine and some of my WAV/AMR files. The problem is that some of the effects just doesn't want to play. Works fine on the emulator of course but nothing can be heard on the device.
First I thought it was because the sounds where very short, I tried adding silence at the start and end to the files with no luck.
When the game starts I create all the players needed (12 of them) and get volume controls for them also. Code is like this:
try {
java.io.InputStream is = m_nSoundType.getClass().getResourceAsStream("/" + (id + 1) +
".amr");
m_SoundPlayers[id] = Manager.createPlayer(is, "audio/amr");
m_SoundPlayers[id].prefetch();
m_VolumeControl[id] = (VolumeControl) m_SoundPlayers[id].getControl("VolumeControl");
m_VolumeControl[id].setLevel(m_nSndGeneralVolume);
}
catch (IOException ioe) {
System.out.println("IOE amr : " + ioe);
}
catch (MediaException me) {
System.out.println("ME amr : " + me);
}
I get no exceptions at all (I catch them all and show them while the game is running¡_ not in above code).
If any of you had the same problems and found a solution then please let me hear about it..
Another issue also related to this. In the above code I get the VolumeControl just after I created the player, but to me it seems that I have to get the VolumeControl just after I started to play the sound, otherwise I fail to change the volume. Since there always are delays and latency it often happens that a sound is started and then you hear the very first start of it with full volume and then it changes to the volume I defined (could be 0). Any comments on this ?
Best,
Sam

Reply With Quote

