pouët.net

Go to bottom

stuttering music in demos

category: general [glöplog]
firelight: is this really the whole code for the GetTime() function?

My own code also uses this as a foundation, but adds the difference between the last buffer write position and the current one (GetPlayPosition() of the DS buffe). It's THIS bit that goes wrong here, some times the play pos is a bit lower than it has been before.

As with sir r. kbab, the only solution was ignoring all backward play position changes that didn't indicate that the buffer was looping (that is: all changes smaller than half the buffer size, in all other cases you're screwed anyway ;)
added on the 2004-01-05 12:37:41 by kb_ kb_
hm, terrible. thinking about how my adpcm_on_dvd streaming code would possibly fcuk up if that would happen :)
added on the 2004-01-05 12:48:55 by superplek superplek
i also ran thru this "bug"-thingy, especially what I noticed that it was mostly appearing on SoundBlaster cards... (or well i at least hope that this was the reason the sound fucked up :)
added on the 2004-01-05 13:01:26 by Gargaj Gargaj
the only really reliable timer under windows for music-sync, is really the position in the sound-buffer. it's no doubt about it, some soundcards tend to play stuff at a slightly wrong frequency (ie not 44100), leading to audio and visuals getting out of sync. resyncing another timer will lead to demo-skips, and is not a solid solution.
added on the 2004-01-05 13:10:15 by kusma kusma
kb: yes, the value is lower when the buffer wraps ;)

...but i assume that wasn't what you meant. I have never had any troubles like that myself.
added on the 2004-01-05 13:14:31 by kusma kusma
kb: yeah, thats basically it, but i subtract the buffersize to 'latency adjust', (ie a 1000ms buffer is filled before you call play, but you dont want to display 1000 as the gettime value, it should say 0), but you know the deal with that :).
I know what you are doing there, you are getting an 'interpolated time', but fmod doesnt do that, it increments in steps of the mixbuffer chunk, so its not perfectly fine granularity.

sir richard kebab:
only thing i can see is the float/int conversion/truncation might be to blame, i just suggest you log the int values that come from fsound_stream_gettime and report if they ever go backwards, i am fairly confident they wont.
added on the 2004-01-05 13:17:20 by firelight firelight
i'll try that when i have time, today or tomorrow.
added on the 2004-01-05 13:24:28 by skrebbel skrebbel
(never used fmod in a demo) - i suspect bass does something different with those std. "timing" funcs - i'll test just accum'ing the buffer pos some day.
added on the 2004-01-05 13:46:40 by superplek superplek
well, that might explain why fmod-based demos always stutter then. :)
added on the 2004-01-08 00:34:43 by gloom gloom
IGraphBuilder::RenderFile()
added on the 2004-01-13 16:11:23 by EvilOne EvilOne

login

Go to top