So I've got a weird issue happening with a mixer which has a recording channel plugged into it and then that mixer is being cast to a shoutcast stream.
First the mixer is created:
_Mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_MIXER_NONSTOP)
Bass.BASS_ChannelSetAttribute(_Mixer, BASSAttribute.BASS_ATTRIB_BUFFER, 0F)
Bass.BASS_ChannelSetAttribute(_Mixer, BASSAttribute.BASS_ATTRIB_FREQ, 45000)
Then this to start the recording:
_RecordMonitorStream = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_DEFAULT, Nothing, IntPtr.Zero) 'Start the recording
Then it's plugged into the mixer:
BassMix.BASS_Mixer_StreamAddChannel(_Mixer, _RecordMonitorStream, BASSFlag.BASS_DEFAULT)
Now, that on its own is fine, there is no delay build up. However, if I then start casting by starting an encoder:
_Encoder = BassEnc.BASS_Encode_Start(_Mixer, _EncoderString, BASSEncode.BASS_ENCODE_NOHEAD Or BASSEncode.BASS_ENCODE_FP_16BIT Or BASSEncode.BASS_ENCODE_LIMIT, Nothing, IntPtr.Zero)
Then cast:
BassEnc.BASS_Encode_CastInit(_Encoder, .FullStreamURL, If(.Username.IsNullOrEmpty, .Password.Trim, .Username.Trim & ":" & .Password.Trim), _EncoderContent, .Title, .URL, .Genre, .Description, Nothing, CInt(.EncodingBitrate), .Public)
After a while there is a delay build up on the record stream which you can see by attaching a DSP Peak level to the mixer. When there is a delay, which can be anywhere from 1 to 10 seconds, if you open a file and add it to the _Mixer as well, there is no delay on that. It's only on the _RecordMonitorStream.
The delay comes and goes too. It can be 10 seconds but then later it's back down to 1 second and this only happens when it's casting. Stop the casting and there is no delay build up.
Is there a flag I need to set somewhere?