I am recording audio using AudioRecord and playing using AudioTrack. I am recording Fm analog audio stream using this classes and simultaneously passing into Bluetooth router. Its successfully working with Motorola and Samsung S5. But not working with Samsung Galaxy S6.
This is the sample code how i am recording
audioManager.startBluetoothSco();
audioManager.setBluetoothScoOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
//FM_SRC is the FM receiving Antenna
mRecorder = new AudioRecord(FM_SRC, sampleRateInHz,
channelConfigIn,
AudioFormat.ENCODING_PCM_16BIT,
bufferSizeInBytes);
mAudioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL,
sampleRateInHz, channelConfigOut,
AudioFormat.ENCODING_PCM_16BIT,
bufferSizeInBytes,
AudioTrack.MODE_STREAM);
mRecorder.startRecording();
mAudioTrack.play();
byte data[] = new byte[bufferSizeInBytes];
//Shuffling buffers from record to track object until A2DP routing selected
while (mOverA2DP) {
// Log.e(TAG, "mOverA2DP:" + mOverA2DP);
mRecorder.read(data, 0, bufferSizeInBytes);
mAudioTrack.write(data, 0, bufferSizeInBytes);
}
Please help me.