コード例 #1
0
void AUDDRV_User_CtrlDSP ( AudioDrvUserParam_t audioDrvUserParam, void *user_CB, UInt32 param1, UInt32 param2 )
{
	Boolean spkProtEna = FALSE;

	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_User_CtrlDSP *\n\r");
	if (user_CB != NULL)
		sUserCB = user_CB;

	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_User_CtrlDSP, UserCB = %x *\n\r", sUserCB);
	switch (audioDrvUserParam)
	{
		case AUDDRV_USER_GET_SPKPROT:
			Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_UserCtrlDSP, AUDDRV_USER_GET_SPKPROT *\n\r");
			
			audio_control_dsp(DSPCMD_TYPE_COMMAND_SP, 3, (UInt16) param1, 0,0,0);
			break;
		case AUDDRV_USER_ENA_SPKPROT:
			Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_UserCtrlDSP, AUDDRV_USER_ENA_SPKPROT *\n\r");
			spkProtEna = (Boolean) param1;
			if (spkProtEna)
				
				audio_control_dsp(DSPCMD_TYPE_COMMAND_SP, (UInt16) spkProtEna, (UInt16) param2, 1,0,0);
			
			else
				audio_control_dsp(DSPCMD_TYPE_COMMAND_SP, (UInt16) spkProtEna, (UInt16) param2, 0,0,0);
			
			break;
		default:
			Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_User_CtrlDSP: Invalid request %d \n\r", audioDrvUserParam);
			break;
	}
}
コード例 #2
0
void AUDDRV_Enable_Input (
                    AUDDRV_InOut_Enum_t      input_path,
                    AUDDRV_MIC_Enum_t        mic_selection,
					AUDIO_SAMPLING_RATE_t    sample_rate )
{
#if defined(FUSE_APPS_PROCESSOR)
	currInputSamplingRate = sample_rate;
	
	AUDDRV_EnableHWInput ( input_path, mic_selection, sample_rate,
		AUDDRV_REASON_HW_CTRL );

	switch(input_path) {
	case AUDDRV_VOICE_INPUT:
		
		Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Enable_Input mic_selection %d *\n\r", mic_selection );

		if(inVoiceCall != TRUE)
		{
			//if inVoiceCall== TRUE, assume the telphony_init() function sends ENABLE and CONNECT_UL
			if (sample_rate == AUDIO_SAMPLING_RATE_8000)
			{
				currInputSamplingRate = AUDIO_SAMPLING_RATE_8000;
				audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_UL, 1, 0, 0, 0, 0);
				audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 1, 0, 0, 0, 0 );
			}
			else
			{
				currInputSamplingRate = AUDIO_SAMPLING_RATE_16000;
				audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_UL, 1, 1, 0, 0, 0);
				audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 1, 1, 0, 0, 0 );
			}
			
		}
        voiceInPathEnabled = TRUE;
		currVoiceMic = mic_selection;
		if (currVoiceMic == AUDDRV_MIC_PCM_IF)
			AUDDRV_SetPCMOnOff( 1 );
		else
		{
			if (currVoiceSpkr != AUDDRV_SPKR_PCM_IF) //need to check spkr too.
				AUDDRV_SetPCMOnOff( 0 );
		}
			
		break;

	default:
		break;
	}
