20 Jun '13 - 08:04 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Sync with playback - problem  (Read 723 times)
neurasthenik
Posts: 17


« on: 7 Mar '10 - 23:36 »
Reply with quoteQuote

Hello. I have a problem with synchronizing playback with some kind of position bar in my app. To solve this issue first I used the CALLBACK function of BASS_ChannelSetSync:
void CALLBACK PlaySyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
     int n=(int)user; // event number
     BASS_ChannelSetPosition(event[n].stream, 0, BASS_POS_BYTE);
     BASS_Mixer_StreamAddChannel(mixer, event[n].stream, 0);
     event[n].MovePositionBar(); //Function which moves the bar to specified position
}
After compiling this I observed that position bar after calling first event (event[0]) was moved very fast, not according to previously specified time position.  Next events are being called correctly, but the whole position bar movement is delayed by previous operation. It is very strange for me.

The second idea that I came up with was to use the timer (timesetEvent), unfortunately it had no accuracy in short intervals around 25 ms. I thought about using the BASS_ChannelGetPosition function to correct the position bar, but I cannot change the timer interval during playback...
I'll appreciate any help.
Thanks in advance.
« Last Edit: 7 Mar '10 - 23:40 by neurasthenik » Logged
luke
Posts: 19


« Reply #1 on: 29 Mar '10 - 14:47 »
Reply with quoteQuote

The sync procs are all called from the same BASS worker thread. So if your function takes long, then all further sync procs are delayed. You should keep the code very short+fast, or do longer actions to new threads.

For updating the progress bars I'd recommend you start a "normal" windows timer (100ms should be fast enough) and update all progress bars from that timer event using BASS_ChannelGetPosition. That way you work "asynchronously" and do not delay the sync proc system.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines