I have been trying to stream mic feed directly from mic to speaker in which i am facing audio latency which varies from device to device.
Following is the code i have tried so far.
The library i am using right now is BASS un4seen for Android
val rchan = BASS.BASS_RecordStart(
freq, chans, BASS.BASS_RECORD_PAUSE,
{ handle, _, _, _ ->
BASSenc.BASS_Encode_IsActive(handle) != 0 // continue recording if encoder is alive
}, 0
)
val StreamProc =
BASS.STREAMPROC { handle, buffer, length, user ->
BASS.BASS_ChannelGetData(rchan, buffer, length) // get data from the recording stream
}开发者_开发百科
chanPlay = BASS.BASS_StreamCreate(44100, 1, 0, StreamProc, null);
BASS.BASS_ChannelPlay(chanPlay, false);
BASS.BASS_ChannelPlay(rchan, false)
精彩评论