I've been working with a couple of friends in our own home-made java game engine, and I've been trying to make the sound work for us.
I've read your previous posts about playing a sound clips over and over again without having to instantiate new classes every time you want to play a sound.
My question is similar to that, but in this case I want to play audio from a file repeatedly, but, without reading in the entire file. Instead, I want to read bits of the file at a time, and when the EOF is detected, loop back into the beginning of the file.
I tried keeping the FileInputStream I used when creating the AudioInputStream and position the file channel back to 0 when the available bytes were 0, but then, the AudioInputStream always indicates 0 available bytes even if the underlying FileInputStream reports available bytes.
Later, I tried wrapping the FileInputStream in another InputStream (implemented by me), which intercepts the calls to read(), read(byte , int, int) and available() so that it would never report an end to the stream, but in this case the AudioSystem.getAudioInputStream(InputStream) fails throwing an exception, namely java.io.IOException: mark/reset not supported.
Perhaps I made something simple too complex, or perhaps this is an actual limitation in the Java audio libraries.
I'm sorry if for some reason I missed this question being answered before, in which case I ask you to point me to the right place.
Thanks for any contribution.