环回音频实现?

Looping back audio implementation?

有人知道在 android 应用程序中实现音频环回功能的最佳方式是什么吗?
我需要开始录音并同时通过耳机播放录制的声音。
我正在考虑将记录的数据存储在缓冲区中,然后将该缓冲区传递给 while 循环中的 mediaPlayer 对象。你们怎么看,这是否可行或者是否有更好的方法(一些库等)?

我建议你看看Exoplayer since it provides you ways to implement your custom data source by implementing DataSource class. So you can implement the DataSource to use a stream to play the audio. The documentation is a little vague on how to override it but if you are willing to invest a bit of time to look into exoplayer code you will easily figure it out. Though not exactly your scenarion here is one of the POCs to show how custom source can be implemented CustomDataSource