在C层使用OHAudio模块,直接注册OH\_AudioCapturer\_Callbacks 和 OH\_AudioRenderer\_Callbacks
static int32_t Capturer_OnReadData(OH_AudioCapturer* capturer, void* userData, void* buffer, int32_t lenth)
static int32_t Renderer_OnWriteData(OH_AudioRenderer* renderer, void* userData, void* buffer, int32_t lenth)
其中回调的buffer是实时音频数据(分别是mic 和 speaker)的pcm数据,现在需要实时的回调到UI层, 由UI层去处理,如何实现为最佳方案?
请参考:https://gitee.com/openharmony/applications\_app\_samples/tree/master/code/BasicFeature/Native/Audio
当前推荐的方案是通过消息队列方式通信的。