#include "BoostLog.h" #include "main.h" #include void EchoRecordTask::setVqeEnabled(bool enabled) { if (m_vqeEnabled != enabled) { m_vqeEnabled = enabled; } } void EchoRecordTask::setChannels(int channels) { if (m_channels != channels) { m_channels = channels; } } void EchoRecordTask::run() { RkAudio::Format format; format.channels = m_channels; format.period = 64; m_output = std::make_shared(); if (!m_output->open(sizeof(uint16_t), format.sampleRate, format.channels, format.period, m_vqeEnabled)) { LOG(error) << "audio output open failed."; return; } m_input = std::make_shared(); m_input->setDataCallback([this](const RkAudio::Frame &frame) { m_output->write(frame.data, frame.byteSize); }); m_input->open(format, m_vqeEnabled); }