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

📄 dsp3_if.c

📁 Sunplus 8202S source code.
💻 C
📖 第 1 页 / 共 2 页
字号:
 *    
 *  See also:                                                             
 *    
 **************************************************************************/
#if 0 //2004AUDDRV
/*
*  Terry,2004/2/11 04:58PM
*/
//#define VOL0_IS_NO_VOICE
//mute: cType=0 , port1=0
//vol0: cType=0 , port1=1
//BBK vol0: cType=0 , port1=1
void dsp3_if_set_vol(UINT8 cType)
{
   printf("cType:%d\n",cType);
 
   if (user_mute)  regs0->dsp24_port[1] = 0;
//nono mark it.4-8-31 10:52
#if defined(NO_DTS_OUTPUT)&&!defined(DIVIDE_AC3_DTS_SPDIF_OUTPUTS)&&!defined(EASTECH_NEW_SETUP_MENU)//4-2-12 18:36
   else if(setup_DTSCD_IsSet2SPDIF_PCMAndOff()==1)
   {
      regs0->dsp24_port[1] = 0;
      cType=0;
   } 
#endif
   else if( ( (audio_only==1)&&((adv_search_time<4)&&(adv_search_time>(-4))) )||(cType==0))
   {
      if (  (cd_subtype==CD_DTS) &&(adv_search_time)	)    regs0->dsp24_port[1]= 0;
      else 
      {
#ifdef  MP3_CD_FF1_BF1_MUTE//YX822BC//nono 20020822
        //mix YUXING822BC when forward||backwardX2,pressing SELECT,demute will be run.
        if(adv_search_time)
           regs0->dsp24_port[1] = 0;
        else
#endif

#ifdef VOL0_IS_NO_VOICE
        regs0->dsp24_port[1]=0;
#else
	regs0->dsp24_port[1]=1;
#endif	
					
       }
   }
            
   //Jeff 20020530
   if(cType!=0)  regs0->dsp24_port[1] = 0xffff;   
			
   if (bOutVol != VolTab[cType]) 
   {
        regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
        bOutVol = VolTab[cType];
#ifdef Ti3001_OSD_UI_1
        amp_setup[ADDR_M_VOL]=audio_volume;
        save_amplifier_setup(ADDR_M_VOL+ADDR_I2C_START,&audio_volume);
#endif

#ifdef VOLUME_RECODE
       {  
         int volume;			     	
#ifdef CNTR_5SPK_VOLUME
         volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&volume_5SPK[0],1);
#else
         volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&audio_volume, 1);
#endif
       }
#endif

   } else if (bOutVol==0) 
   {
     //there are two types of volume-0: one is sound-0(0x1100-0x0001), and the other one is mute(0x1100-0x0000)
     //bOutVol only record 0x1100(not include 0x0001 or 0x0000), so we force to send it
     regs0->dsp24_port[0] = 0x1100;
   }
   
#ifdef DSPADUIODBG
   printf("Source VOLUME,VolTab[cType]:%d cType:%d bOutVol:%d",VolTab[cType],cType,bOutVol);
   printf("regs0->dsp24_port[1]=%x\n", regs0->dsp24_port[1]);
#endif   
}
	

/**************************************************************************
 *  Function Name: AudioIOControl                         
 *  Purposes:                                                             
 *     Set command to DSP                          
 *  Descriptions:                                                         
 *     Set command to DSP through dsp24_port[0] and dsp24_port[1]
 *  Arguments:                                                            
 *     wCode in : Command code
 *     cType in : sub-command or parameter
 *     wParam in : optional parameter
 *  Returns:                                                              
 *     1 : success 
 *     0 : fail  
 *    -1 : not support
 *  See also:                                                             
 *    
 **************************************************************************/	
