默认的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函数需要增加一个参数。 
|