20 Jun '13 - 08:31 *
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: [Fixed] BASS_SYNC_END doesn't trigger with short sound files  (Read 569 times)
two
Posts: 5


« on: 12 Apr '12 - 00:14 »
Reply with quoteQuote

Hey there,

finally got round to registering an account here. So hi2uall! =)

A problem that's been annoying me for quite a long time is the fact that BASS_SYNC_END doesn't trigger with very short sound files (eg. PCM WAV), loaded as streams. I create the streams w/ BASS_STREAM_PRESCAN so the correct length should always be known. I suspect it has something to do with the audio buffer size and BASS not triggering it correctly, but hopefully I'm just missing something here.  Huh

Any help is appreciated.

Best, Tom
« Last Edit: 13 Apr '12 - 17:34 by two » Logged
Ian @ un4seen
Administrator
Posts: 15366


« Reply #1 on: 12 Apr '12 - 14:15 »
Reply with quoteQuote

Are you calling BASS_ChannelSetSync to set the sync before you call BASS_ChannelPlay to start playback? If not, please try that. A newly set sync will only be triggered when the sync condition is met in subsequent processing; it won't be triggered retrospectively for data that has already been processed, eg. data that is currently sitting in the playback buffer. So, if playback is started before the sync is set, it could be that the end was already processed before the sync is set.
Logged
two
Posts: 5


« Reply #2 on: 12 Apr '12 - 14:24 »
Reply with quoteQuote

Yes, of course I do. I usually set the syncs right after channel creation.

The same problem occurs with BASS_SYNC_POS on short samples: it never, or just sporadically, triggers. Even if the sync pos is stream length / 2.

However, the syncs trigger fine once a stream has a certain length. I have verified this behavior with the latest BASS version on various systems and with various versions of Windows.

If you like I could upload a couple of example one-shots for you.
« Last Edit: 12 Apr '12 - 14:26 by two » Logged
Ian @ un4seen
Administrator
Posts: 15366


« Reply #3 on: 12 Apr '12 - 14:28 »
Reply with quoteQuote

Yep, please do upload an example file that you're having the problem with...

   ftp.un4seen.com/incoming/
Logged
two
Posts: 5


« Reply #4 on: 12 Apr '12 - 14:45 »
Reply with quoteQuote

Uploaded a demo video and a few samples. Please read the included .txt file.
Logged
Ian @ un4seen
Administrator
Posts: 15366


« Reply #5 on: 12 Apr '12 - 17:17 »
Reply with quoteQuote

Thanks for the files. I was unable to reproduce the sync not being triggered in my tests, but I did see the sync being triggered too early (in the BASS_ChannelPlay call). Perhaps that is causing the problem you're seeing in your test, if the BASS_ChannelPlay call comes before the button is set green? Here's an update to try, which should correct the early sync problem...

   www.un4seen.com/stuff/bass.dll

If you still have the problem with that, please try running your test under the debugger and set a breakpoint in the SYNCPROC to confirm whether it gets called each time you click the button.
Logged
two
Posts: 5


« Reply #6 on: 13 Apr '12 - 03:55 »
Reply with quoteQuote

I just tried your new DLL build and the early sync problem is gone. Works like a charm now. Also, similar problems in other projects are gone now.

You were right, I did actually set the sync after BASS_ChannelPlay, but with no additional code in between. So when you mentioned that the next thing I tried is timing the code w/ performance counters, started before channel play, stopped after set sync, the resulting duration was actually way shorter than the sample itself.

That makes me wonder, what's changed internally in that new DLL of yours? Is this a permanent change?
Logged
Ian @ un4seen
Administrator
Posts: 15366


« Reply #7 on: 13 Apr '12 - 15:39 »
Reply with quoteQuote

BASS_ChannelPlay needs to decode some data before starting playback (unless BASS_ChannelUpdate has been called), and the problem was that any syncs triggered in that initial data could be called almost immediately instead of being delayed until playback reaches the sync position. That was a bug, so the change/fix will indeed be permanent.
Logged
two
Posts: 5


« Reply #8 on: 13 Apr '12 - 16:00 »
Reply with quoteQuote

I see. This is great news! Thanks for the fast response, Ian.

So now I can finally ditch that dirty BASS_ChannelIsActive workaround timer Roll Eyes
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines