AL_SEC_OFFSET accuracy

Started by NateS, June 10, 2008, 01:54:06

Previous topic - Next topic

NateS

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?

Matzon

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?

NateS

:) 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.

NateS

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.

Matzon

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.