I write a programm, where stream loops are used. I do it using two streams of the same song, and when the first string is going to the end of the loop, the second starts at the begining of it, but it doesn’t work well, because counting of time isn’t precise! FMOD returns values dozens miliseconds too little or too much!
Does anybody know what should I do?
- Janek asked 14 years ago
I know it very well. I’m working with constant bitrate mp3s and I needn’t use MPEGACCURATE flag. (I’ve tried it). Problem is that FMOD updates time every 25 ms and this is too much for me. I need 1 ms delay time counting. I did many test to get to know where is the problem, but this is hard to find the FMOD bugs.
- Janek answered 14 years ago
I wouldn’t call the 25ms counting a “bug” per se; FMOD counts based on the buffersize (I think default is 50ms, not 25) you could just set the buffersize to 1ms (FSOUND_SetBufferSize) and you’ll get accurate counting, but it’ll probably skip like mad.
[b:3d5dxzq6]edit[/b:3d5dxzq6] Hmmm… that won’t work–FMOD clamps the buffersize at 50. And as I suspected, this isn’t a bug. It’s even documented: “Due to this buffersize command latency on software channels will be between 25 and 50ms on average (37.5ms) when the buffersize is set to 50.” I’d say more a limitation than a bug. There’s nothing you can do.
You say you are using stream loops…
1) Download FMOD 3.62 – there is support for changing the loop mode of streams (as you can with samples)
2) To loop streams (that are not opened as looping) do as:
// Open stream
FSOUND_STREAM* stream = FSOUND_Stream_OpenFile( “filename”, FSOUND_NORMAL, 0 );
// Set the loop mode
FSOUND_Stream_SetMode( stream, FSOUND_NORMAL | FSOUND_LOOP_NORMAL );
// Play the stream
int channel = FSOUND_Stream_Play( FSOUND_FREE, stream );
— To unset the loop mode of the stream use:
FSOUND_Stream_SetMode( stream, FSOUND_NORMAL | FSOUND_LOOP_OFF );
Please login first to submit.