I am recording and encoding a file to MP3 while a MIDI file is playing. The aim is that they are synced at the start. The playback stream and the recording one have the same frequency and number of channels. When the recording is stopped, trying to play both streams using BASS_ChannelSetLink, a delay of around 200ms is appreciated in the encoded stream, instead of BASS_ChannelGetPosition for both streams returns the same value, something that does not happen while recording.
This is the code for recording and encoding while and midi playback. In this case, using BASS_ChannelSetLink does not seem to work.
recordStream=BASS_RecordStart(44100,2,MAKELONG(0,5),RecordingCallback,0);
BASS.BASS_ChannelSetAttribute(recordStream, BASS_ATTRIB_BUFFER, 0);
BASSenc_MP3.BASS_Encode_MP3_StartFile(recordStream, null, 0,filename);
streamMidi = BASSMIDI.BASS_MIDI_StreamCreateFile("other_file.mid", 0, 0, 0, 0);
BASS.BASS_ChannelSetAttribute(streamMidi, BASS_ATTRIB_BUFFER, 0);
BASS.BASS_ChannelPlay(streamMidi, false);
BASS.RECORDPROC RecordingCallback = new BASS.RECORDPROC() {
public boolean RECORDPROC(int handle, ByteBuffer buffer, int length, Object user) {
return true;
}
};
Is there a way to both streams get synced during the recording? Thanks
EDIT: another additional question that I noticed is that seeking does not seem work on BASS_ChannelSetLink , is it right? Wheen seeking in the channel that start the link, the linked channel does not follows the main one.