pouët.net

Go to bottom

sync issues with BASS

category: code [glöplog]
 
Hey guys,

Maybe it's a setup problem, but when I start playing from the middle of the song (using GNU Rocket) I get a little time offset (around 150ms) between the music and the BASS_ChannelGetPosition api function.

Have anyone experienced something like that before?
Is there a bass settings that can help with it?

Thanks,
TLM
added on the 2013-09-06 13:12:39 by TLM TLM
150ms is hardly "little". Either way, look into BASS_DEVICE_LATENCY.
added on the 2013-09-06 13:14:07 by Gargaj Gargaj
that
and beware of rounding artifacts in your impl., it actually happens if you dont do it right
added on the 2013-09-06 13:22:56 by superplek superplek
no, doesn't help... :(
added on the 2013-09-06 13:29:38 by TLM TLM
I'm actually using something very similar to the example that comes with GNU rocket
added on the 2013-09-06 13:30:48 by TLM TLM
Are you double/triple buffered?
added on the 2013-09-06 13:31:25 by Gargaj Gargaj
not the I know of
added on the 2013-09-06 13:34:08 by TLM TLM
I think that "BASS_STREAM_PRESCAN" solved the problem, not sure yet...
added on the 2013-09-06 13:43:52 by TLM TLM
Have you tried a different soundfile? Maybe it's not related to your code at all, but to keyframes in the tune?
added on the 2013-09-06 13:45:46 by mog mog
If it's an MP3, prescan could explain the problem, yeah (kind of what mog pointed out) - you can't do precise MP3 seeking without the file being completely scanned.
What gargaj and superplek said... correctly rounding the row sent to gnu-rocket did it for me.

protip: Bass can also get you a sound-driver latency that I used for a while to get WRONG results... ... honestly not sure if it makes sense to correct for or not, but particularly laptops sometimes show quite a lot of latency.
BASS_INFO info;
BASS_GetInfo( &info );
// The average delay (rounded up to the nearest millisecond) for playback of HSTREAM/HMUSIC channels to start and be heard.
long latency = static_cast<long>( info.latency );
added on the 2013-09-06 13:50:16 by hornet hornet
The only reason the rocket-example doesn't use BASS_STREAM_PRESCAN, is because it comes with an OGG-soundtrack rather than an MP3.
added on the 2013-09-06 14:00:34 by kusma kusma
Ok, confirmed - things are working nice now.

kusma got it right: I was using mp3 without BASS_STREAM_PRESCAN.

Thanks everyone!
added on the 2013-09-06 14:24:32 by TLM TLM
oh sure

that damn norwegian bastard had to get it right
added on the 2013-09-06 16:28:31 by superplek superplek

login

Go to top