⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 am_event_handler_audio_va.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 2 页
字号:
    // save VoiceNote id from the incoming primitive to the  record in the VA/VR server    am_event_va_vr_server.save_va_data(AM_NON_AUDIO_PATH,                                       aud_va_command_req->voicenote_number);    // set command in the VA/VR server    am_event_va_vr_server.set_command(AM_VA_ERASE_VOICE_NOTE_CMD);     // generate a Erase VoiceNote command    am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_VA_ERASE);}/* DESCRIPTION:       This function handles a Stop VA request. It asks the logic processor       in application layer to turn off all VA requests.    INPUTS:       incoming VA primitive       va_offset to save for next playback   OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          digital VA is set to TRUE.             2. VA recording is still considered on going even when          MMI initiates a STOP VA reqest (ie. AM_VA_STOP_RECORD_CMD).          When the HW completes stopping VA recording, the command          will be set to AM_VA_VR_DO_NOTHING_CMD.*/void AM_Event_Handler::handle_va_stop_req(void *msg, AM_VA_OFFSET va_offset){    /* If a stop command is received and there is no valid VA operation,       it is because there is a race condition consisting of the following sequence:       1) End of Message is reached and HW sends that primitive to AM       2) AM process that VA primitive and forwards it to MMI       3) Meanwhile, the user requests a Stop before MMI receives the          End of Message status from AM       A confirm primitive never gets sent to MMI which causes a lock up.    */    if (!am_event_va_vr_server.is_va_active())    {        // build and send primitive to MMI to confirm the VA Stop command received        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                             0);                if (send_ind == TRUE)        {            am_event_va_vr_server.save_va_data(va_offset);            // build and send primitive to MMI to indicate the erase request is complete            Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);            send_ind = FALSE;        }        // all va/vr tones in the queue must be removed. Need not send anything to        // dsp because even the start has not been sent in this scenario.        am_event_logic_processor.remove_all_VA_VR();        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        }    else    {        if (am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO) ==           AM_VA_START_RECORD_CMD)        {            am_event_va_vr_server.set_command(AM_VA_STOP_RECORD_CMD);        }        else        {            // save va_offset data before VA is aborted            am_event_va_vr_server.save_va_data(va_offset);            am_event_va_vr_server.set_command(AM_VA_VR_ABORT_CMD);        }        // disable all active VA requests.        am_event_logic_processor.disable_all_VA_VR();    }}/* DESCRIPTION:       This function handles an incoming audscm_va_record_complete primitive.       It asks logic processor in application layer to turn off the       recording.    INPUTS:       incoming VA primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          digital VA is set to TRUE.       2. In Whitecap Record complete is completely handled in the Hardware Layer. The AM          will remain in the AM_VA_STOP_RECORD_CMD state until it receives both a record          complete primitive and seem stop indication primitive, in that order.*/void AM_Event_Handler::handle_audscm_va_record_complete(void *msg){    // Call the record complete conditioning function. This call sets up a SEEM Stop Indication    // so that the elapsed time may be returned to the MMI.    am_event_va_vr_server.condition_audscm_complete();}/* DESCRIPTION:       This function handles an incoming audscm_va_playback_complete primitive.       It asks logic processor in application layer to turn off the       VA playback.    INPUTS:       incoming VA primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          digital VA is set to TRUE.       2. In Whitecap this complete will be sent on the completion of a VR Voice Tag. The Complete          for the VR Voice Tag must only be handled if the Relay Layer function is true.*/void AM_Event_Handler::handle_audscm_va_playback_complete(void *msg){    AUDSCM_VA_PLAYBACK_COMPLETE_IND* audscm_va_playback_complete =        (AUDSCM_VA_PLAYBACK_COMPLETE_IND*)msg;    AM_VA_VR_COMMAND_TYPE command = am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_IO);    if (command == AM_VA_PLAY_VOICE_NOTE_CMD)    {        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable VA playback command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_PLAYBACK);        // build and send primitive to MMI to indicate the result of playback        Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);    }    // In Whitecap/Patriot a VR Voice Tag is played in the same way as a VA Voice Tag.    // VR tags are only handled if the stop was done in the interrupt routine.    else if ((AM_Relay_Layer::handle_vtag_complete()) && (command == AM_VR_PLAY_VOICE_TAG_CMD))    {        handle_audscm_voice_tag_complete(msg);    }    // The Interrupt routine sets handle_vtag_complete to TRUE for both VA and VR stops. The    // interrupt can not determine if a VA or VR Playback has ended.    AM_Relay_Layer::handle_vtag_complete();    // Fake a resume from the device layer to make sure AM sets the offset correctly.    if (send_start_play_req == TRUE)    {        handle_va_start_play_req(&saved_msg, AM_VA_OFFSET_END);        send_start_play_req = FALSE;    }}void AM_Event_Handler::handle_seem_data_stream_stop(void *msg){    if ((am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_IO)         == AM_VA_STOP_RECORD_CMD))    {        SEEM_DATA_STREAM_STOP_IND* seem_ind = (SEEM_DATA_STREAM_STOP_IND*)msg;        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable VA recording command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_RECORD);        if (seem_ind->msg_limit_reached)        {            // This condition must never be met. Currently the DSP will not recover.            // Notify MMI that VA storage is full            Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_MEMORY_FULL_WARNING);        }        else        {            // build and send primitive to MMI to indicate the VA elapsed time            Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                                AUD_VA_TIME_UNAVAILABLE,                                                am_va_ticks(seem_ind->words_accessed));        }    }    else if (am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_IO) ==                 AM_VA_ERASE_VOICE_NOTE_CMD)    {        SEEM_DATA_STREAM_STOP_IND* seem_ind = (SEEM_DATA_STREAM_STOP_IND*)msg;        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable voice note deletion command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_ERASE);        // build and send primitive to MMI to indicate the VA time gained        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                            am_va_ticks(seem_ind->words_accessed));        // Notify MMI that the erase was successful        Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);    }}/* DESCRIPTION:       This function handles an incoming audscm_va_erase_complete primitive.       It asks logic processor in application layer to turn off the        VA Erase VoiceNote.   INPUTS:       incoming VA primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          digital VA is set to TRUE.*/void AM_Event_Handler::handle_audscm_va_erase_complete(void *msg){    AUDSCM_VA_ERASE_COMPLETE_IND* audscm_va_erase_complete_prim =        (AUDSCM_VA_ERASE_COMPLETE_IND*)msg;    // reset va/vr database    am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);    // disable voice note deletion command    am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_ERASE);    // build and send primitive to MMI to indicate the voice note deletion is completed.    Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);}/* DESCRIPTION:       This function handles an incoming aud_hw_stub_command_cnf primitive.    INPUTS:       incoming audio HW stub command confirm primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. For DVA, the Audio HW Stub Command Confirm is sent by the AM           HW layer for fast forward, start record or start playback           commands. It is used to indicate the VA command confirm should           be sent to MMI so that a new VA command (eg. stop request) can           be sent if necessary.       2. For AVA, the Audio HW Stub Command Confirm is sent by the AM          HW layer for reformat flash command. It is used to indicate          the reformat flash completion indication should be sent to MMI          so that MMI is not blocked anymore.*/void AM_Event_Handler::handle_aud_hw_stub_command_cnf(void *msg){    AUD_HW_STUB_COMMAND_CNF* am_hw_stub_command_cnf = (AUD_HW_STUB_COMMAND_CNF*)msg;    AM_HW_STUB_COMMAND hw_stub_command = am_hw_stub_command_cnf->command;    if (hw_stub_command == AM_HW_STUB_VA_ERASE_CNF)    {        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable VA erase all command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_ERASE);        // build and send primitive to MMI to confirm the VA command was received        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                             0);        // build and send primitive to MMI to indicate the erase request is complete        Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);    }    else if (hw_stub_command == AM_HW_STUB_REFORMAT_FLASH_CNF)        {        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);                // disable reformat flash command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_VR_REFORMAT);        // build and send primitive to MMI to indicate the reformat flash request is complete        Send2DeviceLayer_Reformat_Ind(TD_VA_STATUS_SUCCESS);    }    else if (send_ind == TRUE)    {        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                             0);                // build and send primitive to MMI to indicate the erase request is complete        Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS_SUCCESS);        send_ind = FALSE;    }    else    {        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                             0);    }    // We need to do this here because if the VA stop to the DSP gets sent because     // reset was called when the queue is empty, the command is still stuck in the    // previous state and does not get updated.    if ((hw_stub_command == AM_HW_STUB_VA_STOP_PLAY_CNF)    &&  (am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_IO) == AM_VA_PLAY_VOICE_NOTE_CMD))    {        am_event_va_vr_server.set_command(AM_VA_VR_ABORT_CMD);    }}#endif

⌨️ 快捷键说明

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