Android version: 10
Android device: OnePlus 6
I have tried to apply Java AudioEffect
using sessionID
from AudioManager
getting help from this LINK but I always get NullPointerException
when using AcousticEchoCanceler.create(sessionId)
but when I pass the sessionId
of Java AudioRecord getAudioSessionId()
it works.
My Code is:
val audioManager: AudioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
val sessionId = audioManager.generateAudioSessionId()
C code is
recordingBuilder.setSessionId(static_cast<oboe::SessionId>(sessionId));
oboe::Result recordStreamResult = recordingBuilder.openStream(&recordStream);
I have tried this code on OnePlus 6 and Motorola One Macro.
I have resolved the issue of: Why my AcousticEchoCanceler.create(sessionId) returned null even though it was available.
Here is the code
When mode is explicitly set to MODE_IN_COMMUNICATION then AcousticEchoCancelation start working. From here you can enable or disable it.
Currently, I am using Oboe version: 1.5 stable