am_app_logic_processor_main.cc
来自「Motorola synergy audio component」· CC 代码 · 共 1,750 行 · 第 1/5 页
CC
1,750 行
{ /* if request is start tone, push it onto queue. * otherwise remove it from queue. * always update audio. */ if (request == AUD_TONE_START) { // With Bluephone functionality, we may get multiple start requests. // However, we only want one voice tone in the queue at any time, // so filter out redundant requests. if ( eventqueuehandler.FindItem( ( TD_AUD_TONE_REQ_TONE_TYPE_T )DL_AUDIO_TONE_TYPE_VOICE ) == NULL ) { eventqueuehandler.Push (DL_AUDIO_TONE_TYPE_VOICE, AM_AUDIO_PATH_ID_VOICE); } } else { eventqueuehandler.Remove (DL_AUDIO_TONE_TYPE_VOICE, 0); // Set amr NS boolean so that NS can be enabled in next call am_allow_ns = TRUE;#if (MAKE_FTR_VR == TRUE) // Let Device Layer know that we're available for VR again. if(vr_unavailable == TRUE) { Send2DeviceLayer_vr_message(AM_VR_AVAILABLE_IND, 0); vr_unavailable = FALSE; }#endif if(!eventqueuehandler.Exists()) { #if (AUDIO_GSM != TRUE) /* Don't keep muting after end of call */ if(DL_AccGetConnectionStatus(DL_ACC_DM_USB_CARKIT) == TRUE) { DL_AudSetMuteAlertState(DL_AUDIO_ENTERTAINMENT_MUTE_TYPE, FALSE); } else#endif if(DL_AccGetConnectionStatus(DL_ACC_DM_CE_BUS_ZIHF) == TRUE) { /* Screen out phones not supporting HAPI CE bus accy signals. */#if ((MAKE_NEPTUNE_CHIPSET == TRUE && MAKE_HDW_BB_IC != MAKE_HDW_NEPTUNE_LT) \ || (MAKE_NEPTUNE_CHIPSET == FALSE)) /* HAPI_get_power_ic_type() is only defined for C650, an LTS product. */#if (MAKE_HDW_BB_IC == MAKE_HDW_NEPTUNE_LTS) /* The call below will find out if we have seaweed, pcap or atlas ul. */ if (( HAPI_get_power_ic_type() == HAPI_POWER_IC_TYPE_PCAP ) || ( HAPI_get_power_ic_type() == HAPI_POWER_IC_TYPE_AUL ))#endif { /*Clear the entertainment mute*/ hPortConfigure(HAPI_FM_ACC_MUTE_EN); /*Active low, so enable = logic 0*/ primitive_builder.aud_hPortWrite( HAPI_FM_ACC_MUTE_EN, HAPI_SIGNAL_ENABLE, AM_HW_FM_ACC_MUTE_EN ); }#endif } } } update_audio (); return;}/* DESCRIPTION: Processes a vt voice event. Pushes AUD_TONE_VT_VOICE on queue when started and pops AUD_TONE_VT_VOICE from queue when stopped. INPUTS: action to perform OUTPUTS: None IMPORTANT NOTES: None */voidAM_App_Logic_Processor :: generate_vt_voice (TD_AUD_TONE_REQ_TYPE request){ /* if request is start tone, push it onto queue. * otherwise remove it from queue. * always update audio. */ if (request == AUD_TONE_START) { eventqueuehandler.Push (DL_AUDIO_TONE_TYPE_VT_VOICE, AM_AUDIO_PATH_ID_VT_VOICE); } else { eventqueuehandler.Remove (DL_AUDIO_TONE_TYPE_VT_VOICE, 0);#if (MAKE_FTR_VR == TRUE) // Let Device Layer know that we're available for VR again. if(vr_unavailable == TRUE) { Send2DeviceLayer_vr_message(AM_VR_AVAILABLE_IND, 0); vr_unavailable = FALSE; }#endif if(!eventqueuehandler.Exists()) { #if (AUDIO_GSM != TRUE) /* Don't keep muting after end of call */ if(DL_AccGetConnectionStatus(DL_ACC_DM_USB_CARKIT) == TRUE) { DL_AudSetMuteAlertState(DL_AUDIO_ENTERTAINMENT_MUTE_TYPE, FALSE); } else#endif if(DL_AccGetConnectionStatus(DL_ACC_DM_CE_BUS_ZIHF) == TRUE) { /* Screen out phones not supporting HAPI CE bus accy signals. */#if ((MAKE_NEPTUNE_CHIPSET == TRUE && MAKE_HDW_BB_IC != MAKE_HDW_NEPTUNE_LT) \ || (MAKE_NEPTUNE_CHIPSET == FALSE)) /* HAPI_get_power_ic_type() is only defined for C650, an LTS product. */#if (MAKE_HDW_BB_IC == MAKE_HDW_NEPTUNE_LTS) /* The call below will find out if we have seaweed, pcap or atlas ul. */ if (( HAPI_get_power_ic_type() == HAPI_POWER_IC_TYPE_PCAP ) || ( HAPI_get_power_ic_type() == HAPI_POWER_IC_TYPE_AUL ))#endif { /*Clear the entertainment mute*/ hPortConfigure(HAPI_FM_ACC_MUTE_EN); /*Active low, so enable = logic 0*/ primitive_builder.aud_hPortWrite( HAPI_FM_ACC_MUTE_EN, HAPI_SIGNAL_ENABLE, AM_HW_FM_ACC_MUTE_EN ); }#endif } } } update_audio (); return;}/* DESCRIPTION: Processes a data event. Pushes AUD_TONE_DATA on queue when started and pops AUD_TONE_DATA from queue when stopped. INPUTS: action to perform OUTPUTS: None IMPORTANT NOTES: None */voidAM_App_Logic_Processor :: generate_data (TD_AUD_TONE_REQ_TYPE request){ /* if request is start tone, push it onto queue. * otherwise remove it from queue. * always update audio. */ if (request == AUD_TONE_START) { eventqueuehandler.Push (DL_AUDIO_TONE_TYPE_VOICE, AM_AUDIO_PATH_ID_DATA); } else { eventqueuehandler.Remove (DL_AUDIO_TONE_TYPE_DATA, 0); } update_audio (); return;}BOOL IsAnyKey(UINT16 tone){ BOOL is_a_keypress = FALSE; // The range of tones between the PREV_TRACK and UI_LITE includes // the push-to-talk (PTT) tones, which are keypress tones. // However, providers want PTT tones to be heard, even at // the expense of interrupting voice and other audio media. if ( ( ( tone >= DL_AUDIO_TONE_TYPE_NEGATE_LITE ) && ( tone <= DL_AUDIO_TONE_TYPE_PREV_TRACK_LITE ) ) || ( ( tone >= DL_AUDIO_TONE_TYPE_UI_LITE_ID_LIMIT ) && ( tone <= DL_AUDIO_TONE_TYPE_VOLUMEKEY_MULTIMEDIA_LITE ) ) || ( ( tone >= DL_AUDIO_TONE_TYPE_GAME_YOU_WIN ) && ( tone <= DL_AUDIO_TONE_TYPE_GAME_ARM_PULL ) ) || ( ( tone >= DL_AUDIO_TONE_TYPE_MM_UI_KEY_MIDI ) && ( tone <= DL_AUDIO_TONE_TYPE_MM_UI_KEY_HI_FI) ) ) { is_a_keypress = TRUE; } return( is_a_keypress );}#if ( MAKE_TTY == TRUE )BOOL IsAnyTone(UINT16 tone){ if ( (tone >= DL_AUDIO_TONE_TYPE_CALLDROP_LITE) && (tone <= DL_AUDIO_TONE_TYPE_DAI_DIGITAL_DOWNLINK) ) { return TRUE; } return FALSE;}#endifBOOL IsEntertainmentAudio(UINT16 tone){ if ((tone >= DL_AUDIO_TONE_TYPE_MULTIMEDIA_CAPTURE) && (tone < DL_AUDIO_TONE_TYPE_MULTIMEDIA_ALERT_LIMIT)) { return TRUE; } return FALSE;}/* DESCRIPTION: Function to process a generic tone event. Pushes tone to start on queue and pops tone to stop from queue INPUTS: Parameter1 is DL_AUDIO_TONE_TYPE tone_type Parameter2 is TD_AUD_TONE_REQ_TYPE request OUTPUTS: None IMPORTANT NOTES: None*/voidAM_App_Logic_Processor :: generate_tone( TD_AUD_TONE_UNION_T tone, TD_AUD_TONE_REQ_TYPE request, TD_AUD_TONE_SEQUENCE_NUMBER_T sequenceID, TD_AUD_VOLUME_SETTING_T volstep, DL_AUDIO_TONE_TYPE_T vibrate_type, TD_AUD_TONE_UPLINK_T uplink, TD_AUD_MEDIA_INFO_T media_info, TD_AM_SAMPLING_RATE_T sampling_rate){ AM_AUDIO_PATH_TYPE path_type = AM_AUDIO_PATH_ID_INVALID_TONE; BOOL tone_removed = FALSE; Tone_Item* cur_tone_ptr = eventqueuehandler.GetCurrent(); //aim current tone in progress reord, may be null UINT8 rerun = 0; DL_DB_FEATURE_SETTING_T silent_all_output; UINT8 applied_vol = volstep; Tone_Item* phantom_tone; UINT32 cur_volume = DL_AUDIO_VOLUME_SETTING_CURRENT; if (request == AUD_TONE_START) { if ( ( tone.fields.id == DL_AUDIO_TONE_TYPE_RADIO ) || ( tone.fields.id == DL_AUDIO_TONE_TYPE_MP3_PLAYER ) ) { is_ext_generated_audio_on_queue = TRUE; } // IF there is anything on the tone queue // AND there is entertainment audio playing or an MP3 or FM radio tone is anywhere on the queue // AND the tone to play is a key feedback tone // THEN mute the tone by not pushing it onto the queue (ignore it!) // NOTE: This assumes the APPs will stop MP3 and FM radio whenever a call // or VA/VR mode is entered, and a start request will be made when // the call or VA/VR mode is exited. // Since we don't have the calling apps code for stopping MP3, I am // temporarily adding another condition so that the key presses are not muted // in a call. if( cur_tone_ptr && (IsEntertainmentAudio(cur_tone_ptr->ToneEvent.type) || is_ext_generated_audio_on_queue) && IsAnyKey(tone.fields.id) && !(relay_layer.is_incall()) ) { if (isMultimediaKeyUI(tone.fields.id)) { MME_RESM_AM_Tone_Indication(tone.fields.id, MME_RESM_AUD_REJECT); } //If it is a power down tone and MP3 is connected, do not mute it. if (tone.fields.id != DL_AUDIO_TONE_TYPE_POWERDOWN_LITE) { tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; } } /* When there is start request for camera, just call the MME function and do not push it * onto the queue. */ if (tone.fields.id == DL_AUDIO_TONE_TYPE_MULTIMEDIA_VIDEO) { MME_RESM_AM_Tone_Indication(tone.fields.id, MME_RESM_AUD_START); tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; }#if (MAKE_TTY == TRUE) if ( ( DL_AccGetConnectionStatus( DL_ACC_DM_DIG_TTY ) == TRUE ) && ( IsAnyTone(tone.fields.id) == TRUE ) && ( relay_layer.is_incall()== TRUE ) ) { tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; } #endif // VA/VR command in progress AM_VA_VR_COMMAND_TYPE command_in_progress = va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO); // if key tone is mute, don't queue any keypress tones if ((relay_layer.is_key_tone_mute()) && relay_layer.IsDTMFKey(tone.fields.id) ) { tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; }#if (MAKE_FTR_VA == TRUE) /* During VA recording and playback disable NON-DTMF keys */ else if(( (relay_layer.is_va_record()) || (relay_layer.is_va_playback()) ) && relay_layer.IsDTMFKey(tone.fields.id)) { tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; } else if(command_in_progress == AM_SDVR_START_CAPTURE_CMD && IsAnyKey(tone.fields.id)) { //if va command is in progress don't allow tone tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; }#endif /* if phone volume is 0, don't enqueue keytone to minimize pops */ if (volstep == DL_AUDIO_VOLUME_SETTING_CURRENT) { DL_DbFeatureGetValue ( DL_DB_FEATURE_ID_ENGINE_CURRENT_PHONE_VOLUME, &cur_volume ); } if( ((cur_volume == 0) || (volstep == 0)) && (IsAnyKey(tone.fields.id)) ) { tone.type = DL_AUDIO_TONE_TYPE_INVALID_TONE; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?