str_os_aud_out.inc
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:30k
源码类别:

DVD

开发平台:

C/C++

  1. #include "user_init.h"
  2. #include "global.h"
  3. #include "osd.h"
  4. #include "auddrv.h" //2004AUDDRV oliver 20041004 for using audio driver purpose
  5. //#include "audif.h"
  6. void
  7. str_os_aud_out(int sub_id)
  8. {
  9. #ifdef DVD_SETUP_REENG
  10. UINT16 P=0;
  11. UINT16 I=0;
  12. #endif 
  13. //we use 48K SPDIF/BITSTREAM output when play 96K voide, Jeff 20020718
  14.         AUDIF_Set_SampleRate(smp_rate_now);//2004AUDDRV audif_set_sample_rate(smp_rate_now);
  15.                 printf("setup audio out1n");
  16.         #ifndef HIMAGE_CANADA_CUS
  17.         if(sub_id==STR_OS_SIMULATE)     
  18.         {
  19.             printf("setup audio out,spdif offn");
  20.             if (isSPDIFBitstream==1) {
  21.                 isSPDIFBitstream=0;
  22.                 AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  23.             } 
  24.             else {
  25. #ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS   
  26.                 if ( (cd_type_loaded==CDDA) && (cd_subtype==CD_DTS) ) { //Jeff 20020415
  27.                     AUDIF_Set_CodingMode(AUDIF_CODING_MODE_DTSCD);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_DTSCD);
  28.                     //AudioSetPause(); //test 20021018,terry,mark it,2004/2/9 06:26PM
  29.                 }
  30. #endif
  31.                 
  32. #ifdef SDRAM_16Mb_Mode//nono 20031213
  33.                 if(coding_mode_now&(AUDIF_CODING_MODE_AC3) )
  34.                 {
  35.                     AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  36.                     AUDIF_Set_Pause();//2004AUDDRV AudioSetPause(); //test 20021018
  37.                     AUDIF_Set_Play();//2004AUDDRV AudioSetPlay(); //test 20021018
  38.                 }
  39. #endif//SDRAM_16Mb_Mode
  40.                 AUDIF_Set_SPDIF(0);//2004AUDDRV AudioSetSPDIF(0); //S-PDIF off mode command to DSP(0:off)
  41. #ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  42. #ifdef DVD_SETUP_REENG
  43.                 //recover multi-spk config JSLin 20040827
  44.                 P=setup_getItemPos(STR_OS_DOWNMIX_SETUP);
  45.                 I=P&0xff;
  46.                 P=P>>8;
  47.                 if (setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]]==STR_OS_OFF) 
  48.                 {
  49.                  P=setup_getItemPos(STR_OS_AUD_OUT);
  50.                  I=P&0xff;
  51.                  P=P>>8;
  52.                     if ( (setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_STEREO_PCM) && (AUDIF_CODING_MODE_DTSCD) )
  53.                     {
  54.                         //Force to do down-mix load when some decoders with multi-spk ability Jeff 20020415
  55.                         AUDIF_Set_OutputMode(OUT_51DownmixL0R0, 0);//2004AUDDRV AudioSetOutputMode(7, 0); //Set Output mode(7:2 channel)
  56.                     }
  57.                 } else { //Jeff 20020822
  58.                     if ( coding_mode_now&(AUDIF_CODING_MODE_DTSCD) ) 
  59.                     {
  60.                         if (setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]]==STR_OS_LTRT_SETUP) {
  61.                             AUDIF_Set_OutputMode(OUT_51DownmixLtRt, 0);//2004AUDDRV AudioSetOutputMode(0x08, 0); //Set Output mode(8:AC3 downmix Lt/Rt)
  62.                         } else if (setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]]==STR_OS_STEREO) {
  63.                             AUDIF_Set_OutputMode(OUT_51DownmixL0R0, 0);//2004AUDDRV AudioSetOutputMode(0x07, 0); //Set Output mode(7:AC3 downmix L0 R0)
  64.                         } else if (setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]]==STR_OS_VSURROUND_SETUP) {
  65.                             AUDIF_Set_OutputMode(OUT_51DownmixLsRs, 0);//2004AUDDRV AudioSetOutputMode(0x09, 0); //Set Output mode(9:2 channel, surround effect)
  66.                         }
  67.                     }
  68.                 }
  69. #else
  70.                 //recover multi-spk config Jeff 20020415
  71.                 if (SETUP_SPK_DOWNMIX==AC3DOWNMIXOFF) 
  72.                 {
  73.                     if ( (SETUP_SPDIF==SPDIFPCM) && (AUDIF_CODING_MODE_DTSCD) )
  74.                     {
  75.                         //Force to do down-mix load when some decoders with multi-spk ability Jeff 20020415
  76.                         AUDIF_Set_OutputMode(OUT_51DownmixL0R0, 0);//2004AUDDRV AudioSetOutputMode(7, 0); //Set Output mode(7:2 channel)
  77.                     }
  78.                 } else { //Jeff 20020822
  79.                     if ( coding_mode_now&(AUDIF_CODING_MODE_DTSCD) ) 
  80.                     {
  81.                         if (SETUP_SPK_DOWNMIX==DOWNMIXLTRT) {
  82.                             AUDIF_Set_OutputMode(OUT_51DownmixLtRt, 0);//2004AUDDRV AudioSetOutputMode(0x08, 0); //Set Output mode(8:AC3 downmix Lt/Rt)
  83.                         } else if (SETUP_SPK_DOWNMIX==DOWNMIXSTEREO) 
  84.                         {
  85.                             AUDIF_Set_OutputMode(OUT_51DownmixL0R0, 0);//2004AUDDRV AudioSetOutputMode(0x07, 0); //Set Output mode(7:AC3 downmix L0 R0)
  86.                         } else if (SETUP_SPK_DOWNMIX==DOWNMIXVSRND) {
  87.                             AUDIF_Set_OutputMode(OUT_51DownmixLsRs, 0);//2004AUDDRV AudioSetOutputMode(0x09, 0); //Set Output mode(9:2 channel, surround effect)
  88.                         }
  89.                     }
  90.                 }
  91.             #endif //end of DVD_SETUP_REENG    
  92. #endif//#ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  93.             }
  94. #ifdef USE_MIC_ECHO_PARAM
  95.             AUDIF_Set_EchoPara(echo_level);//2004AUDDRV AudioSetEchoPara(echo_level);
  96. #else
  97.             AUDIF_Set_Echo(echo_level, echo_level);//2004AUDDRV AudioSetEcho(echo_level, echo_level);
  98. #endif
  99.             AUDIF_Set_Key(audio_key+8);//2004AUDDRV AudioSetKey(audio_key+8);
  100. #ifdef    MIC_2CHANNEL
  101.             if(id==STR_OS_MIC_VOL_1)
  102.             {
  103.                 //mic_volume=SETUP_MIC_VOL;//wangfeng 2003-09-12 22:01
  104.                 AUDIF_Set_MICVol(mic_volume);//2004AUDDRV AudioSetMICVol(mic_volume);
  105.             }    
  106.             else if(id==STR_OS_MIC_VOL_2)
  107.             {
  108.                 //mic_volume=SETUP_MIC_VOL_2;
  109.                 AUDIF_Set_MICVol2(mic_volume);//2004AUDDRV AudioSetMICVol_2(mic_volume);
  110.             }    
  111. #else
  112.             AUDIF_Set_MICVol(mic_volume);//2004AUDDRV AudioSetMICVol(mic_volume); //Jeff 20020619
  113. #endif
  114.         } else
  115. #endif//#ifndef HIMAGE_CANADA_CUS
  116.  
  117. #ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  118.             if(sub_id==STR_OS_BITSTREAM)
  119.             {
  120.                 if ( coding_mode_now&(AUDIF_CODING_MODE_AC3
  121.                     |AUDIF_CODING_MODE_DTS
  122. #ifdef DTS_CD_OUT_RAW_A
  123. |AUDIF_CODING_MODE_DTSCD
  124. #endif                                                              
  125.                     )
  126.                     )
  127.                 {
  128.                     //audif_set_SPDIF_BITSTREAM();
  129.                     isSPDIFBitstream = 1;
  130.                     AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  131.                     AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2);
  132.                     
  133.                     
  134.                 } else {
  135. #if !defined(DTS_CD_OUT_RAW_A)//&& !defined(DIVIDE_AC3_DTS_SPDIF_OUTPUTS)
  136.                     if ( (cd_type_loaded==CDDA) && (cd_subtype==CD_DTS) ) { //Jeff 20020415
  137.                         //DTS-CD SPDIF/BITSTREAM mode, load CDDA as it is DSP decoder
  138.                         printf("DTS-CD set to BITSTREAM mode,cd_subtype:%xn",cd_subtype);
  139. #if defined(DTS_SPDIF_NO_OUTPUT)//nono 4-8-23 23:42 for eastech
  140.                         AUDIF_Set_CodingMode(AUDIF_CODING_MODE_DTSCD);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_DTSCD);
  141. #else//#if defined(DTS_SPDIF_NO_OUTPUT)                        
  142.                         AUDIF_Set_CodingMode(AUDIF_CODING_MODE_PCM);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_PCM);
  143. #endif//#if defined(DTS_SPDIF_NO_OUTPUT)
  144.                         AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2); //S-PDIF bitstream mode command to DSP(2:DTS-CD BITSTREAM mode) //Jeff 20020417                        
  145.                         AUDIF_Set_Volume(0);//2004AUDDRV AudioSetVolume(0);
  146.                         printf("DTS-CD set to BITSTREAM mode,cd_subtype:%xn",cd_subtype);
  147.                     } else
  148. #endif                    
  149.                      {
  150.                         //AudioSetSPDIF(1); //S-PDIF bitstream mode command to DSP(1:pcm)
  151.                         AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2); //ycwen : 2004/09/01 : we don't need to use AudioSetSPDIF command to distinguish CDDA and DTS-CD now!
  152.                     }
  153.                 }
  154.             
  155.             } else
  156. #endif//#ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  157. #ifdef HIMAGE_CANADA_CUS
  158.     if ( (sub_id==STR_OS_STEREO_PCM)||(sub_id==STR_OS_SIMULATE) )
  159. #else
  160.     if((sub_id==STR_OS_STEREO_PCM))    
  161. #endif
  162. {
  163. #ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  164. #ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  165.                 if ( coding_mode_now&( AUDIF_CODING_MODE_DTS
  166. #ifdef DTS_CD_OUT_RAW_A
  167.                    |AUDIF_CODING_MODE_DTSCD
  168. #endif//#ifdef DTS_CD_OUT_RAW_A                                                     
  169.                     )
  170.                 )
  171. #else//#ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  172.                 if ( (cd_type_loaded==CDDA) && (cd_subtype==CD_DTS) ) 
  173. #endif//#ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  174.                 { //Jeff 20020415
  175. #ifndef NO_DTS_OUTPUT
  176.     #ifdef DTS_CD_OUT_RAW_A
  177.         AUDIF_Set_CodingMode(AUDIF_CODING_MODE_DTSCD);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_DTSCD);
  178.     #else
  179.         if (!check_chipinfo(2))
  180.             AUDIF_Set_CodingMode(AUDIF_CODING_MODE_PCM);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_PCM);   // RAW
  181.         else
  182. AUDIF_Set_CodingMode(AUDIF_CODING_MODE_DTSCD);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_DTSCD); // PCM
  183.     #endif
  184.     #ifdef DTS_CD_OUT_RAW_A//terry,2004/1/9 09:57AM
  185.                                 AUDIF_Set_SPDIF(1);//2004AUDDRV AudioSetSPDIF(1); //S-PDIF bitstream mode command to DSP(1:pcm)
  186.     #else                            
  187.                                 AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2); //S-PDIF bitstream mode command to DSP(2:DTS-CD pcm)
  188.     #endif
  189. #else//#ifndef NO_DTS_OUTPUT
  190.                             //AudioSetSPDIF(2); //S-PDIF off mode command to DSP(0:off)
  191.                             printf("setup cddan");
  192.     #ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  193.                                 {
  194.                                     //audif_set_SPDIF_BITSTREAM();
  195.                                     isSPDIFBitstream = 1;
  196.                                     AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  197.                                     AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2);
  198.                                 }
  199.     
  200.     #else//#ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  201.         #if defined(DTS_SPDIF_NO_OUTPUT)//nono 4-8-23 23:42 for eastech
  202.                                 AUDIF_Set_CodingMode(AUDIF_CODING_MODE_DTSCD);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_DTSCD);
  203.         #else//#if defined(DTS_SPDIF_NO_OUTPUT)                        
  204.                                 AUDIF_Set_CodingMode(AUDIF_CODING_MODE_PCM);//2004AUDDRV audif_set_coding_mode(AUDIF_CODING_MODE_PCM);
  205.         #endif//#if defined(DTS_SPDIF_NO_OUTPUT)
  206.                             AUDIF_Set_SPDIF(2);//2004AUDDRV AudioSetSPDIF(2); //S-PDIF bitstream mode command to DSP(2:DTS-CD BITSTREAM mode) //Jeff 20020417
  207.                             AUDIF_Set_Volume(0);//2004AUDDRV AudioSetVolume(0);
  208.     #endif//#ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  209. #endif//NO_DTS_OUTPUT                            
  210.                             //AudioSetPause(); //test 20021018,terry,2004/2/9 06:26PM,mark it
  211.                         } 
  212.                   else 
  213. #endif//#ifndef DIVIDE_AC3_DTS_SPDIF_OUTPUTS      
  214.                   {
  215.                         #ifdef NO_DTS_OUTPUT
  216.                         isSPDIFBitstream = 1;
  217.                         AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  218.                         #endif
  219. #ifdef DVD_SETUP_REENG
  220. P=setup_getItemPos(STR_OS_DOWNMIX_SETUP);
  221. I=P&0xff;
  222. P=P>>8;
  223.                     if (coding_mode_now == AUDIF_CODING_MODE_AC3)//nono  4-5-26 21:49
  224.                         {
  225.                              exe_setup_function(setup_item[P][I][1],
  226.                                 setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]],0);//nono 2003-8-26 0:50
  227.                         }                            
  228. #else
  229.                      if (coding_mode_now == AUDIF_CODING_MODE_AC3)//nono  4-5-26 21:49
  230.                         {
  231.                              exe_setup_function(setup_item[MULTISPKPAGE][AC3DOWNMIXITEM][1],
  232.                                 setup_item[MULTISPKPAGE][AC3DOWNMIXITEM][ SETUP_SPK_DOWNMIX ],0);//nono 2003-8-26 0:50
  233.                         }                            
  234.                 #endif //end of DVD_SETUP_REENG
  235.                             
  236.                         setup_SetAC3PCMConfig();//nono 2004-8-4 11:24    
  237.                             #ifdef ONLY_SOUND_FIELD_KEY
  238.                             if (GetCurrentFileType() == CDROM_WMA)  //nono 2004-03-20 20:43
  239.                                 AUDIF_Reset_DSP();//2004AUDDRV DSPReset(); 
  240.                             #endif  //ONLY_SOUND_FIELD_KEY
  241.                             AUDIF_Set_SPDIF(1);//2004AUDDRV AudioSetSPDIF(1); //S-PDIF bitstream mode command to DSP(1:pcm)
  242.                     }
  243.             
  244.                 } else {
  245.                     //off
  246.                     if (isSPDIFBitstream==1) {
  247.                         isSPDIFBitstream=0;
  248.                         AUDIF_Reset_DSP();//2004AUDDRV DSPReset();
  249.                     } else {
  250.                         AUDIF_Set_SPDIF(0);//2004AUDDRV AudioSetSPDIF(0); //S-PDIF off mode command to DSP(0:off)
  251.                     }
  252.                 }
  253.                 set_aud_buf_size();
  254.                 if (full_scrn & SETUP)
  255.                     setup_ShowVolCtrlConfig();
  256. #ifndef SETUP_ALL_VALID        // alan, 2003/7/18 10:49