am_event_handler_vr.cc

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

CC
1,114
字号
       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_delete_req(void *msg){    AUD_SDVR_DELETE_VOICE_TAG_REQ *aud_sdvr_delete_req = (AUD_SDVR_DELETE_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 deletion request data from the incoming primitive to         // the voice tag deletion record in the VR server        am_event_va_vr_server.save_delete_voice_tag_data(aud_sdvr_delete_req->voice_tag);        // copy group id from the incoming primitive to the VR server        am_event_va_vr_server.save_vr_group_for_retrieval(aud_sdvr_delete_req->voice_tag.group_id);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_SDVR_DELETE_VOICE_TAG_CMD);         // generate voice tag deletion command        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_DELETE);    }    else    {        // build and send primitive to MMI to indicate voice tag deletion        // cannot be processed because of flash busy        Send2DeviceLayer_SDVR_Delete_Complete_Ind(TD_DSP_FLASH_BUSY, aud_sdvr_delete_req->voice_tag.group_id);    }}/* DESCRIPTION:       This function handles an incoming aud_sdvr_model_id_req primitive,        it asks the logic processor in application layer to retrieve SDVR        models.        The Model ID Request is sent by the MMI task to check what SDVR       models are stored in the DSP flash.   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_model_id_req(void *msg){    AUD_SDVR_MODEL_ID_REQ * aud_sdvr_get_models_req = (AUD_SDVR_MODEL_ID_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 group id from the incoming primitive to the VR server        am_event_va_vr_server.save_vr_group_for_retrieval(                                            aud_sdvr_get_models_req->group_id);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_SDVR_GET_MODELS_CMD);         // generate model retrieval command        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_GET_MODELS);    }    else    {        // build and send primitive to MMI to indicate model id retrieval        // cannot be processed because of flash busy        Send2DeviceLayer_SDVR_Model_ID_Ind(TD_DSP_FLASH_BUSY,                                            aud_sdvr_get_models_req->group_id,                                           0,                                           (UINT16  *)NULL);    }}/* DESCRIPTION:       This function handles an incoming aud_sdvr_start_req primitive,        it asks the logic processor in application layer to begin        speaker dependent voice recognition.         The Start Voice Recognition Request is sent by the MMI task to       start speaker dependent voice recognition.   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_start_req(void *msg){    AUD_SDVR_START_REQ * aud_sdvr_start_req = (AUD_SDVR_START_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 recognition request data from the incoming primitive to the        // recognition record in the VR server        am_event_va_vr_server.save_sdvr_recog_data(            aud_sdvr_start_req->group_id,            aud_sdvr_start_req->repeat_indication,            aud_sdvr_start_req->nbest,            aud_sdvr_start_req->active_bit_array_size,            aud_sdvr_start_req->active_bit_array,            aud_sdvr_start_req->time);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_SDVR_START_RECOG_CMD);        // generate speaker dependent voice recognition command        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR);    }    else    {        // build and send primitive to MMI to indicate         // speaker dependent voice recognition cannot be processed because of flash busy        Send2DeviceLayer_SDVR_Complete_Ind(TD_DSP_FLASH_BUSY, 0, (UINT16 *)NULL);    }}/* DESCRIPTION:       This function handles an incoming aud_sdvr_train_req primitive,        it asks the logic processor in application layer to start        training a SDVR model.        The Start Training Request is sent by the MMI task to train a       speaker dependent voice recognition model.   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_train_req(void *msg){    AUD_SDVR_TRAIN_REQ * aud_sdvr_train_req = (AUD_SDVR_TRAIN_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 training request data from the incoming primitive to the        // training record in the VR server        am_event_va_vr_server.save_training_data(                              aud_sdvr_train_req->group_id,                              aud_sdvr_train_req->training_mode,                              aud_sdvr_train_req->repetition_bit_mask);        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_SDVR_START_TRAIN_CMD);         // generate speaker dependent voice recognition model training command        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_TRAIN);    }    else    {        // build and send primitive to MMI to indicate the result of model training        Send2DeviceLayer_SDVR_Train_Complete_Ind(TD_VA_NO_WARNING, TD_DSP_FLASH_BUSY, TD_VR_INVALID_MODEL_ID);    }}/* DESCRIPTION:       This function handles an incoming aud_vr_stop_req primitive,        it asks the logic processor in application layer to turn off        any VR activities.        The Stop Voice Recognition Request is sent by the MMI task to stop       any active voice recognition activities including voice tag playback,       utterance capture, voice model training, and the actual voice       recognition.   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_vr_stop_req(void *msg){    // set vr command in the VR server    am_event_va_vr_server.set_command(AM_VA_VR_ABORT_CMD);    // disable all VR requests     am_event_logic_processor.disable_all_VA_VR();}/* DESCRIPTION:       This function emulates a VR Stop, but doesn't have an incoming primitive.                             INPUTS:        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_vr_stop_nomsg(void){    // set vr command in the VR server    am_event_va_vr_server.set_command(AM_VA_VR_ABORT_CMD);    // disable all VR requests     am_event_logic_processor.disable_all_VA_VR();}/* DESCRIPTION:       This function handles an incoming audscm_sdvr_capture_complete        primitive, it asks the logic processor in application layer to        turn off the utterance capture.        The Utterance Capture Completion is sent by the Speech Coder to        indicate utterance capture is done for the specified time interval.   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_audscm_sdsr_capture_complete(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))    {        AUDSCM_SDSR_CAPTURE_COMPLETE_IND * capture_complete_prim = (AUDSCM_SDSR_CAPTURE_COMPLETE_IND*)msg;        am_event_va_vr_server.condition_audscm_capture_complete(msg);        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_CAPTURE);        Send2DeviceLayer_SDVR_Capture_Complete_Ind(capture_complete_prim->error_code);    }}/* DESCRIPTION   INPUTS:   OUTPUTS:       None   IMPORTANT NOTES:      */voidAM_Event_Handler::handle_audscm_sdsr_enable_complete(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))    {        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_ENABLE);    }    Send2DeviceLayer_vr_message(AM_VR_ENABLE_CNF, TD_VR_SUCCESS); }/* DESCRIPTION     INPUTS:   OUTPUTS:       None       IMPORTANT NOTES:*/voidAM_Event_Handler::handle_audscm_sdsr_disable_complete(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))    {        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);               am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_DISABLE);    }    if (VR_Disable_Resp == TRUE)    {        Send2DeviceLayer_vr_message(AM_VR_DISABLE_CNF, TD_VR_SUCCESS);    }    /*Reset the abort semaphore*/    suAcquireSem(sem_abort_complete, SU_NOWAIT, NULL);    suReleaseSem(sem_abort_complete, NULL);}/* DESCRIPTION:       This function handles an incoming audscm_sdvr_complete        primitive, it asks the logic processor in application layer to        turn off the speaker dependent voice recognition.        The Speaker Dependent Voice Recognition Completion is sent by the        Speech Coder to indicate speaker dependent voice recognition is        done for the specified time interval.   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_audscm_sdsr_complete(void *msg)

⌨️ 快捷键说明

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