连续签到天数:1天 | 签到总天数:75天 | 签到总奖励:2866金币 |
|
楼主 |
发表于 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"));
- }
- }
复制代码
|
|