#endif //#if defined(FUSE_APPS_PROCESSOR)
}
コード例 #3
0
void HandleAudioEventReqCb(RPC_Msg_t* pMsg, 
						 ResultDataBufHandle_t dataBufHandle, 
						 UInt32 userContextData)
{
	Log_DebugPrintf(LOGID_MISC, "HandleAudioEventRspCb msg=0x%x clientID=%d ", pMsg->msgId, 0);

#if defined(FUSE_COMMS_PROCESSOR) 

	 RPC_SendAckForRequest(dataBufHandle, 0);

	if(pMsg->msgId == MSG_AUDIO_CTRL_GENERIC_REQ)
	{
		Audio_Params_t* p = (Audio_Params_t*)pMsg->dataBuf;
		UInt32 val = audio_control_generic(p->param1,p->param2,p->param3,p->param4,p->param5,p->param6);

		SendAudioRspForRequest(pMsg, MSG_AUDIO_CTRL_GENERIC_RSP, &val);
	}
	else if(pMsg->msgId == MSG_AUDIO_CTRL_DSP_REQ)
	{
		Audio_Params_t* p = (Audio_Params_t*)pMsg->dataBuf;
		UInt32 val = audio_control_dsp(p->param1,p->param2,p->param3,p->param4,p->param5,p->param6);
		
		SendAudioRspForRequest(pMsg, MSG_AUDIO_CTRL_DSP_RSP, &val);
	}
	else
		xassert(0, pMsg->msgId);
#endif

	RPC_SYSFreeResultDataBuffer(dataBufHandle);
}
コード例 #4
0
void AUDDRV_Disable_Output ( AUDDRV_InOut_Enum_t  path )
{
#if defined(FUSE_APPS_PROCESSOR)
	switch(path) 
	{
		case AUDDRV_VOICE_OUTPUT:
				
			Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Disable_Output *\n\r" );

			if(inVoiceCall != TRUE)
			{
				if ( voiceInPathEnabled==FALSE )
				{
				//if inVoiceCall== TRUE, assume the telphony_init() function sends ENABLE and CONNECT_DL
				audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_DL, 0, 0, 0, 0, 0 );
				audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 0, 0, 0, 0, 0 );
				voicePlayOutpathEnabled = FALSE;
				Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Disable_Output: inVoiceCall = %d, voicePlayOutpathEnabled = %d\n\r", voicePlayOutpathEnabled);
				}
			}
			
			if (currVoiceSpkr == AUDDRV_SPKR_PCM_IF)  //turn off PCM i/f
			{
				currVoiceSpkr = AUDDRV_SPKR_NONE;
				if(currVoiceMic != AUDDRV_MIC_PCM_IF)
					VPRIPCMDQ_DigitalSound( FALSE );
			} //else, no need to care PCM i/f.

			currVoiceSpkr = AUDDRV_SPKR_NONE;

			break;
			
		default:
			break;
	}

	OSTASK_Sleep( 3 ); //make sure audio is done

	AUDDRV_DisableHWOutput ( path, AUDDRV_REASON_HW_CTRL );
