Possible RFEs: Duration of soundstream and callbacks

futnuh

21-03-2007 06:04:08

Unless I'm mistaken, there doesn't appear to be a method in the Sound class for determining the duration of the sample? Vorbis has a function
double ov_time_total(OggVorbis_File *vf,int i);
Any chance this could be added in a future release?

Completely separate from the above, CaseyB, what are your thoughts about registering for a callback when a sound finishes? This might be quite useful for users of the python-ogre OgreAL wrapper - I'll have to check what the overhead is in constantly polling to see if a sound is still playing. Unless I'm missing something in the SoundManager that already provides this functionality ...

CaseyB

21-03-2007 06:33:16

Any chance this could be added in a future release?Yup, this can go in along with the code that allows the user to query the current position of the sound as well as seeking into a certain point.

what are your thoughts about registering for a callback when a sound finishes? ... I'll have to check what the overhead is in constantly polling to see if a sound is still playing. Unless I'm missing something in the SoundManager that already provides this functionality ...This is not in OgreAL at the moment and I'll have to do more research before I give you a solid answer. I have never seen anything in OpenAL that would allow for that (that doesn't mean it's not there, it just means that I haven't' seen it! ;) ) and if it's not there then polling each frame is all I would be doing, except that I would have to poll every sound every frame and store the state of the sound the previous frame to see if it has just stopped or had been stopped. In short, I don't know. If this is in OpenAL, then I can expose it, if not then it would probably be best left up to the user since they will be able to do the polling in a much more targeted fashion.

futnuh

21-03-2007 19:29:45

This is not in OgreAL at the moment and I'll have to do more research before I give you a solid answer. I have never seen anything in OpenAL that would allow for that (that doesn't mean it's not there, it just means that I haven't' seen it! ;) ) and if it's not there then polling each frame is all I would be doing, except that I would have to poll every sound every frame and store the state of the sound the previous frame to see if it has just stopped or had been stopped. In short, I don't know. If this is in OpenAL, then I can expose it, if not then it would probably be best left up to the user since they will be able to do the polling in a much more targeted fashion.

I agree fully. I wasn't sure if you were already polling each sound for active status - in which case adding a callback mechanism wouldn't be a performance hit. Anyway, if we have access to the clip duration, we can start polling close to the expected end-of-stream time.