getPlayPosition?

mkultra333

07-11-2010 11:15:41

Just started with OgreOggSound, so this is a preliminary question.

I see there's a setPlayPosition function that lets you set the play position in the sound, in seconds. I'm after the opposite of this, I want to sync certain events to times in the sound (for syncronizing stuff to music).

So ideally I'd want a getPlayPosition function that would return where the sound is currently playing from, in seconds. I can't see any such function. Is there a way to do this?

If not, any suggestions as to how I'd modify OgreOggSound to make this possible?

stickymango

08-11-2010 12:08:26

I'll probably look into this and add it.

However if you want to have a bash yourself then you'll need to look at:

alGetSourcei(source, AL_SAMPLE_OFFSET, &pos);
alGetSourcei(source, AL_SEC_OFFSET, &pos);
alGetSourcei(source, AL_BYTE_OFFSET, &pos);

called on the source object of the sound, thats sufficient for 'static' sounds.

I imagine for streaming sounds Its likely you'll need to add a tracking variable which holds the last known offset into the audio data before reading a new chunk of data, then a bit of calculation..

stickymango

10-11-2010 16:16:52

Added to lib.

mkultra333

10-11-2010 18:35:55

Cool, I'll check it out soon as I get the chance. Thanks.