#endif //#if defined(FUSE_APPS_PROCESSOR)	

}
コード例 #5
0
void AUDDRV_Disable_Input (  AUDDRV_InOut_Enum_t      path )
{
	switch(path) {
	case AUDDRV_VOICE_INPUT:

		Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Disable_Input *\n\r" );

		
		if(inVoiceCall != TRUE)
		{
			if ( voicePlayOutpathEnabled == FALSE )
			{
			//if inVoiceCall== TRUE, assume the telphony_init() function sends ENABLE and CONNECT_UL
			audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 0, 0, 0, 0, 0 );
			audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_UL, FALSE, 0, 0, 0, 0);
			}
			
		
		    if (currVoiceMic == AUDDRV_MIC_PCM_IF)  //turn off PCM
		    {
			    currVoiceMic = AUDDRV_MIC_NONE;
			    if (currVoiceSpkr != AUDDRV_SPKR_PCM_IF)  //turn off PCM
			    {
				    VPRIPCMDQ_DigitalSound( FALSE );
			    }
		    } //else, no need to care PCM i/f.

		    OSTASK_Sleep( 3 ); //make sure audio is done

		    currVoiceMic = AUDDRV_MIC_NONE;
        }
        voiceInPathEnabled = FALSE;
	    AUDDRV_DisableHWInput ( path, AUDDRV_REASON_HW_CTRL );

        break;

	default:
		AUDDRV_DisableHWInput ( path, AUDDRV_REASON_HW_CTRL );
		break;
	}
}
コード例 #6
0
//=============================================================================
//
// Function Name: AUDDRV_SetTelephonyMicMute
//
// Description:   UL Mute/Unmute
//
//=============================================================================
void AUDDRV_SetTelephonyMicMute(Boolean mute)
{
    if( voiceULMute != mute )
    {
        voiceULMute = mute;

        if( AUDDRV_GetVCflag() )
        {
            if ( !voiceULMute )
            {
                Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_SetTelephonyMicMute : DSP UL is unmuted \n\r");
                audio_control_dsp( DSPCMD_TYPE_UNMUTE_DSP_UL, 0, 0, 0, 0, 0 );
            }
            else
            {
                Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_SetTelephonyMicMute : DSP UL is muted \n\r");
                audio_control_dsp( DSPCMD_TYPE_MUTE_DSP_UL, 0, 0, 0, 0, 0 );
            }
        }
    }
}
コード例 #7
0
void HandleAudioEventReqCb(RPC_Msg_t *pMsg,
			   ResultDataBufHandle_t dataBufHandle,
			   UInt32 userContextData)
{
	aTrace(LOG_AUDIO_DRIVER,
			"HandleAudioEventRspCb msg=0x%x clientID=%d ",
			pMsg->msgId, 0);

#if defined(FUSE_COMMS_PROCESSOR)

	RPC_SendAckForRequest(dataBufHandle, 0);

	if (pMsg->msgId == MSG_AUDIO_CTRL_GENERIC_REQ) {
		Audio_Params_t *p = (Audio_Params_t *) pMsg->dataBuf;
		UInt32 val =
		    audio_control_generic(p->param1, p->param2, p->param3,
					  p->param4, p->param5, p->param6);

		SendAudioRspForRequest(pMsg, MSG_AUDIO_CTRL_GENERIC_RSP, &val);
	} else if (pMsg->msgId == MSG_AUDIO_CTRL_DSP_REQ) {
		Audio_Params_t *p = (Audio_Params_t *) pMsg->dataBuf;
		UInt32 val = audio_control_dsp(p->param1, p->param2, p->param3,
					       p->param4, p->param5, p->param6);

		SendAudioRspForRequest(pMsg, MSG_AUDIO_CTRL_DSP_RSP, &val);
	} else if (pMsg->msgId == MSG_AUDIO_COMP_FILTER_REQ) {
		AudioCompfilter_t *p = (AudioCompfilter_t *) pMsg->dataBuf;
		UInt32 val = audio_cmf_filter(p);

		SendAudioRspForRequest(pMsg, MSG_AUDIO_COMP_FILTER_RSP, &val);
	} else
		audio_xassert(0, pMsg->msgId);
#endif
#if defined(CONFIG_BCM_MODEM)
	RPC_SYSFreeResultDataBuffer(dataBufHandle);
#endif
}
コード例 #8
0
//Prepare DSP before turn off hardware audio path for voice call. 
// This is part of the control sequence for ending telephony audio.
void AUDDRV_Telephony_Deinit (void )
{
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Telephony_Deinit voicePlayOutpathEnabled = %d*\n\r", voicePlayOutpathEnabled);
#if defined(FUSE_APPS_PROCESSOR)&&!defined(BSP_ONLY_BUILD)	
	AUDDRV_SetVCflag(FALSE);  //let HW control logic know.

	// a quick fix not to disable voice path for speech playbck or recording when end the phone call.
	if ((voicePlayOutpathEnabled == FALSE) && (voiceInPathEnabled == FALSE))
	{
		  //per call basis: disable the DTX by calling stack api when call disconnected
		audio_control_generic( AUDDRV_CPCMD_ENABLE_DSP_DTX, FALSE, 0, 0, 0, 0 );

		audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_DL, FALSE, 0, 0, 0, 0 );
		audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_UL, FALSE, 0, 0, 0, 0 );
		audio_control_dsp( DSPCMD_TYPE_EC_NS_ON, FALSE, FALSE, 0, 0, 0 );
		audio_control_dsp( DSPCMD_TYPE_DUAL_MIC_ON, FALSE, 0, 0, 0, 0 );
		audio_control_dsp( DSPCMD_TYPE_AUDIO_TURN_UL_COMPANDEROnOff, FALSE, 0, 0, 0, 0 );
	
		//audio_control_dsp( DSPCMD_TYPE_AUDIO_ENABLE, FALSE, 0, 0, 0, 0 );
		audio_control_dsp( DSPCMD_TYPE_MUTE_DSP_UL, 0, 0, 0, 0, 0 );

		//OSTASK_Sleep( 3 ); //make sure audio is off

		AUDDRV_Telephony_DeinitHW( );
		audio_control_dsp( DSPCMD_TYPE_AUDIO_ENABLE, FALSE, 0, 0, 0, 0 );
	}

	if (AUDIO_CHNL_BLUETOOTH == AUDDRV_GetAudioMode() )
		VPRIPCMDQ_DigitalSound( FALSE );

	//at last
    voiceCallSampleRate = 8000;  //reset it to 8KHz,
	inVoiceCall = FALSE;
