365894126 发表于 2021-7-20 20:46:52

qcc3034的系统自带提示音可以不混音吗?

本帖最后由 偶是小星哥 于 2021-7-22 00:28 编辑

也就是audio tones提示音,想播放提示音的时候音频静音,sink工程默认是播放提示音的时候和音乐混音输出的。
已解决,方法见6楼!

zhaopeng2511 发表于 2021-7-21 08:59:03

可以,要改代码,在Lib层

yaoziqiang 发表于 2021-7-21 10:59:09

可以的:lol

365894126 发表于 2021-7-21 14:26:37

zhaopeng2511 发表于 2021-7-21 08:59
可以,要改代码,在Lib层

老大,有方法吗?

365894126 发表于 2021-7-21 14:26:49

yaoziqiang 发表于 2021-7-21 10:59
可以的

老大,有方法吗?

365894126 发表于 2021-7-22 00:28:06

已解决,参考AudioPromptPlay的方法,方法这里公布下。
修改AudioPlayTone函数实现。具体参考代码,代码实际来源于AudioPromptPlay函数,因为AudioPromptPlay是可以直接实现不混音输出。
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"));
    }
}

liujinhan 发表于 2021-7-22 08:54:10

GOOD!

imp_wj 发表于 2021-7-22 14:06:18

偶是小星哥 发表于 2021-7-22 00:28
已解决,参考AudioPromptPlay的方法,方法这里公布下。
修改AudioPlayTone函数实现。具体参考代码,代码实 ...

{:3_59:}{:3_59:}懂分享的大神

李小千 发表于 2021-7-31 09:43:52

蓝牙蓝牙蓝牙,我的牙齿都蓝了 :lol
页: [1]
查看完整版本: qcc3034的系统自带提示音可以不混音吗?