/**************************************************************************** NAME audioHfpConnectAudio DESCRIPTION attempt to reconnect an audio connection from the sink value associcated with the passed hfp instance RETURNS */ void audioHfpConnectAudio (hfp_link_priority priority, Sink sink) { uint8 index = PROFILE_INDEX(priority); /* ensure sink is valid before trying to route audio */ TaskData *plugin = NULL; /* ensure a valid codec is negotiated, should be at least cvsd */ if(theSink.profile_data[index].audio.codec_selected) { AudioPluginFeatures features; /* determine additional features applicable for this audio plugin */ features.stereo = (AUDIO_PLUGIN_FORCE_STEREO || theSink.features.stereo); features.use_i2s_output = theSink.features.UseI2SOutputCapability; theSink.routed_audio = sink; plugin = audioHfpGetPlugin(theSink.profile_data[index].audio.codec_selected, theSink.features.audio_plugin); AUD_DEBUG(("AUD: plugin [%d] [%d], sink [%x]\n" , theSink.features.audio_plugin , theSink.profile_data[index].audio.codec_selected , (uint16)theSink.routed_audio)) ; /* connect audio using the audio plugin selected above */ AudioConnect ( plugin, theSink.routed_audio , theSink.profile_data[index].audio.link_type , theSink.codec_task , theSink.conf1->gVolMaps[ theSink.profile_data[index].audio.gSMVolumeLevel ].VolGain , theSink.profile_data[index].audio.tx_bandwidth , features , AUDIO_MODE_CONNECTED, AUDIO_ROUTE_INTERNAL, powerManagerGetLBIPM(), AUDIO_CONNECT_PARAMS, NULL ) ; audioControlLowPowerCodecs (TRUE) ; AUD_DEBUG(("AUD: Route SCO\n")); AUD_DEBUG(("Audio Connect[%d][%x]\n", theSink.features.audio_plugin , theSink.profile_data[index].audio.gSMVolumeLevel )) ; AudioSetVolume ( theSink.conf1->gVolMaps[ theSink.profile_data[index].audio.gSMVolumeLevel ].VolGain , TonesGetToneVolume(FALSE), theSink.codec_task ) ; /* mute control */ VolumeSetMicrophoneGain(priority, (theSink.profile_data[index].audio.gMuted ? VOLUME_MUTE_ON : VOLUME_MUTE_OFF)); } }
/**************************************************************************** NAME audioHfpConnectAudio DESCRIPTION attempt to reconnect an audio connection from the sink value associcated with the passed hfp instance RETURNS */ void audioHfpConnectAudio (hfp_link_priority priority, Sink sink) { uint8 index = PROFILE_INDEX(priority); /* ensure sink is valid before trying to route audio */ TaskData *plugin = NULL; /* ensure a valid codec is negotiated, should be at least cvsd */ if(theSink.profile_data[index].audio.codec_selected) { /* determine additional features applicable for this audio plugin */ theSink.routed_audio = sink; plugin = audioHfpGetPlugin(theSink.profile_data[index].audio.codec_selected, theSink.features.audio_plugin); AUD_DEBUG(("AUD: plugin [%d] [%d], sink [%x]\n" , theSink.features.audio_plugin , theSink.profile_data[index].audio.codec_selected , (uint16)theSink.routed_audio)) ; /* connect audio using the audio plugin selected above */ AudioConnect ( plugin, theSink.routed_audio , theSink.profile_data[index].audio.link_type , theSink.codec_task , theSink.conf1->volume_config.gVolMaps[ theSink.profile_data[index].audio.gSMVolumeLevel ].VolGain , theSink.profile_data[index].audio.tx_bandwidth , theSink.conf2->audio_routing_data.PluginFeatures , AUDIO_MODE_CONNECTED, AUDIO_ROUTE_INTERNAL, powerManagerGetLBIPM(), AUDIO_CONNECT_PARAMS, koovox.presentEnable, &theSink.task) ; DEBUG(("===presentEnable=%d\n", koovox.presentEnable)); audioControlLowPowerCodecs (TRUE) ; AUD_DEBUG(("AUD: Route SCO\n")); AUD_DEBUG(("Audio Connect[%d][%x]\n", theSink.features.audio_plugin , theSink.profile_data[index].audio.gSMVolumeLevel )) ; AudioSetVolume ( theSink.conf1->volume_config.gVolMaps[ theSink.profile_data[index].audio.gSMVolumeLevel ].VolGain , TonesGetToneVolume(FALSE), theSink.codec_task ) ; /* mute control */ VolumeSetMicrophoneGain(priority, (theSink.profile_data[index].audio.gMuted ? VOLUME_MUTE_ON : VOLUME_MUTE_OFF)); } }