#endif
	return;
}
コード例 #9
0
//=============================================================================
//
// Function Name: AUDDRV_ECreset_NLPoff
//
// Description:   DSP control to turn EC ON but NLP OFF, regardless of sysparm
//
//=============================================================================
void AUDDRV_ECreset_NLPoff(Boolean ECenable)
{
    audio_control_dsp( DSPCMD_TYPE_CONTROL_ECHO_CANCELLATION, ECenable, 0, 0, 0, 0 );
}
コード例 #10
0
void AUDDRV_Telephony_RateChange( UInt32 rate )
{
        Boolean ec_enable_from_sysparm = dspECEnable;
        Boolean ns_enable_from_sysparm = dspNSEnable;

	Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_RateChange: rate = %d\n\r", rate);

#if defined(FUSE_APPS_PROCESSOR)&&!defined(BSP_ONLY_BUILD)
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Telephony_RateChange AP  *\n\r");

        if ( ec_enable_from_sysparm == TRUE )
        {
            AudioMode_t audio_mode;
            audio_mode = AUDDRV_GetAudioMode();
            audio_mode = (AudioMode_t)(audio_mode % AUDIO_MODE_NUMBER);

            Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_RateChange: reading echo_cancelling_enable from sysparm \n\r");
            ec_enable_from_sysparm = AUDIOMODE_PARM_ACCESSOR(AUDDRV_GetAudioApp(), audio_mode).echo_cancelling_enable;
        }

        if ( ns_enable_from_sysparm == TRUE )
        {
            AudioMode_t audio_mode;
            audio_mode = AUDDRV_GetAudioMode();
            audio_mode = (AudioMode_t)(audio_mode % AUDIO_MODE_NUMBER);

            Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_RateChange: noise_suppression_enable from sysparm \n\r");
            ns_enable_from_sysparm = AUDIOMODE_PARM_ACCESSOR(AUDDRV_GetAudioApp(), audio_mode).noise_suppression_enable;
        }

    voiceCallSampleRate = rate;  //remember the rate for current call. (or for the incoming call in ring state.)

	if ( AUDDRV_GetVCflag() )
	{

	audio_control_dsp( DSPCMD_TYPE_MUTE_DSP_UL, 0, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_EC_NS_ON, FALSE, FALSE, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_DUAL_MIC_ON, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_TURN_UL_COMPANDEROnOff, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_UL, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_DL, FALSE, 0, 0, 0, 0 );

	//need to know the mode!  need to set HW to 16Khz.
    if (voiceCallSampleRate == 8000)
		AUDDRV_SetAudioMode( (AudioMode_t)(AUDDRV_GetAudioMode()% AUDIO_MODE_NUMBER), AUDIO_APP_VOICE_CALL);  //NB
    else
		AUDDRV_SetAudioMode( (AudioMode_t)(AUDDRV_GetAudioMode()% AUDIO_MODE_NUMBER), AUDIO_APP_VOICE_CALL_WB);

	//AUDDRV_Enable_Output (AUDDRV_VOICE_OUTPUT, speaker, TRUE, AUDIO_SAMPLING_RATE_8000);
	audio_control_dsp( DSPCMD_TYPE_AUDIO_ENABLE, TRUE, 0, AUDDRV_IsCall16K( AUDDRV_GetAudioMode() ), 0, 0 );

	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_DL, TRUE, 0, 0, 0, 0 );

	//AUDDRV_Enable_Input ( AUDDRV_VOICE_INPUT, mic, AUDIO_SAMPLING_RATE_8000);
			
	OSTASK_Sleep( 40 );
	
	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_UL, TRUE, 0, 0, 0, 0 );
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Telephony_RateChange AP dspECEnable = %d, dspNSEnable = %d *\n\r", ec_enable_from_sysparm, ns_enable_from_sysparm);
	audio_control_dsp( DSPCMD_TYPE_EC_NS_ON, ec_enable_from_sysparm, ns_enable_from_sysparm, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_DUAL_MIC_ON, TRUE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_TURN_UL_COMPANDEROnOff, TRUE, 0, 0, 0, 0 );

	if ( !voiceULMute )
	    audio_control_dsp( DSPCMD_TYPE_UNMUTE_DSP_UL, 0, 0, 0, 0, 0 );
	}
