QCC TX 音频输入切换+提示声音

QCC TX 音频输入切换+提示声音

QCC蓝牙芯片(QCC3040 QCC3056 等等),AUX、I2S、USB输入

蓝牙音频输入,模拟输出是最常见的方式。

也可以再此基础上动态切换输入方式。

针对TX切换EQ,调节音量不能出提示声音问题,可以增加本地提示声音然后混合(mix)到a2dp audio,然后在BT(sink)端出提示声音。

提示声音播放接口如下

void appKymeraHandleInternalTonePromptPlay(const KYMERA_INTERNAL_TONE_PROMPT_PLAY_T *msg)

{

kymeraTaskData *theKymera = KymeraGetTaskData();

output_source_t output = {0};

int16 volume_db = (msg->tone != NULL) ? KYMERA_CONFIG_TONE_VOLUME : KYMERA_CONFIG_PROMPT_VOLUME;

DEBUG_LOG("appKymeraHandleInternalTonePromptPlay, prompt %x, tone %p, ttp %d, int %u, lock 0x%x, mask 0x%x",
            msg->prompt, msg->tone, msg->time_to_play, msg->interruptible, msg->client_lock, msg->client_lock_mask);

kymera_SendStartInd(msg);

/* If there is a tone still playing at this point, it must be an interruptable tone, so cut it off */
if(appKymeraIsPlayingPrompt() || (!kymera_IsTheCorrectTonePromptChainReady(msg) && kymera_TonePromptIsReady()))
{
    appKymeraTonePromptStop();
}

kymera_PrepareOutputChain(msg->rate);
KymeraOutput_ChainStart();
output.aux = kymera_PrepareInputChain(msg);
PanicFalse(Kymera_OutputConnect(output_user_prompt, &output));
KymeraOutput_SetAuxVolume(volume_db);

if (KymeraOutput_SetAuxTtp(msg->time_to_play))
{
    rtime_t now = SystemClockGetTimerTime();
    rtime_t delta = rtime_sub(msg->time_to_play, now);
    DEBUG_LOG("appKymeraHandleInternalTonePromptPlay now=%u, ttp=%u, left=%d", now, msg->time_to_play, delta);
    uint16 delta_in_ms = (uint16)(delta/1000);
    TimestampEvent_Offset(TIMESTAMP_EVENT_PROMPT_PLAY, delta_in_ms);
}

/* Start tone */
if (theKymera->chain_tone_handle)
{
    ChainStart(theKymera->chain_tone_handle);
}

kymera_tone_state = kymera_tone_playing;
/* May need to exit low power mode to play tone simultaneously */
appKymeraConfigureDspPowerMode();

if (!msg->interruptible)
{
    appKymeraSetToneLock(theKymera);
}
theKymera->tone_client_lock = msg->client_lock;
theKymera->tone_client_lock_mask = msg->client_lock_mask;

}

相关推荐
TengTaiTech1 年前
QCC Tx 发射器(source)通话(麦克风输入)切换
蓝牙·qcc