找回密码
 立即注册

使用微信账号登录

只需一步,快速开始

qcc51xx qcc30xx adk6.4 sink工程实现提示音不混音播放

2021-7-22 00:41| 发布者: 365894126| 查看: 2931| 评论: 6

摘要: 默认的sink工程,tones提示音和语音提示音都是混音输出,有些时候需要不混音输出,也就是播放提示音时音乐静音掉。这里提供方法。1. 关闭自定义语音提示混音输出,修改CsrVoicePromptsIsMixable函数,把里面的true改 ...
默认的sink工程,tones提示音和语音提示音都是混音输出,有些时候需要不混音输出,也就是播放提示音时音乐静音掉。这里提供方法。
1. 关闭自定义语音提示混音输出,修改CsrVoicePromptsIsMixable函数,把里面的true改为false即可。

bool CsrVoicePromptsIsMixable(FILE_INDEX prompt_header_index)
{
    UNUSED(prompt_header_index);
    return FALSE;
}
2. 关闭sink自带tones提示音混音输出功能,实现方法参考AudioPlayAudioPrompt函数
a. 修改 apps\libs\audio\audio.c文件

void AudioPlayTone ( const ringtone_note * tone , bool can_queue ,  int16 tone_volume , AudioPluginFeatures features, Task app_task )
{
    if (!IsAudioBusy() || can_queue)
    {
        Task plugin = audioGetControlPlugin();

        MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_PLAY_TONE_MSG, message ) ;

        message->tone        = tone;
        message->can_queue   = can_queue ;
        message->tone_volume = tone_volume  ;
        message->features    = features ;

        if(plugin)
        {
            #if 0
            PRINT(("AUDIO: play tone, plugin = %p \n",(void*)plugin));
            MessageSendConditionallyOnTask ( plugin, AUDIO_PLUGIN_PLAY_TONE_MSG, message, AudioBusyPtr() ) ;
            #else
                PRINT(("AUD play -Audio Prompt disconnect audio\n"));
                /*if we have a plugin connected, then perform the disconnect*/
                MessageSendConditionallyOnTask ( plugin, AUDIO_PLUGIN_DISCONNECT_MSG , 0 , AudioBusyPtr() ) ;
                MessageSendConditionallyOnTask ( plugin , AUDIO_PLUGIN_PLAY_TONE_MSG , message , AudioBusyPtr() ) ;

                /* Queue message to reconnect plugin */
                {
                    MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_CONNECT_MSG, connect_message ) ;
                    *connect_message = AUDIO->message;
                    MessageSendConditionallyOnTask ( plugin, AUDIO_PLUGIN_CONNECT_MSG , connect_message , AudioBusyPtr() ) ;
                }

                /*  Start the reconnected plugin with all audio groups muted.
                    When the application receives the following AUDIO_REFRESH_VOLUME message it should
                    restore the the correct mute status for all the groups using AudioSetSoftMute().
                    If, for example, the mic was muted in the audio plugin before the audio prompt was played,
                    this ensures the mic remains muted until the application has chance to update the mute status.
                */
                {
                    MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_SET_SOFT_MUTE_MSG, soft_mute_message ) ;
                    soft_mute_message->mute_states = AUDIO_MUTE_ENABLE_ALL;
                    soft_mute_message->unused = 0;
                    MessageSendConditionallyOnTask ( plugin, AUDIO_PLUGIN_SET_SOFT_MUTE_MSG , soft_mute_message , AudioBusyPtr() ) ;
                }

                /* Request that the app refreshes the volume and mute status after reconnect */
                {
                    PRINT(("AUD:Vol refresh\n"));
                    MessageSendConditionallyOnTask(app_task, AUDIO_REFRESH_VOLUME, NULL, AudioBusyPtr());
                }

                if ( NULL != AUDIO->relay_plugin)
                {
                    MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_START_FORWARDING_MSG, start_forwarding_message ) ;

                    start_forwarding_message->forwarding_sink = AUDIO->forwarding_sink ;
                    start_forwarding_message->content_protection = AUDIO->content_protection ;
                    start_forwarding_message->output_plugin = AUDIO->output_plugin;

                    MessageSendConditionallyOnTask ( AUDIO->relay_plugin, AUDIO_PLUGIN_START_FORWARDING_MSG, start_forwarding_message , AudioBusyPtr()) ;
                }
            #endif
        }
        else
        {
            PRINT(("AUDIO: play tone, no plugin \n"));
            /* Forward message to the Voice Prompts plugin as the DSP is required for multi-channel tones */
            MessageSendConditionallyOnTask( (TaskData*)&csr_voice_prompts_plugin, AUDIO_PLUGIN_PLAY_TONE_MSG, message, AudioBusyPtr() ) ;
        }
    }
    else
    {
        PRINT(("AUDIO: discard tone \n"));
    }
}

b. 需要注意的是,由于需要往lib层送入应用层的参数,所以AudioPlayTone函数需要增加一个参数。



路过

雷人

握手

鲜花

鸡蛋

相关阅读

发表评论

最新评论

引用 wgc2013 2023-5-23 11:42
加完后,播放提示音的会panic掉,是不是有什么少了
引用 365894126 2021-8-8 23:28
坚强打工人: MIC静音功能如果设置提示音的话就能有提示音呀
没有深入研究,应该可以解决,
引用 坚强打工人 2021-8-5 11:59
偶是小星哥: 通话过程中为啥有提示音出来??
MIC静音功能如果设置提示音的话就能有提示音呀
引用 365894126 2021-8-4 16:10
坚强打工人: 语音提示部分直接把true改为false好像有个bug,通话的时候如果中途有个提示音会把通话的声音mute掉
通话过程中为啥有提示音出来??
引用 想~nl 2021-7-27 21:48
QQ啊撒
引用 坚强打工人 2021-7-27 09:37
语音提示部分直接把true改为false好像有个bug,通话的时候如果中途有个提示音会把通话的声音mute掉

查看全部评论(6)

小黑屋|手机版|我爱蓝牙网 - 52Bluetooth

GMT+8, 2024-3-28 20:51 , Processed in 0.120998 second(s), 16 queries , Gzip On, MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部