#endif

	return;
}
コード例 #11
0
//Prepare DSP before turn on hardware audio path for voice call.
//  This is part of the control sequence for starting telephony audio.
void AUDDRV_Telephony_Init ( AUDDRV_MIC_Enum_t  mic, AUDDRV_SPKR_Enum_t speaker )
{
        Boolean ec_enable_from_sysparm = dspECEnable;
        Boolean ns_enable_from_sysparm = dspNSEnable;

	Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_Init");

        if ( ec_enable_from_sysparm == TRUE )
        {
            AudioMode_t audio_mode;
            audio_mode = AUDDRV_GetAudioMode();
            audio_mode = (AudioMode_t)(audio_mode % AUDIO_MODE_NUMBER);

            Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_Init: echo_cancelling_enable from sysparm \n\r");
            ec_enable_from_sysparm = AUDIOMODE_PARM_ACCESSOR(AUDDRV_GetAudioApp(), audio_mode).echo_cancelling_enable;
        }

        if ( ns_enable_from_sysparm == TRUE )
        {
            AudioMode_t audio_mode;
            audio_mode = AUDDRV_GetAudioMode();
            audio_mode = (AudioMode_t)(audio_mode % AUDIO_MODE_NUMBER);

            Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_Telephony_Init: noise_suppression_enable from sysparm \n\r");
            ns_enable_from_sysparm = AUDIOMODE_PARM_ACCESSOR(AUDDRV_GetAudioApp(), audio_mode).noise_suppression_enable;
        }

	currVoiceMic = mic;
	currVoiceSpkr = speaker;

#if defined(FUSE_APPS_PROCESSOR)&&!defined(BSP_ONLY_BUILD)
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Telephony_Init AP  mic %d, spkr %d *\n\r", mic, speaker);

	//control HW and flags at AP

	//at beginning
	inVoiceCall = TRUE;  //to prevent sending DSP Audio Enable when enable voice path.

	audio_control_dsp( DSPCMD_TYPE_MUTE_DSP_UL, 0, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_EC_NS_ON, FALSE, FALSE, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_DUAL_MIC_ON, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_TURN_UL_COMPANDEROnOff, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_UL, FALSE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_DL, FALSE, 0, 0, 0, 0 );

	//only check voiceCallSampleRate
    if (voiceCallSampleRate == 16000) 
    {
		AUDDRV_SetAudioMode( (AudioMode_t)(AUDDRV_GetAudioMode()% AUDIO_MODE_NUMBER), AUDIO_APP_VOICE_CALL_WB );  //WB
		AUDDRV_Telephony_InitHW ( mic, speaker, AUDIO_SAMPLING_RATE_16000 );
    }
	else
    {
		AUDDRV_SetAudioMode( (AudioMode_t)(AUDDRV_GetAudioMode()% AUDIO_MODE_NUMBER), AUDIO_APP_VOICE_CALL );  //NB
		AUDDRV_Telephony_InitHW ( mic, speaker, AUDIO_SAMPLING_RATE_8000 );
    }

	audio_control_dsp( DSPCMD_TYPE_AUDIO_ENABLE, TRUE, 0, AUDDRV_IsCall16K( AUDDRV_GetAudioMode() ), 0, 0 );
	//after AUDDRV_Telephony_InitHW to make SRST.
	AUDDRV_SetVCflag(TRUE);  //let HW control logic know.

	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_DL, TRUE, AUDDRV_IsCall16K( AUDDRV_GetAudioMode() ), 0, 0, 0 );

	OSTASK_Sleep( 40 );

	audio_control_dsp( DSPCMD_TYPE_AUDIO_CONNECT_UL, TRUE, AUDDRV_IsCall16K( AUDDRV_GetAudioMode() ), 0, 0, 0 );
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Telephony_Init dspECEnable = %d, dspNSEnable = %d *\n\r", ec_enable_from_sysparm, ns_enable_from_sysparm);
	audio_control_dsp( DSPCMD_TYPE_EC_NS_ON, ec_enable_from_sysparm, ns_enable_from_sysparm, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_DUAL_MIC_ON, TRUE, 0, 0, 0, 0 );
	audio_control_dsp( DSPCMD_TYPE_AUDIO_TURN_UL_COMPANDEROnOff, TRUE, 0, 0, 0, 0 );

	if ( !voiceULMute )
	    audio_control_dsp( DSPCMD_TYPE_UNMUTE_DSP_UL, 0, 0, 0, 0, 0 );

	  //per call basis: enable the DTX by calling stack api when call connected
	audio_control_generic( AUDDRV_CPCMD_ENABLE_DSP_DTX, TRUE, 0, 0, 0, 0 );

	if (speaker == AUDDRV_SPKR_PCM_IF)
		AUDDRV_SetPCMOnOff( 1 );
	else
	{
		if(currVoiceMic != AUDDRV_MIC_PCM_IF) //need to check mic too.
			AUDDRV_SetPCMOnOff( 0 );
	}
