[FIXED] possible bug in WaveData.create()

Started by carneades, February 19, 2010, 22:15:25

Previous topic - Next topic

carneades

WaveData.java around line 209 calculates the byte array length based on AudioInputStream.getFrameLength() and then tries to fill the array using AudioInputStream.read(). Unfortunately this doesn't take into account that the stream may not be in its initial position. Say for example you only want to play seconds 2 through EOM (instead of 0 to EOM). A typical method is to use AudioInputStream.skip(). If WaveData.create() is called at that point it will create a byte array with two seconds of silence at the end.

Two possible solutions:
(1) Document this behavior so people know not to skip prior to giving WaveData an AudioInputStream, or
(2) Calculate the byte array length based on AudioInputStream.available()

I think the current situation is a little counterintuitive so I prefer (2).

Thank you for good Java OpenAL bindings and keep up the good work!

Matzon

can't say that I've ever had that need :) - but I will get solution 2 implemented in the upcomming 2.3 release

Matzon

Quote from: Matzon on February 20, 2010, 07:11:20
can't say that I've ever had that need :) - but I will get solution 2 implemented in the upcomming 2.3 release

fixed in trunk