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

📄 am_app_va_vr_server.cc

📁 Motorola synergy audio component
💻 CC
字号:
/* (c) Copyright Motorola 1997, 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 defines AM_App_VA_VR_Server class.   *************** REVISION HISTORY *********************************************     Date       Author      Reference   ========   ========    ==========================   01-03-08   mtaraba     CSGce91273              Fix is_va_active() to report correctly   01-03-15   mtaraba     CSGce90543              AM is sending CTG_ON command unnecessarily resulting in VR hangup   00-09-01   blamers     CR - CSGce61298              Complete functionality for VA FF/Rew              - Make sure an abort is not performed when the command is set to                AM_VA_VR_DO_NOTHING_CMD.  On an abort, the DSP is halted and                the Device Layer is sent a CNF.   00-08-09   mtaraba     CR - CSGce55882              Eliminate file gsm.h from audio manager   00-05-05   shagino     CR - CSGce56425              Implement handsfree_status funtion              - Updated DL types to match new naming convention   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-31   mkloza      PR - CSGce34326              GRiEF   98-03-19   blamers     CR - CSGce17631              ARM Compiler Code fixes.              - Added static declarations.   98-02-26   mbonness    PR - CSGce17138              VA Capacity Reached Tone              - add memory full tone to VA/VR tones   98-02-04   slam        PR - CSGce16260              Double flip in VA/VR audio operations              - Add is_va_vr_audio_running function to indicate if a VA/VR                audio related operation is running or not.   97-09-22   slam        PR - CSGce11610              Voice Annotation development              - Rename VA warning tone to AUD_TONE_VA_VR_WARNING_TONE.              - Add is_va_tone().              - Expand VR server to be VA/VR server.   97-07-15   slam        PR - CSGce10240              Speaker Dependent Voice Recognition development              - Return group_id in get_vr_data_ptr() for model retrieval                command.              - Change get_vr_data_ptr() to return ptr to individual                 object of specific class that is used to manipulate                VR related data record.              - Add tone parameter in notify_mmi_vr_aborted_by_tone()                so that we can pass back different the error code to                MMI which needs to know whether VR is being aborted                by a key tone or by a non key tone.              - Remove reset().              - Move some codes to inline.              - Generalize condition check to see if a vr request is                being interrupted by a higher priority tone.              - Remove set_vr_data_ptr().              - Modify get_vr_data_ptr() to return vr_data_ptr                based on the vr command and the current audio path.              - Add instantiations of AM_VR_Playback_Record,                AM_SDVR_Capture_Record, AM_SDVR_Delete_Record,                AM_SDVR_Recog_Record, AM_SDVR_Train_Record in                the constructor.*//************** INCLUDES ******************************************************/#include <SUAPI/suapi.h>#include <audio/AM_App_VA_VR_Server.H>#include <ENGINE_AUDIO/td_vr_defs.h>#include <ENGINE_AUDIO/td_vr_error_codes.h>#include <ENGINE_AUDIO/mmivr_sdvr_ind.h>/************** LOCAL CONSTANTS ***********************************************//************** LOCAL STRUCTURES, ENUMS, AND TYPEDEFS *************************//************** LOCAL FUNCTION PROTOTYPES *************************************//************** LOCAL MACROS **************************************************//************** LOCAL VARIABLES ***********************************************//************** STATIC DECLARATIONS *******************************************/AM_APP_VA_VR_SERVER* AM_App_VA_VR_Server::am_app_va_vr_info = NULL;/************** FUNCTION DEFINITIONS ******************************************//* DESCRIPTION:       Class constructor    INPUTS:       pointer to VA/VR info   OUTPUTS:       None   IMPORTANT NOTES:       1. None     */AM_App_VA_VR_Server :: AM_App_VA_VR_Server ( AM_APP_VA_VR_SERVER *va_vr_info ) :        am_vr_playback_info( &va_vr_info->va_vr_data.playback_record ),        am_sdvr_capture_info( &va_vr_info->va_vr_data.capture_record ),        //        am_sdvr_delete_info( &va_vr_info->va_vr_data.deletion_record ),        am_sdvr_recog_info( &va_vr_info->va_vr_data.sdvr_recog_record ),        am_sdvr_train_info( &va_vr_info->va_vr_data.training_record ),        am_va_data_info( &va_vr_info->va_vr_data.va_data_info ){       am_app_va_vr_info = va_vr_info;    am_sdvr_delete_info =  &va_vr_info->va_vr_data.deletion_record;    // reset va/vr database    am_app_va_vr_info->command = AM_VA_VR_DO_NOTHING_CMD;    am_app_va_vr_info->va_active = FALSE;}/* DESCRIPTION:       Function to determine if phone is in VA recording.    INPUTS:       None   OUTPUTS:       TRUE if in VA recording       FALSE otherwise   IMPORTANT NOTES:       1. 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.     */BOOLAM_App_VA_VR_Server :: is_va_record( void ){    if(( am_app_va_vr_info->command == AM_VA_START_RECORD_CMD ) ||       ( am_app_va_vr_info->command == AM_VA_STOP_RECORD_CMD ))    {        return( TRUE );    }    else    {        return( FALSE );    }}/* DESCRIPTION:       Function to determine if phone is in VA playback.    INPUTS:       None   OUTPUTS:       TRUE if in VA playback   IMPORTANT NOTES:       1. None     */BOOLAM_App_VA_VR_Server :: is_va_playback( void ){    if( am_app_va_vr_info->command == AM_VA_PLAY_VOICE_NOTE_CMD )    {        return( TRUE );    }    else    {        return( FALSE );    }}/* DESCRIPTION:       Function to determine if va command is active    INPUTS:       None   OUTPUTS:       TRUE if VA is active, FALSE otherwise   IMPORTANT NOTES:       1. None     */BOOLAM_App_VA_VR_Server :: is_va_active( void ){    if( am_app_va_vr_info->va_active )    {        // va is active if the command is one of the active VA commands        return( TRUE );    }    else    {        // va is not active        return( FALSE );    }}/* DESCRIPTION:       Function to return va/vr command    INPUTS:       path type of the current audio event   OUTPUTS:       VA/VR command that corresponds to the current audio event   IMPORTANT NOTES:       1. None     */AM_VA_VR_COMMAND_TYPEAM_App_VA_VR_Server :: get_command( AM_AUDIO_PATH_TYPE path_type ){    if( path_type == AM_AUDIO_PATH_ID_VA_VR_IO ||        path_type == AM_AUDIO_PATH_ID_VA_IO ||          path_type == AM_AUDIO_PATH_ID_VR_IO ||          path_type == AM_AUDIO_PATH_ID_VA_VR_OUTPUT ||        path_type == AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO )    {        // return VA/VR command in the VA/VR server if the new audio event        // is a VA/VR request        return( am_app_va_vr_info->command );    }    else    // it's not a VA/VR request that is in front of the queue    {        if( is_va_active() == TRUE )        {            // Since non VA/VR related audio event can take place while            // VA command is in progress, we must not change command            // in the audio info. Simply return the va command as stored            // previously so that the HW layer will not interfere the VA            // operation going on in the HW.            return( am_app_va_vr_info->command );        }        else if( am_app_va_vr_info->command == AM_SDVR_DELETE_VOICE_TAG_CMD ||                 am_app_va_vr_info->command == AM_SDVR_START_TRAIN_CMD ||                 am_app_va_vr_info->command == AM_VA_VR_REFORMAT_FLASH_CMD ||                 am_app_va_vr_info->command == AM_VA_VR_DO_NOTHING_CMD )        {            // Since voice tag deletion, SDVR model training and            // flash reformat cannot be aborted, we must not change             // command in the audio info.            // Simply return the vr command as stored previously.            // If we are about to run the DO NOTHING command do not ABORT it            return( am_app_va_vr_info->command );        }        else        {            // Send abort VA/VR cmd down to the hardware layer if it is not            // a VA/VR request            return( AM_VA_VR_ABORT_CMD );        }    }}/* DESCRIPTION:       Function to return va/vr data ptr    INPUTS:       path type of the current audio event   OUTPUTS:       ptr to the VA/VR data that corresponds to the current audio event   IMPORTANT NOTES:       1. None     */void *AM_App_VA_VR_Server :: get_data_ptr( AM_AUDIO_PATH_TYPE path_type ){    void *data_ptr;    if( path_type == AM_AUDIO_PATH_ID_VA_VR_IO ||        path_type == AM_AUDIO_PATH_ID_VR_IO ||        path_type == AM_AUDIO_PATH_ID_VA_IO ||        path_type == AM_AUDIO_PATH_ID_VA_VR_OUTPUT ||        path_type == AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO )    {    // the new audio event is a VA/VR request        if( am_app_va_vr_info->command == AM_VA_VR_ABORT_CMD ||            am_app_va_vr_info->command == AM_VA_VR_DO_NOTHING_CMD ||            am_app_va_vr_info->command == AM_VA_VR_REFORMAT_FLASH_CMD )        {            // no data associates with abort cmd or do nothing cmd or            // flash reformat cmd            data_ptr = (void *) NULL;        }        else if( am_app_va_vr_info->command == AM_VA_START_RECORD_CMD ||                 am_app_va_vr_info->command == AM_VA_ERASE_VOICE_NOTE_CMD ||                 am_app_va_vr_info->command == AM_VA_PLAY_VOICE_NOTE_CMD )        {            // point to the va data info if it's an active VA command            data_ptr = (void *) &am_va_data_info;        }        else        {            switch( am_app_va_vr_info->command )            {            // point to the vr record associates with the vr command                case AM_VR_PLAY_VOICE_TAG_CMD:                    data_ptr = (void *) &am_vr_playback_info;                    break;                case AM_SDVR_START_CAPTURE_CMD:                    data_ptr = (void *) &am_sdvr_capture_info;                    break;                case AM_SDVR_DELETE_VOICE_TAG_CMD:                    data_ptr = (void *) &am_sdvr_delete_info;                    break;                case AM_SDVR_START_RECOG_CMD:                    data_ptr = (void *) &am_sdvr_recog_info;                    break;                case AM_SDVR_START_TRAIN_CMD:                    data_ptr = (void *) &am_sdvr_train_info;                    break;                case AM_SDVR_GET_MODELS_CMD:                    data_ptr = (void *) &am_app_va_vr_info->va_vr_data.group_id;                    break;                default:                    data_ptr = (void *) NULL;                    break;            }   // end of switch        }    }    else    {    // the new audio event is not a VA/VR request        if( am_app_va_vr_info->command == AM_SDVR_DELETE_VOICE_TAG_CMD )        {            // Since voice tag deletion cannot be            // aborted, we must not change va_vr_data_ptr in the audio info.            // Simply return the vr data ptr as stored previously.            data_ptr = (void *) &am_sdvr_delete_info;        }        else if( am_app_va_vr_info->command == AM_SDVR_START_TRAIN_CMD )        {            // Since SDVR model training cannot be            // aborted, we must not change va_vr_data_ptr in the audio info.            // Simply return the vr data ptr as stored previously.            data_ptr = (void *) &am_sdvr_train_info;        }        else if( am_app_va_vr_info->command == AM_VA_VR_REFORMAT_FLASH_CMD )        {            // Send null vr data ptr to the hardware layer for flash reformat            data_ptr = (void *) NULL;        }        else if( is_va_active() == TRUE )        {            // Since non VA/VR related audio event can take place while            // VA command is in progress, we must not change va_vr_data_ptr             // in the audio info. Simply return object data ptr as stored             // previously.            data_ptr = (void *) &am_va_data_info;        }        else        {            // Send null vr data ptr to the hardware layer if it is not            // a VR input nor a VR output request.            data_ptr = (void *) NULL;        }    }         return( data_ptr );}

⌨️ 快捷键说明

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