#endif

	return;
}
コード例 #12
0
//============================================================================
//
// Function Name: AUDIO_DRIVER_ProcessVOIPCmd
//
// Description:   This function is used to process VOIP control commands
//
//============================================================================
static Result_t AUDIO_DRIVER_ProcessVOIPCmd(AUDIO_DDRIVER_t* aud_drv,
                                          AUDIO_DRIVER_CTRL_t ctrl_cmd,
                                          void* pCtrlStruct)
{
    Result_t result_code = RESULT_ERROR;

    //Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::%d \n",ctrl_cmd );

    switch(ctrl_cmd)
    {
        case AUDIO_DRIVER_START:
            {
                if( (aud_drv->pVoipULCallback == NULL) ||
                    (aud_drv->pVoipDLCallback == NULL)
                    )
                {
                    Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::All Configuration is not set yet  \n"  );
                    return result_code;
                }
                audio_control_dsp( DSPCMD_TYPE_COMMAND_VT_AMR_START_STOP, 1, 0, 0, 0, 0 );

                audio_control_dsp( DSPCMD_TYPE_COMMAND_DSP_AUDIO_ALIGN, 1, 0, 0, 0, 0 );

                if ( VoIP_StartTelephony(VOIP_DumpUL_CB, VOIP_FillDL_CB, 0x1000, 0, 0) == 0)
                    result_code = RESULT_OK;
            }
            break;
        case AUDIO_DRIVER_STOP:
            {
                // Clear voip mode, which block audio processing for voice calls
                //audio_control_dsp( DSPCMD_TYPE_COMMAND_CLEAR_VOIPMODE, 0, 0, 0, 0, 0 ); // arg0 = 0 to clear VOIPmode
                VPRIPCMDQ_Clear_VoIPMode(0);

                VoIP_StopTelephony();
                result_code = RESULT_OK;
            }
            break;
        case AUDIO_DRIVER_SET_VOIP_UL_CB:
            {
                if(pCtrlStruct == NULL)
                {
                    Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Invalid Ptr  \n"  );
                    return result_code;
                }
                //assign the call back
                aud_drv->pVoipULCallback = (AUDIO_DRIVER_VoipCB_t)pCtrlStruct;
                result_code = RESULT_OK;
            }
            break;
        case AUDIO_DRIVER_SET_VOIP_DL_CB:
            {
                if(pCtrlStruct == NULL)
                {
                    Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Invalid Ptr  \n"  );
                    return result_code;
                }
                //assign the call back
                aud_drv->pVoipDLCallback = (AUDIO_DRIVER_VoipCB_t)pCtrlStruct;
                result_code = RESULT_OK;
            }
            break;
        default:
            Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Unsupported command  \n"  );
            break;
    }
    return result_code;
}
コード例 #13
0
void AUDDRV_Enable_Output (
				AUDDRV_InOut_Enum_t    input_path_to_mixer,
				AUDDRV_SPKR_Enum_t     mixer_speaker_selection,
				Boolean                enable_speaker,
				AUDIO_SAMPLING_RATE_t  sample_rate,
				AUDIO_CHANNEL_NUM_t    input_to_mixer
				)
{
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Enable_Output mixer %d, en %d input_path_to_mixer %d invoicecall %d, sample_rate %d *\n\r", 
          mixer_speaker_selection, enable_speaker, input_path_to_mixer, inVoiceCall, sample_rate);

