Hello Guest

AL_SEC_OFFSET accuracy

  • 4 Replies
  • 11799 Views
*

Offline NateS

  • **
  • 91
    • Esoteric Software
AL_SEC_OFFSET accuracy
« on: June 10, 2008, 01: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?

*

Offline Matzon

  • *****
  • 2242
Re: AL_SEC_OFFSET accuracy
« Reply #1 on: June 10, 2008, 06: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?

*

Offline NateS

  • **
  • 91
    • Esoteric Software
Re: AL_SEC_OFFSET accuracy
« Reply #2 on: June 10, 2008, 19:46:04 »
:) 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.

*

Offline NateS

  • **
  • 91
    • Esoteric Software
Re: AL_SEC_OFFSET accuracy
« Reply #3 on: June 10, 2008, 23: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.
« Last Edit: June 10, 2008, 23:38:14 by NateS »

*

Offline Matzon

  • *****
  • 2242
Re: AL_SEC_OFFSET accuracy
« Reply #4 on: June 11, 2008, 19: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.