Hello Guest

[FIXED] possible bug in WaveData.create()

  • 2 Replies
  • 13183 Views
[FIXED] possible bug in WaveData.create()
« on: February 19, 2010, 22:15:25 »
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!
« Last Edit: February 19, 2010, 23:00:06 by carneades »

*

Offline Matzon

  • *****
  • 2242
Re: possible bug in WaveData.create()
« Reply #1 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

*

Offline Matzon

  • *****
  • 2242
Re: possible bug in WaveData.create()
« Reply #2 on: February 20, 2010, 10:44:13 »
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