//Do DSP Audio-IO-Control
//wCode:Command code
//cType:sub-command or parameter
//wParam:optional parameter
#ifdef SUPPORT_SOUND_EFFECT
int AudioIOControl(UINT16 wCode, UINT32 cType, UINT32 wParam)
#else
int AudioIOControl(UINT16 wCode, BYTE cType, UINT16 wParam)
#endif
{
    //int i;  //terry,2004/2/10 05:08PM
    int iRes = 0;
    //UINT32 unVol=0;

#ifdef NO_AUDIO_DSP
    return 1;
#endif    
    
    //these DSP code doesn't support generic audio command
    if (coding_mode_now&(AUDIF_CODING_MODE_NES) ) {
        return 1;
    }

    #ifdef SUPPORT_MIDI_MENU_SEL // Jeff 20031104
    if (coding_mode_now&AUDIF_CODING_MODE_MIDI)
    {
        //extern BYTE bMidiPlayerBoolean;
        //if (bMidiPlayerBoolean==0) 
        extern BYTE midiState;   //dtb in 20040109
        if(midiState != 2) //MIDI_STATE_PAYLOAD
            return 1;
    }
    #endif
	
    regs0->dsp24_port[1] = wParam;
	
    switch (wCode) {
	case FLOW:
		regs0->dsp24_port[0] = 0x0200 | cType;
		
		switch (cType) {
		case AUDIOPLAY:
            #ifdef DSPADUIODBG
			printf("AUDIOPLAY ");
            #endif
			break;
		case AUDIOCONTINUE:
            #ifdef DSPADUIODBG
			printf("AUDIOCONTINUE ");
            #endif
			break;
		case AUDIOSTOP:
            #ifdef DSPADUIODBG
			printf("AUDIOSTOP ");
            #endif
			break;
		case AUDIOPAUSE:
            #ifdef DSPADUIODBG
			printf("AUDIOPAUSE ");
            #endif
			break;
		case AUDIOFLUSH:
            #ifdef DSPADUIODBG
			printf("AUDIOFLUSH ");
            #endif
			break;
			
		case AUDIOFF2X:
		case AUDIOFF4X:
		case AUDIOFF5X:		//NONO 4-2-10 22:22
		case AUDIOFF8X:
		case AUDIOFF10X:	//NONO 4-2-10 22:22
		case AUDIOFF20X:
		case AUDIOFF16X:	// Robert 2003/12/14
		case AUDIOFF30X:	//NONO 4-2-10 22:22
		case AUDIOFF32X:
		case AUDIOFF60X:	//NONO 4-2-10 22:22
		    #ifdef DSPADUIODBG
			printf("AUDIOFF\n");
			#endif
			//to check DSP mode
			if (regs0->dsp24_port[5]!=0) {
				regs0->dsp24_port[0] = 0x0200 | cType;
                #ifdef DSPADUIODBG
				printf("AUDIOFF-%d x ", cType);
                #endif
			}
			break;
			
		case AUDIOFF2PLAY:
            #ifdef DSPADUIODBG
			printf("AUDIOFF2PLAY ");
            #endif
			break;
			
		default:
			iRes = -1;
			break;
		} //end of switch (cType)
		
		break;
        case OUTMODE:
            regs0->dsp24_port[0] = 0x0300 | cType;
			
            #ifdef DSPADUIODBG
            printf("OUTMODE:%d %x", cType, regs0->dsp24_port[1]);
            #endif
            break;
        case VOLUME:            
            dsp3_if_set_vol(cType);//terry,2004/2/11 05:40PM
	    break;
        case KEY:
            regs0->dsp24_port[0] = 0x0500 | cType;
			
            #ifdef DSPADUIODBG
            printf("KEY:%d ", cType);
            #endif
            break;
        case ECHO:
            regs0->dsp24_port[0] = 0x0600 | cType;
			
            #ifdef DSPADUIODBG
            printf("ECHO:%d ", cType);
            #endif
            break;
        case SURROUND:
            regs0->dsp24_port[0] = 0x0700 | cType;
			
            #ifdef DSPADUIODBG
            printf("SURROUND:%d ", cType);
            #endif
            break;
        case SUBWOOF:
            regs0->dsp24_port[0] = 0x0800 | cType;
			
            #ifdef DSPADUIODBG
            printf("SUBWOOF:%d ", cType);
            #endif
            break;
        #ifdef TEST_BASS_MANAGEMENT 
            #ifdef TEST_BASS_COMMAND
        case BASSMANAGEMENT:        
             regs0->dsp24_port[0] = 0x2000 | cType;			                  
                #ifdef DSPADUIODBG
                printf("test: BASS_MANAGEMENT:%x\n", wParam);
                #endif
             break;   
            #endif
        #endif    
        case SPDIF:
            if (is_dts_force_spdif_bitstream() && cType==1) cType=2;
            regs0->dsp24_port[0] = 0x0900 | cType;
			
            #ifdef DSPADUIODBG
            printf("SPDIF:%d ", cType);
            #endif
            break;
        case EQ:
            regs0->dsp24_port[0] = 0x0a00 | cType;
			
            #ifdef DSPADUIODBG
            printf("EQ:%d ", cType);
            #endif
            break;
        case MIC:
            regs0->dsp24_port[0] = 0x0d00 | cType;
			
            #ifdef DSPADUIODBG
            printf("MIC:%d ", cType);
            #endif
            break;
        case AD:
        	dsp_AD_cmd(0x1200,cType);
            break;
        case AD_2:  //wangfeng 2003-09-12 17:11
        	dsp_AD_cmd(0x1700,cType);
            break;
        case SPKDELAY:
            regs0->dsp24_port[0] = 0x0c00 | cType;
			
            #ifdef DSPADUIODBG
            printf("SPKDELAY(%d):%d ms\n", cType, wParam);
            #endif
			
            break;
			
        case FSPKGAIN:
            regs0->dsp24_port[0] = 0x1300 | (VolTab[cType*2]);//nono 2003-9-3 11:54 add"*2"
			
            #ifdef DSPADUIODBG
            printf("FSPKGAIN:%d\n", cType);
            #endif
			
            break;
//wanghaoying add 2003-12-12 18:03
#if     !defined(CNTR_5SPK_VOLUME)
        case CSPKGAIN:
#ifdef YUXING_DVD
            //wangap add it when CSPKGAIN is 0/1 the volumn is wrong 2003/12/23
            if((cType+2)==257)
            regs0->dsp24_port[0] = 0x1500 | 0x02;
            else if((cType+2)==256)
            regs0->dsp24_port[0] = 0x1500 | 0x00;
            else
            regs0->dsp24_port[0] = 0x1500 | (VolTab[(cType+2)*2]);
#else
            regs0->dsp24_port[0] = 0x1500 | (VolTab[cType*2]);
#endif
            #ifdef DSPADUIODBG
            printf("CSPKGAIN:%d\n", cType);
            #endif
			
            break;
#endif

        case SSPKGAIN:
            regs0->dsp24_port[0] = 0x1400 | (VolTab[cType*2]);//nono 2003-9-3 11:54 add"*2"
			
            #ifdef DSPADUIODBG
            printf("SSPKGAIN:%d\n", cType);
            #endif
			
            break;

#ifdef CNTR_5SPK_VOLUME
        case FLSPKGAIN:
            regs0->dsp24_port[0] = 0x1A00 | (VolTab[cType]);
			
	    #ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				//printf("audio_vol=%d\n",audio_volume);
				
				//if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+1, (BYTE *)&volume_5SPK[1], 1);
			     }
	    #endif
	    			
            #ifdef DSPADUIODBG
            printf("FLSPKGAIN:%d\n", cType);
            #endif
            break;

        case FRSPKGAIN:
            regs0->dsp24_port[0] = 0x1B00 | (VolTab[cType]);
	    #ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				printf("audio_vol=%d\n",audio_volume);
			
				//if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+2, (BYTE *)&volume_5SPK[2], 1);
			     }
	    #endif		
            #ifdef DSPADUIODBG
            printf("FRSPKGAIN:%d\n", cType);
            #endif
            break;

        case SLSPKGAIN:
            regs0->dsp24_port[0] = 0x1C00 | (VolTab[cType]);
	    #ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				printf("audio_vol=%d\n",audio_volume);
			
				//if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+3, (BYTE *)&volume_5SPK[3], 1);
			     }
	    #endif	
            #ifdef DSPADUIODBG
            printf("SLSPKGAIN:%d\n", cType);
            #endif
            break;

        case SRSPKGAIN:
            regs0->dsp24_port[0] = 0x1D00 | (VolTab[cType]);
	    #ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				printf("audio_vol=%d\n",audio_volume);
			
				//if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+4, (BYTE *)&volume_5SPK[4], 1);
			     }
	    #endif	
            #ifdef DSPADUIODBG
            printf("SRSPKGAIN:%d\n", cType);
            #endif
            break;


        case CSPKGAIN:
            regs0->dsp24_port[0] = 0x1500 | (VolTab[cType]);
	    #ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				printf("audio_vol=%d\n",audio_volume);
			
				//if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+5, (BYTE *)&volume_5SPK[5], 1);
			     }
	    #endif	
            #ifdef DSPADUIODBG
            printf("CSPKGAIN:%d\n", cType);
            #endif
			
            break;

        case SWSPKGAIN: //Jeff 20031028
            regs0->dsp24_port[0] = 0x1E00 | (VolTab[cType]);

        #ifdef VOLUME_RECODE
            {  
                int volume;			     	
                printf("audio_vol=%d\n",audio_volume);
			
                //if(action_click)
                volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+6, (BYTE *)&volume_5SPK[6], 1);
            }
        #endif	

            #ifdef DSPADUIODBG
            printf("SWSPKGAIN:%d\n", cType);
            #endif

            break;

