LWJGL
May 22, 2012, 05:02:57 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: [FIXED] possible bug in WaveData.create()  (Read 1203 times)
carneades
Newbie
*
Posts: 4


« on: February 19, 2010, 14: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!
Logged
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #1 on: February 19, 2010, 23:11:20 »

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

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #2 on: February 20, 2010, 02:44:13 »

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

fixed in trunk
Logged

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!