You are right, it seems it was BASS_ChannelSetDSP() with priority -1000 on the first mixer, removed it and now it is a lot better.
It seems to be ok if I have the mixer on the same sound card but there is still a small delay if there are different sound cards.
BASS_Split_StreamGetAvailable reports 45680 bytes for 32 bit stereo stream that means around 129ms. My BASS_CONFIG_BUFFER buffer is 96ms.
I will come back with more details if I can't figure it out.
I am not resetting them with BASS_Split_StreamReset because I fear for sound artifacts.
mixer1 and mixer2 are sound card mixers created like this:
BASS_SetDevice(id1);
BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 5);
bStatus = BASS_SetConfig(BASS_CONFIG_BUFFER, 96*4); // set the buffer length
mixer1 = BASS_Mixer_StreamCreate(44100, 2, BASS_MIXER_NONSTOP | BASS_SAMPLE_FLOAT | BASS_SAMPLE_SOFTWARE );
s = BASS_ChannelSetSync(mixer1, BASS_SYNC_STALL, 0, StallSyncProc,&_element);
BASS_ChannelPlay(mixer1,FALSE);
BASS_SetDevice(id2);
BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 5);
bStatus = BASS_SetConfig(BASS_CONFIG_BUFFER, 96*4); // set the buffer length
mixer2 = BASS_Mixer_StreamCreate(44100, 2, BASS_MIXER_NONSTOP | BASS_SAMPLE_FLOAT | BASS_SAMPLE_SOFTWARE );
s = BASS_ChannelSetSync(mixer2, BASS_SYNC_STALL, 0, StallSyncProc,&_element);
BASS_ChannelPlay(mixer2,FALSE);
BASS_SetDevice(0);
//create spliter
HSTREAM splitter1 = BASS_Split_StreamCreate(mixer, BASS_STREAM_DECODE, NULL);
//connect spliter
BASS_Mixer_StreamAddChannel(mixer1 , splitter1 , BASS_MIXER_BUFFER|BASS_MIXER_PAUSE|BASS_MIXER_MATRIX|BASS_SAMPLE_SOFTWARE);
//create spliter
HSTREAM splitter2 = BASS_Split_StreamCreate(mixer, BASS_STREAM_DECODE, NULL);
//connect spliter
BASS_Mixer_StreamAddChannel(mixer2 , splitter2 , BASS_MIXER_BUFFER|BASS_MIXER_PAUSE|BASS_MIXER_MATRIX|BASS_SAMPLE_SOFTWARE);
BASS_Mixer_ChannelFlags(splitter1 , 0, BASS_MIXER_PAUSE);
BASS_Mixer_ChannelFlags(splitter2 , 0, BASS_MIXER_PAUSE);
My goal is to have a nonstop playing BASS pipeline and do all the stuff in the sources, which may be destroyed played or stopped.
>>Can you move your seeking outside of the STREAMPROC, and have the STREAMPROC return 0 in the meantime?
The seek is done in another thread already I was just waiting for the thread to finish. I will try your idea and return 0 in the callback until the thread finishes.
In the mentioned callback besides the seek there is a lot of audio processing done.
Is there a way I can increase the priority for the thread that calls the callback and what priority does it normally have?
Best regards,
Constantin Cristian