/*        case Volume_Font_ID:
        	if (user_mute) 
            {
                regs0->dsp24_port[1] = 0;
               
            }

            else if( ( (audio_only==1)&&((adv_search_time<4)&&(adv_search_time>(-4))) )||(cType==0)) //nono 20020822
            {//nono 2-4-30 0:35
                if (  (cd_subtype==CD_DTS) &&//20020725
					(adv_search_time)//>1) //|| (adv_search_time<-1) )//2-6-20 23:43
					) 
					
                { //Jeff 20020614
                    regs0->dsp24_port[1] = 0;
                } else {
#ifdef  MP3_CD_FF1_BF1_MUTE//YX822BC//nono 20020822
					//mix YUXING822BC when forward||backwardX2,pressing SELECT,demute will be run.
					if(adv_search_time)
						regs0->dsp24_port[1] = 0;
					else
#endif
						regs0->dsp24_port[1] = 1;
					
                }
            }
            
            //Jeff 20020530
            if(cType!=0)//2002-5-29 for fuss mic
				regs0->dsp24_port[1] = 0xffff;
			
            //To reduce redundant volume setting, Jeff 20020702
            //regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
            if (bOutVol != VolTab[cType]) {
				regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
				bOutVol = VolTab[cType];

#ifdef VOLUME_RECODE
			     {  
			     	int volume;			     	
				printf("audio_vol=%d\n",audio_volume);
				
				if(action_click)
				volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&audio_volume, 1);
			     }
#endif

            } else //Jeff 20020726
				if (bOutVol==0) {
                    //there are two types of volume-0: one is sound-0(0x1100-0x0001), and the other one is mute(0x1100-0x0000)
                    //bOutVol only record 0x1100(not include 0x0001 or 0x0000), so we force to send it
                    regs0->dsp24_port[0] = 0x1100;
		                   
	}
        	break;
*/        	
#endif //#ifdef CNTR_5SPK_VOLUME

#ifdef SUPPORT_PROLOGIC_II		// alan, 2003/7/11 03:28

⌨️ 快捷键说明

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