am_event_handler_vr.cc

来自「Motorola synergy audio component」· CC 代码 · 共 1,114 行 · 第 1/3 页

CC
1,114
字号
/* (c) Copyright Motorola 1997-2004 All rights reserved.   Motorola Confidential Proprietary   Contains confidential proprietary information of Motorola, Inc.   Reverse engineering is prohibited.   The copyright notice does not imply publication.     DESCRIPTION:       This file handles Voice Recognition related primitives:      aud_vr_stop_req, aud_sdvr_start_req, aud_play_voice_tag_req,       aud_sdvr_capture_req, aud_sdvr_train_req, aud_sdvr_delete_voice_tag_req,       audscm_voice_tag_complete, audscm_sdsr_complete,       audscm_sdsr_capture_complete, audscm_sdsr_train_complete and      audscm_sdsr_delete_complete. *************** REVISION HISTORY *********************************************     Date       Author      Reference   ========   ========    ==========================   2004-09-09 w16355      CR - LIBff14638              Bluephone: Audio Manager support for full duplex AMR voice.              - Renamed VA/VR tones from AM to DL for consistency.   02-01-23   w18944      LIBbb76397              Replace voicetag not working   02-11-12   qcf001      LIBbb65959              Fix voice shortcuts (invalid count)   01-12-02   w18944      LIBbb13452              Integrate VR LITE 2.0 (no global data)   01-04-19   rsubram     CSGce88902              Invoking previously trained Voice Shortcuts hangs the phone              - Made sure that only a length of 1 is sent if the second                model sent by DSP is garbage in handle_audscm_sdsr_complete.    01-03-15   mtaraba     CSGce90543              AM is sending CTG_ON command unnecessarily resulting in VR hangup   01-02-02   mtaraba     CSGce85434              MCU: Change VA record processing during training to 1st utterance.   00-12-21   mtaraba     CSGce82934              main_comp_hardware.h within engine_audio vob should be removed   00-11-09   mtaraba     CR - CSGce79507   00-10-25   mtaraba     CR - CSGce77692              Shortcut voice is not played while navigating in the shortcut list items   00-08-23   mtaraba     CR - CSGce65193              Move AM_AUDIO_PATH_TYPE enumeration to a global header file              - include audio_path_types.h   00-08-09   mtaraba     CR - CSGce55882              Eliminate file gsm.h from audio manager   00-04-27   mkloza      PR - CSGce54341              MATRIX command implementation              - removed calls to update_mode()   00-05-05   shagino     CR - CSGce56425              Implement handsfree_status funtion              - Updated DL types to match new naming convention   00-03-15   mkloza      PR - CSGce51641              Blue Tooth modifications for P2K platform              - removed parameters from update_mode() function   99-12-23   wchoi       PR - CSGce39558              - added VA/VR back into the system   99-10-25   ktang       PR - CSGce40785              GRiEF Audio: DL Audio Tone Types and DL DB Feature IDs              - replaced td tone types and ids with DL tone types and ids   99-08-02   mkloza      PR - CSGce34326              GRiEF   99-04-14   blamers     CR - CSGce30440              0601 Power Down when making a call              - The Audio Manager never received a CNF back from the SEEM and thus never                handled any other tone request primitives causing a power down. Do not                handle completion events from the DSP if the state of the AM is ABORT or                DO_NOTHING. A race condition exists between canceling an event and                receiving a completion event from the DSP. If the completion event is                handled after the event has been canceled the SEEM task may not send a CNF.   99-01-28   blamers     CR - CSGce26811              VA/VR FDI Interface Completion              - Added group_id to capture record.   99-01-04   dmuehl      CR - CSGce23316              Make Code 32 bit Clean for RAM Pointers              - Change task offsets to pointers.   98-12-21   blamers     CR - CSGce26131*//************** INCLUDES ******************************************************/#include <SUAPI/suapi.h>#include <stddef.h>#include <ENGINE_AUDIO/audio_conditional_compile_def.h>#include <ENGINE_AUDIO/audio_path_types.h>#include <ENGINE_AUDIO/td_vr_defs.h>#include <ENGINE_AUDIO/td_vr_group_types.h>#include <ENGINE_AUDIO/td_vr_training_types.h>#include <ENGINE_AUDIO/td_vr_voice_tag.h>#include <ENGINE_AUDIO/td_vr_error_codes.h>#include <ENGINE_AUDIO/td_vr_capture_reps.h>#include <ENGINE_AUDIO/td_aud_tone_req_tone_type.h>#include <ENGINE_AUDIO/aud_play_voice_tag_req.h>#include <ENGINE_AUDIO/audscm_sdsr_ind.h>#include <ENGINE_AUDIO/mmivr_sdvr_ind.h>#include <audio/aud_reformat_flash_ind.h>#include <ENGINE_AUDIO/aud_sdvr_capture_req.h>#include <ENGINE_AUDIO/aud_sdvr_delete_voice_tag_req.h>#include <ENGINE_AUDIO/aud_sdvr_model_id_req.h>#include <ENGINE_AUDIO/aud_sdvr_start_req.h>#include <ENGINE_AUDIO/aud_sdvr_train_req.h>#include <audio/am_app_configuration_server.h>#include <audio/AM_App_Configuration_Server.H>#include <audio/am_va_vr_command_types.h>#include <audio/AM_Event_Handler.H>#include <SYNERGY_DEVICE_LAYER/dl_audio_auf.h>#include <audio/AM_Device_Layer_Interface.H>#include <ENGINE_AUDIO/aud_interface.h>  #include <audio/AM_Tone_Sequence_Handler.H> #include <audio/AM_App_Logic_Processor.H>#include <audio/AM_Check_Avail_Timer.H>#include <audio/AM_Timer_Container.H>/************** LOCAL CONSTANTS ***********************************************//************** LOCAL STRUCTURES, ENUMS, AND TYPEDEFS *************************//************** LOCAL FUNCTION PROTOTYPES *************************************//************** LOCAL MACROS **************************************************//************** LOCAL VARIABLES ***********************************************/UINT8 VR_Enabled = FALSE;UINT8 VR_Disable_Resp = FALSE;AM_Relay_Layer relay_layer;extern SU_SEMA_HANDLE sem_abort_complete;#define INVALID_MODEL_ID_1 0X00FE#define INVALID_MODEL_ID_2 0X00FF/************** FUNCTION DEFINITIONS ******************************************/#if (AUDIO_SPEAKER_DEPENDENT_VR == TRUE)/* DESCRIPTION:       This function handles an incoming aud_play_voice_tag_req primitive,        it asks the logic processor in application layer to play one or more       requested voice tags.         The Play Voice Tag Request is sent by the MMI task to play one       or more voice tags.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_aud_play_voice_tag_req(void *msg){    AUD_PLAY_VOICE_TAG_REQ * aud_play_voice_tag_req = (AUD_PLAY_VOICE_TAG_REQ*)msg;    // VA/VR command in progress    AM_VA_VR_COMMAND_TYPE command_in_progress =                          am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);    if ((command_in_progress == AM_VA_VR_ABORT_CMD) || (command_in_progress == AM_VA_VR_DO_NOTHING_CMD))    {        // copy voice tag data from the incoming primitive to the voice tag        // record in the VR server        am_event_va_vr_server.save_play_voice_tag_data(            aud_play_voice_tag_req->voice_tag_count,            aud_play_voice_tag_req->voice_tag_array);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_VR_PLAY_VOICE_TAG_CMD);        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_VOICE_TAG);    }    else    {        // build and send primitive to MMI to indicate voice tag playback        // cannot be processed because of flash busy        Send2DeviceLayer_SDVR_Voice_Tag_Complete_Ind(TD_DSP_FLASH_BUSY);    }}/* DESCRIPTION:   This function handles an incoming aud_sdvr_enable_req primitive,   it asks the logic processor in application layer to enable VR.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:*/voidAM_Event_Handler::handle_aud_vr_enable_req(void *msg){    if(am_event_configuration_server.read(AM_CONFIGURATION_ID_INCALL) == FALSE)    {        if(VR_Enabled == FALSE)        {            am_event_va_vr_server.set_command(AM_SDVR_ENABLE_CMD);                am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_ENABLE);        }        else        {            Send2DeviceLayer_vr_message(AM_VR_ENABLE_CNF, TD_VR_VALUE_UNCH);        }        VR_Enabled = TRUE;    }    else    {        Send2DeviceLayer_vr_message(AM_VR_ENABLE_CNF, TD_VR_FAIL);    }}/* DESCRIPTION:   This function handles an incoming aud_sdvr_disable_req primitive,   it asks the logic processor in application layer to enable VR.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:*/voidAM_Event_Handler::handle_aud_vr_disable_req(void *msg){    VR_Disable_Resp = TRUE;    if(VR_Enabled != FALSE)    {        am_event_va_vr_server.set_command(AM_SDVR_DISABLE_CMD);            am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_DISABLE);        VR_Enabled = FALSE;    }    else    {        Send2DeviceLayer_vr_message(AM_VR_DISABLE_CNF, TD_VR_VALUE_UNCH);    }}/* DESCRIPTION:       This function disables VR without sending a notification.       We call it when a call is started and VR can't be enabled.   INPUTS:       None   OUTPUTS:       None       IMPORTANT NOTES:        */voidAM_Event_Handler::handle_aud_vr_disable_req_noresp(void){    VR_Disable_Resp = FALSE;    if(VR_Enabled != FALSE)    {        am_event_va_vr_server.set_command(AM_SDVR_DISABLE_CMD);        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_DISABLE);        VR_Enabled = FALSE;    }    /* Else, do nothing. */}/* DESCRIPTION:       This function handles an incoming aud_sdvr_capture_req primitive,        it asks the logic processor in application layer to begin       utterance capture.        The Start Utterance Capture Request is sent by the MMI task to       start utterance capture to be used for speaker dependent voice       recognition model training.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_aud_sdvr_capture_req(void *msg){    // VA/VR command in progress    AM_VA_VR_COMMAND_TYPE command_in_progress =                          am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);    if ((command_in_progress == AM_VA_VR_ABORT_CMD) ||        (command_in_progress == AM_VA_VR_DO_NOTHING_CMD))    {        AUD_SDVR_CAPTURE_REQ * aud_sdvr_capture_req = (AUD_SDVR_CAPTURE_REQ *)msg;        // copy capture request data from the incoming primitive to the capture        // record in the VR server        am_event_va_vr_server.save_capture_data(aud_sdvr_capture_req->repetition,                                                aud_sdvr_capture_req->time,                                                aud_sdvr_capture_req->group_id);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_SDVR_START_CAPTURE_CMD);                        if(aud_sdvr_capture_req->repetition == VR_CAPTURE_REP_WITH_VA)    // generate capture command        {            am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_CAPTURE_WITH_VA);        }        else        {            am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_CAPTURE);        }                }    else    {        // build and send primitive to MMI to indicate utterance capture        // cannot be processed because of flash busy        Send2DeviceLayer_SDVR_Capture_Complete_Ind(TD_DSP_FLASH_BUSY);    }}/* DESCRIPTION:       This function handles an incoming aud_sdvr_delete_req primitive,        it asks the logic processor in application layer to delete       SDVR model.         The Voice Tag Deletion Request is sent by the MMI task to       delete the specified speaker dependent voice recognition model.   INPUTS:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?