#if defined(FUSE_APPS_PROCESSOR)
	AUDDRV_EnableHWOutput( input_path_to_mixer, mixer_speaker_selection, enable_speaker, sample_rate, input_to_mixer,
		AUDDRV_REASON_HW_CTRL );
	OSTASK_Sleep( 5 );  //sometimes BBC video has no audio. This delay may help the mixer filter and mixer gain loading.

	switch(input_path_to_mixer)
	{
		case AUDDRV_VOICE_OUTPUT:
			
			if(inVoiceCall != TRUE)
			{
				//if inVoiceCall== TRUE, assume the telphony_init() function sends ENABLE and CONNECT_DL
				if (sample_rate == AUDIO_SAMPLING_RATE_8000)
				{
					audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 1, 0, 0, 0, 0 );
					audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_DL, 1, 0, 0, 0, 0 );
				}
				else
				{
					audio_control_dsp(DSPCMD_TYPE_AUDIO_ENABLE, 1, 1, 0, 0, 0 );
					audio_control_dsp(DSPCMD_TYPE_AUDIO_CONNECT_DL, 1, 1, 0, 0, 0 );
				}
				voicePlayOutpathEnabled = TRUE;

				Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* AUDDRV_Enable_Output: inVoiceCall = %d, voicePlayOutpathEnabled = %d\n\r", inVoiceCall, voicePlayOutpathEnabled);
			}	
			
			currVoiceSpkr = mixer_speaker_selection;
			if(inVoiceCall != TRUE)
			{
				if (currVoiceSpkr == AUDDRV_SPKR_PCM_IF)
					AUDDRV_SetPCMOnOff( 1 );
				else
				{
					if(currVoiceMic != AUDDRV_MIC_PCM_IF) //need to check mic too.
						AUDDRV_SetPCMOnOff( 0 );
				}
				
			}
			//else, Enable_Input( ) set pcm i/f.

			break;

		case AUDDRV_AUDIO_OUTPUT:
			break;

		case AUDDRV_RINGTONE_OUTPUT:
			break;

		default:
			break;
	}
#endif  //#if defined(FUSE_APPS_PROCESSOR)	
}