In the following code snippet :
ByteArrayInputStream in = new ByteArrayInputStream(dataBuffer);
Player player = Manager.createPlayer(in, "audio/x-wav");
I create a .wav file samples on the fly and feed them to the data buffers. The problem i am facing is :
I have to prepend the .wav header each time to the data samples i generate. Also, I have to close the player and create a new player instance each time the buffer is switched...as a result i am getting a discontinuous song with horrible time latency...
1) Is there a way by which I can just feed the .wav header just once and keep on filling the buffer with just the data samples later on ?
2) Is there a way in which I dont have to close and create a new player each time ? Can this problem be overcome by having 2 Players and switching between them ?