am_event_handler_vst_vr.cc

来自「Motorola synergy audio component」· CC 代码 · 共 193 行

CC
193
字号
/* (c) Copyright Motorola 2003, 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 VST Voice Recognition primitive handlers. *************** REVISION HISTORY *********************************************   Date       Author      Reference     Descritpion   ========   ========    ==========    ================================   07/15/05   aja099      LIBgg49853    Change handling of audio samples   09/24/03   w50175      dbg           Port VST-VR feature to GSM      06/13/03   aaa063      LIBdd01040    Implementation of VST VR functionality   05/01/03   w50175      LIBdd01040    Modify Audio Manager to accept VST VR port from CDMA T730*//************** INCLUDES ******************************************************/#include <SUAPI/suapi.h>#include <ENGINE_AUDIO/audio_conditional_compile_def.h>#include <ENGINE_AUDIO/memory.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 <ENGINE_HAPI/hapi_mdi_message_ids.h>#include <ENGINE_HAPI/hapi_mdi_queue_map.h>#include <ENGINE_HAPI/hapi_mdi_queue.h>#include <ENGINE_SEEM/seem.h>#include <seem/seem_globals.h>#include <seem/seem_data_stream_main_task.h>#include <audio/AM_HW_String_Primitive.H>#include <audio/AM_HW_Primitive_Builder.H>#include <ENGINE_AUDIO/aud_hw_stub_command_cnf.h>#include <SYNERGY_DEVICE_LAYER/dl_ports.h>#include <SYNERGY_DEVICE_LAYER/dl_media_auf.h>#include <ENGINE_AUDIO/am_hw_primitive_builder_interrupt.h>/************** LOCAL CONSTANTS ***********************************************//************** LOCAL STRUCTURES, ENUMS, AND TYPEDEFS *************************/extern AM_Event_Handler * am_event_handler;/************** LOCAL FUNCTION PROTOTYPES *************************************/// Function to copy the data from DSP shared buffer to RAMvoid TransferVSTVRFromMDItoRam(INT16 *temp_buf_ptr, INT16 *dsp_read_address);/************** LOCAL MACROS **************************************************/#define MCU_DSP_NUM_OF_READS 4#define MCU_DSP_PCM_BUFFER_FIRST_READ_ADDRESS       ((INT16 *)(MDI_START + 2*0x1100))#define MCU_DSP_PCM_BUFFER_OFFSET                   0x100#define MCU_DSP_NUM_SAMPLES_PER_PACKET              160#define NUM_LOOP_UNROLLS                            16/************** LOCAL VARIABLES ***********************************************//************** FUNCTION DEFINITIONS ******************************************//*==================================================================================================FUNCTION: handle_aud_vst_vr_recorded_data_ready_cbDESCRIPTION:   Access pcm and vocoder data from passed in message and pass it up to DL.ARGUMENTS PASSED:   incoming VR primitiveRETURN VALUE:   NoneRETURN MESSAGE:   NonePRE-CONDITIONS:   NonePOST-CONDITIONS:   NoneIMPORTANT NOTES:   This Event was posted within the Audio Manager when the GINT occurs to offload the interupt's   processing time.==================================================================================================*/void AM_Event_Handler::handle_aud_vst_vr_recorded_data_ready_req (void *msg){    SU_PORT_HANDLE dest_phandle = (SU_PORT_HANDLE)suFindName( DL_PORT_NAME_MEDIA_VR_SP,                                                              SU_WAIT_FOREVER,                                                              NULL);    AUD_AUDIO_SAMPLES_READY_IND_T * msgptr = NULL;    UINT16 idx = 0;    //INT16 *dsp_read_address = MCU_DSP_PCM_BUFFER_FIRST_READ_ADDRESS;    if(am_va_vr_int_info.eom == TRUE)    {        // reset va/vr database        am_event_handler->am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable VA recording command        am_event_handler->am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_RECORD);        // Send a return message indicating that recording is now off        Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS_SUCCESS,                                            AUD_VA_TIME_UNAVAILABLE,                                            0);        audVstParams.activity = AUD_VST_IDLE;    }       else     {        for(idx=0;idx<MCU_DSP_NUM_OF_READS;idx++,audVstParams.frame_count++)        {            /* Prepare to pass the PCM data pointers up to the DL */            msgptr = (AUD_AUDIO_SAMPLES_READY_IND_T*) suCreateMessage((UINT32)sizeof(AUD_AUDIO_SAMPLES_READY_IND_T),                                                                      (UINT32)AUD_AUDIO_SAMPLES_READY_IND_ID,                                                                      SU_INVALID_HANDLE,                                                                      NULL);            /* Strip off the header info */            memcpy(msgptr->pcm_data_buffer, &(((AUD_RECORDED_DATA_READY_REQ_T*)msg)->recorded_data[idx].pcm_buf[AM_HW_MSG_HEADER_WORD_LEN]),                   VST_PCM_FRAME_SIZE * sizeof(UINT16));            /* Strip off the header info */            memcpy(msgptr->voc_data_buffer, &(((AUD_RECORDED_DATA_READY_REQ_T*)msg)->recorded_data[idx].vocoded_data_buf[AM_HW_MSG_HEADER_WORD_LEN]),                   VST_MAX_VOCODED_DATA_FRAME_SIZE);            /* send message */            suSendMessage (msgptr, dest_phandle, NULL);            /* Buffers to read are 0x1100, 0x1200, 0x1300, and 0x1400 (from the dsp viewpoint - WORDS) */            //dsp_read_address += MCU_DSP_PCM_BUFFER_OFFSET;        }    }    return;}/*==================================================================================================FUNCTION: TransferVSTVRFromMDItoRamDESCRIPTION:   Used to copy the data from DSP shared buffer to ram.ARGUMENTS PASSED:   INT16 *temp_buf_ptr     - MCU address to write the PCM data to   INT16 *dsp_read_address - DSP address to read the PCM data fromRETURN VALUE:   NoneRETURN MESSAGE:   NonePRE-CONDITIONS:   NonePOST-CONDITIONS:   NoneIMPORTANT NOTES:   Don't try and read a 32-bit quantity from the MDI as it only allows 16-bit accesses.==================================================================================================*/void TransferVSTVRFromMDItoRam(INT16 *temp_buf_ptr, INT16 *dsp_read_address){    INT16 *frame_ptr;    UINT16 i = 0;#ifdef COPY_LOOP#undef COPY_LOOP#endif#define COPY_LOOP for( i = 0; i < VST_PCM_FRAME_SIZE/NUM_LOOP_UNROLLS; i++ ) { \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; \    *temp_buf_ptr++ = *frame_ptr++; *temp_buf_ptr++ = *frame_ptr++; }    frame_ptr = dsp_read_address;    COPY_LOOP}

⌨️ 快捷键说明

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