I am presently using javax.sound for my sound needs. Is this used much? Is there any kind of community preference/standard or can you recommend anything I should use? I really just need very basic sound functions I think.
My problem with javax.sound: I have 1 serious and 1 minor problem I’m aware of with java sound.
-
It will hang my program when trying to close a large number of Clip streams. I don’t know how else to play clips (like sound FX) and have them close on their own and avoid system lag.
-
It has lag on the volume change and it pops sometimes. It just seems cheap. I don’t see how I’m doing it wrong code-wise, but I suppose I could be. All I do is send a float at it to change the gain:
if (BGMclip != null)
{
FloatControl gainControl =
(FloatControl) BGMclip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(volNum); // Set volume at <volNum> decibels. -10.0f
}
It doesn’t do this immediately and it sometimes pops. I can live with that, but surely I can find a sound system that can handle my very basic needs without issue (or use this one better ).