LWJGL
June 18, 2013, 17:07:19 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: AL_SEC_OFFSET accuracy  (Read 6781 times)
NateS
Regular nerd
**
Posts: 79


« on: June 09, 2008, 18:54:06 »

I'm synching my game to music using AL_SEC_OFFSET. I find the time this gives me doesn't update very often. Eg, the number I get only changes every 6 to 8 frames. When using Java Sound's DataLine#getMicrosecondPosition(), the number changes every frame. Because of this, my game is much smoother using Java Sound (which has a crap API). I'd really like to switch to OpenAL though.

Any ideas on how I can get a more accurate position using OpenAL?
Logged
Matzon
Administrator
Demigod
*****
Posts: 2239



« Reply #1 on: June 09, 2008, 23:40:26 »

I can't help but think thee must be something odd with your game, since you designed it with such a requirement?
Why do you need to do stuff at a certain point in time, related to your sound?
Logged

NateS
Regular nerd
**
Posts: 79


« Reply #2 on: June 10, 2008, 12:46:04 »

Smiley The game displays lyrics synchronized to the music. I no longer think it is because OpenAL doesn't update its position fast enough. That misdiagnosis came from this...
http://lwjgl.org/forum/index.php/topic,2643.0.html
However for whatever reason, Java Sound is still smoother than OpenAL. My hunch is there is some rounding problem. I need to make a simpler test case to debug further.
Logged
NateS
Regular nerd
**
Posts: 79


« Reply #3 on: June 10, 2008, 16:14:33 »

I got a response from Dan at Creative:
Quote
Getting playback offsets is not going to be anywhere near as precise I'm afraid. The "Generic Hardware" and "Generic Software" devices only update the playback positions every 25 milliseconds.
I've finally proven this is the case. OpenAL only updates every 25ms while Java Sound updates every ~5ms.
Logged
Matzon
Administrator
Demigod
*****
Posts: 2239



« Reply #4 on: June 11, 2008, 12:52:53 »

I modified PlayTest to output AL_SEC_OFFSET info. Generally I got much better resolution using openal-soft. So I suggest trying to use the latest LWJGL (2.0-rc1) which uses this on both linux and windows - but not on mac.
Logged

Pages: [1]
  Print  
 
Jump to:  

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