Author Topic: BASS_Mixer_StreamAddChannelEx sometimes takes a long time to return  (Read 103 times)


  • Posts: 22
I've noticed that on occasions, particularly the first time while running the application, BASS_Mixer_StreamAddChannelEx can take a long time to return.

The scenario is as follows: a decoding mixer stream is created and passed to an encoder. A separate thread callsBASS_ChannelGetData in a while loop, until the mixer stream is freed.

BASS_Mixer_StreamAddChannelEx has taken upto a minute to return any kind of value - it just hangs there for a while and returns sometime later.  Most of the time this is instant.

What can cause this?

Ian @ un4seen

  • Administrator
  • Posts: 23470
The issue there is that a new source can't be added while the mixer is processing the mix (except in a callback function, eg. SYNCPROC), so BASS_Mixer_StreamAddChannelEx will be waiting for the BASS_ChannelGetData call to finish and release a lock. In your extreme case it sounds like the next BASS_ChannelGetData call is immediately grabbing the lock before BASS_Mixer_StreamAddChannelEx can. To prevent that, you could try adding a Sleep(0) call to the BASS_ChannelGetData loop and see if that helps.


  • Posts: 22
Lovely, that's done the trick, thank you.