I wrote a morse trainer in this weekend ( http://benny.kappa.ro/artrainer_setup_103.exe ) and used fmod’s streaming capabilities.
Everything works great excepting one thing : I’ve tried to set synch callbacks for note on, note off events and used FSOUND_Stream_SetSyncCallback and FSOUND_Stream_AddSyncPoint just like the manual described. The problem is that it didn’t work. Setting the callback returned TRUE but adding a synchpoint would endlessly return 0 and no sync event was triggered. I’ve tested the sync with FSOUND_Stream_Open on a wave file and it worked, though.
Thus, my question is : is there a way to add sync points for user defined streams ? ( created with FSOUND_Stream_Create ) or is there any way to emulate it ? I tried to simulate it the following way : while in the render callback, if sync callback was needed, I would save the absolute position in the stream ( since it started ) and add to it FSOUND_DSP_GetBufferLengthTotal() and then at each sample written, check if sync callback needs to be called.
This method didn’t quite give accurate results ( close, though ).
Anybody encountered this problem before ?
so what exactly should I add to each sync point ( own performed ) so that I would obtain an accurate sound/visual syncronisation ? The length of the callback buffer OR the length of the mixing buffer ?
user defined streams could have worked with sync, though, if you would’ve considered making the stream offset in samples 0 at each FSOUND_Stream_Start(). Syncing doesn’t care for either size of the stream or time. a synch point is just on offset relative to a certain start point. and user defined streams should set the start point to 0 when playing the stream. it would be a nice feature for the future fmod releases, I think
Please login first to submit.