- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
UiPlayCommon.c
资源名称:SDK_M5661.rar [点击查看]
上传用户:hjhsjcl
上传日期:2020-09-25
资源大小:11378k
文件大小:67k
源码类别:
压缩解压
开发平台:
C++ Builder
- /*==========================================================================
- Copyright (c) 2004 ALi Corporation. All Rights Reserved
- File: UiPlayCommon.c
- content: common function for UiPlay & UiFileList
- History: Created by TNE 2005/6/1
- ==========================================================================*/
- #define _UI_PLAY_COM_H_
- #include <DP8051XP.H>
- #include "TypeDef.h"
- #include "Const.h"
- #include "Reg5661.h"
- #include "Common.h"
- #include "UiCommon.h"
- #include "SysStrDef.h"
- #include "UiSysStr.h"
- #include "OledString.h"
- #include "Key.h"
- #include "SaveSetting.h"
- #include "Playback.h"
- #include "NandFlash.h"
- #include "Idma.h"
- #include "UiPlay.h"
- #include "FileSystem.h"
- #include "ExtCodec.h"
- #include "IntCodec.h"
- #include "UiPlayCommon.h"
- #include "ClassDataBase.h"
- #include "UiClassList.h"
- #include "OLED.h"
- #include "IconDefine.h"
- #include "UiPlayDel.h"
- #if(USE_STEP_UP_CONVERTER)
- #include "StepUp.h"
- #endif
- #if(_PM_MENU_==1 || _PM_VD_MENU_)
- #include "UiPlayMenu.h"
- #elif(_PM_MENU_==2)
- #include "UiPlayMenu2.h"
- #endif
- #if(UI_CUSTOM_EQ_WITH_COMP) //Walace060907#4 start
- #define FADE_TARGET_DSP_GAIN gxwTargetDspGain
- #else
- #define FADE_TARGET_DSP_GAIN P0_095_dB
- #endif //Walace060907#4 start
- ////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////// Ui Header End ///////////////////////////////////
- /////Add for EQ////
- //Jeff_051116 start //tne 2006/01/16
- #if(_PM_PLAY_PRC_|(_PM_MENU_==1))
- #if(UI_USE_USER_EQ)
- #if(UI_CUSTOM_EQ_WITH_COMP)
- //Walace060510#1
- //Walace060702#1 start
- #if(UI_EQ_ALL_USE_PA_COMP)
- #define EQ_VAL_NORMAL N6dB
- #define EQ_VAL_ADPCM_NORMAL A_N07_7dB
- #else
- #define EQ_VAL_NORMAL P0dB //Walace060823#2 //Walace060907#4
- #define EQ_VAL_ADPCM_NORMAL A_P00_0dB
- #endif
- //Walace060702#1 end
- //normal -6dB
- CWORD cwEQTable[16]=
- {
- N12dB,N11_5dB, N11dB,N10dB,N9dB,N8dB,N7dB,
- N6dB,
- N5dB,N4dB,N3dB,N2dB,N1_5dB,N1dB,N0_5dB,P0dB
- };
- CBYTE cbAdpcmEQTable[8]=
- {
- //Walace060902#4 start
- /*
- A_P02_2dB,
- A_P00_0dB,
- A_N02_2dB,
- A_N05_0dB,
- A_N05_0dB,
- A_N07_7dB,
- A_N10_5dB,
- A_N14_0dB,
- */
- A_N14_0dB,
- A_N10_5dB,
- A_N07_7dB,
- A_N05_0dB,
- A_N05_0dB,
- A_N02_2dB,
- A_P00_0dB,
- A_P02_2dB
- //Walace060902#4 end
- };
- #else //#if(UI_CUSTOM_EQ_WITH_COMP)
- //normal
- //Walace060510#1 start
- #define EQ_VAL_NORMAL P0dB //Walace060823#2 //Walace060907#4
- #define EQ_VAL_ADPCM_NORMAL A_P00_0dB
- //Walace060510#1 end
- CWORD cwEQTable[16]=
- {
- N6dB,N5_5dB, N5dB,N4dB,N3dB,N2dB,N1dB,
- P0dB,
- P1dB,P2dB,P3dB,P4dB,P4_5dB,P5dB,P5_5dB,P6dB
- };
- CBYTE cbAdpcmEQTable[8]=
- {
- //Walace060902#4 start
- /*
- A_P07_7dB,
- A_P05_0dB,
- A_P02_2dB,
- A_P00_0dB,
- A_P00_0dB,
- A_N02_2dB,
- A_N05_0dB,
- A_N07_7dB
- */
- A_N07_7dB,
- A_N05_0dB,
- A_N02_2dB,
- A_P00_0dB,
- A_P00_0dB,
- A_P02_2dB,
- A_P05_0dB,
- A_P07_7dB
- //Walace060902#4 end
- };
- #endif
- #endif
- #if(UI_EQ_CUSTOM)
- #if(UI_CUSTOM_EQ_WITH_COMP) //Custom EQ with compensation --> Normal - 6dB
- CWORD cwDspVal_EQ[5][10]=
- {
- // Frequency Band
- // 1 2 3 4 5 6 7 8 9 10
- // 50 100 200 400 800 1600 3200 6400 12800 25600
- {N10dB,N10dB,N6dB,N7_5dB,N6dB,N6dB,N7dB,N7dB,N7dB,N7dB}, //POP
- {N3dB,N3dB,N4_5dB,N6_5dB,N7dB,N6dB,N4dB,N2dB,N1dB,N1dB}, //ROCK
- {N6dB,N6dB,N6dB,N6dB,N6dB,N6dB,N6dB,N10dB,N10dB,N10dB}, //CLASSIC //Walace060308#1
- {N2dB,N2dB,N5dB,N6dB,N7dB,N6dB,N2dB,P0dB,P0dB,P0dB}, //JAZZ //Walace060308#1
- {N1dB,N1dB,N1dB,N1dB,N3dB,N6dB,N9dB,N10dB,N11dB,N11dB}, //BASS
- };
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- // 1 2 3 4 (5+6)/2 (7+8)/2 (9+10)/2
- // Frequency Band 64 160 400 1000 2500 6250 15625
- //Walace060607#5 start
- CWORD cwAdpcmVal_EQ[5][10]=
- {
- {A_N10_5dB, A_N10_5dB, A_N02_2dB, A_N02_2dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB}, //POP
- {A_N02_2dB, A_N02_2dB, A_N05_0dB, A_N07_7dB, A_N07_7dB, A_N07_7dB, A_N05_0dB, A_N02_2dB, A_P00_0dB, A_P00_0dB}, //ROCK
- {A_N07_7dB, A_N07_7dB, A_N07_7dB, A_N07_7dB, A_N07_7dB, A_N10_5dB, A_N14_0dB, A_N14_0dB, A_N14_0dB, A_N14_0dB}, //CLASSIC
- {A_N05_0dB, A_N05_0dB, A_N07_7dB, A_N10_5dB, A_N10_5dB, A_N07_7dB, A_N05_0dB, A_N02_2dB, A_P00_0dB, A_P00_0dB}, //JAZZ
- {A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N05_0dB, A_N05_0dB, A_N14_0dB, A_N14_0dB, A_N14_0dB, A_N14_0dB, A_N14_0dB}, //BASS
- };
- //Walace060607#5 end
- #endif
- #else
- CWORD cwDspVal_EQ[5][10]=
- {
- // Frequency Band
- // 1 2 3 4 5 6 7 8 9 10
- // 50 100 200 400 800 1600 3200 6400 12800 25600
- {N1dB,N1dB,P3dB,P1_5dB,P3dB,P3dB,P2dB,P2dB,P2dB,P2dB}, //POP
- {P4dB,P4dB,P2_5dB,P0_5dB,P0dB,P1dB,P3dB,P5dB,P6dB,P6dB}, //ROCK
- {P0dB,P0dB,P0dB,P0dB,P0dB,P0dB,P0dB,N4dB,N4dB,N4dB}, //CLASSIC //Walace060308#1
- {P3dB,P3dB,P0dB,N1dB,N2dB,N1dB,P3dB,P5dB,P5dB,P5dB}, //JAZZ //Walace060308#1
- {P5dB,P5dB,P5dB,P5dB,P3dB,P0dB,N3dB,N4dB,N5dB,N5dB}, //BASS
- };
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- //Walace060607#5 start
- CWORD cwAdpcmVal_EQ[5][10]=
- {
- {A_N02_2dB, A_N02_2dB, A_P05_0dB, A_P05_0dB, A_P02_2dB, A_P02_2dB, A_P02_2dB, A_P02_2dB, A_P02_2dB, A_P02_2dB}, //POP
- {A_P05_0dB, A_P05_0dB, A_P02_2dB, A_P00_0dB, A_P00_0dB, A_P00_0dB, A_P02_2dB, A_P05_0dB, A_P07_7dB, A_P07_7dB}, //ROCK
- {A_P00_0dB, A_P00_0dB, A_P00_0dB, A_P00_0dB, A_P00_0dB, A_N02_2dB, A_N05_0dB, A_N07_7dB, A_N07_7dB, A_N07_7dB}, //CLASSIC
- {A_P02_2dB, A_P02_2dB, A_P00_0dB, A_N02_2dB, A_N02_2dB, A_P00_0dB, A_P02_2dB, A_P05_0dB, A_P07_7dB, A_P07_7dB}, //JAZZ
- {A_P05_0dB, A_P05_0dB, A_P05_0dB, A_P02_2dB, A_P02_2dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB}, //BASS
- };
- // 1 2 3 4 (5+6)/2 (7+8)/2 (9+10)/2
- // Frequency Band 64 160 400 1000 2500 6250 15625
- /*
- CWORD cwAdpcmVal_EQ[5][10]=
- {
- {A_N02_2dB, A_P05_0dB, A_P05_0dB, A_P02_2dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB}, //POP
- {A_P10_5dB, A_P00_0dB, A_N02_2dB, A_N02_2dB, A_P00_0dB, A_P00_0dB, A_P07_7dB, A_P07_7dB, A_P14_0dB, A_P14_0dB}, //ROCK
- {A_P02_2dB, A_P02_2dB, A_P02_2dB, A_P00_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB, A_N05_0dB}, //CLASSIC
- {A_N02_2dB, A_N02_2dB, A_P00_0dB, A_P02_2dB, A_P10_5dB, A_P10_5dB, A_P10_5dB, A_P10_5dB, A_P05_0dB, A_P05_0dB}, //JAZZ
- {A_P05_0dB, A_P02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB, A_N02_2dB}, //BASS
- };
- */
- //Walace060607#5 end
- #endif
- #endif //#if(UI_CUSTOM_EQ_WITH_COMP)
- #endif //(UI_EQ_CUSTOM)
- #if(UI_EQ_CUSTOM)
- void UiSetEqGain(WORD wEqMode) large// 050907 WHH #
- {
- WORD wDecadMode;
- BYTE bNum;
- #if(!FIVEKEY)
- XWORD gxwSwapoutMode = 0x01;
- IdmaPioDmxW(&gxwSwapoutMode,DSP_SWAP_OUT,1,DSP_W16);
- #endif
- wDecadMode = 0;
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- if((gxbMusicType&M_MAIN_TYPE)!=M_WAV)
- #endif
- { IdmaPioDmxW(&wDecadMode,DSP_DECAY_MODE_ADDR,1,DSP_W16); }
- wDecadMode=EQ_USER;
- IdmaPioDmxW(&wDecadMode,DSP_EQ_ADDR,1,DSP_W16);
- #define wEQvalTemp wDecadMode
- for(bNum = 0; bNum<10; bNum ++)
- {
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- if((gxbMusicType&M_MAIN_TYPE)==M_WAV)
- {
- if(wEqMode==EQ_NORMAL)
- {
- wEQvalTemp=EQ_VAL_ADPCM_NORMAL;
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- #if(UI_USE_USER_EQ)
- else if(wEqMode==EQ_USER)
- {
- /* //Walace060607#5 start
- if(gxbUserDefEq[bNum>>1]==0x0F)
- wEQvalTemp=0x0F;
- else if(gxbUserDefEq[bNum>>1]==0x00)
- wEQvalTemp=0x03;
- else if(gxbUserDefEq[bNum>>1]<=0x07)
- wEQvalTemp=gxbUserDefEq[bNum>>1]+2;
- else
- wEQvalTemp=gxbUserDefEq[bNum>>1]-1;
- */
- wEQvalTemp=(WORD)cbAdpcmEQTable[(gxbUserDefEq[bNum>>1]>>1)];
- //Walace060607#5 end
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- #endif
- else
- {
- IdmaPioDmxW(&cwAdpcmVal_EQ[wEqMode-1][bNum],DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- }
- else
- #endif
- {
- if(wEqMode==EQ_NORMAL)
- {
- wEQvalTemp=EQ_VAL_NORMAL;
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- #if(UI_USE_USER_EQ)
- else if(wEqMode==EQ_USER)
- {
- wEQvalTemp=cwEQTable[gxbUserDefEq[bNum>>1]];
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- #endif
- else
- {
- IdmaPioDmxW(&cwDspVal_EQ[wEqMode-1][bNum],DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- }
- }
- #if(UI_CUSTOM_EQ_WITH_COMP) //Walace060402#1 start //Walace060406#1
- wEQvalTemp=gxwEqMode;
- gxwEqMode=wEqMode;
- CdcSetPaGain(gxbVolume); //tne 2006/12/26 #1
- gxwEqMode=wEQvalTemp;
- #endif
- #undef wEQvalTemp
- }
- #else
- void UiSetEqGain(WORD wEqMode) large// 050907 WHH #
- {
- WORD wDecadMode;
- BYTE bNum;
- #if(UI_CUSTOM_EQ_WITH_COMP) //Walace060406#1
- WORD wEQvalTemp;
- #endif
- #if(!FIVEKEY)
- XWORD gxwSwapoutMode = 0x01;
- IdmaPioDmxW(&gxwSwapoutMode,DSP_SWAP_OUT,1,DSP_W16);
- #endif
- wDecadMode = 0; // EQ undecad, set 1 to enable decademode if required.
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- if((gxbMusicType&M_MAIN_TYPE)!=M_WAV)
- #endif
- { IdmaPioDmxW(&wDecadMode,DSP_DECAY_MODE_ADDR,1,DSP_W16); }
- IdmaPioDmxW(&wEqMode,DSP_EQ_ADDR,1,DSP_W16);
- #if(UI_CUSTOM_EQ_WITH_COMP) //Walace060406#1
- wEQvalTemp=gxwEqMode;
- gxwEqMode=wEqMode;
- CdcSetPaGain(gxbVolume); //tne 2006/12/26 #1
- gxwEqMode=wEQvalTemp;
- #endif
- #if(UI_USE_USER_EQ)
- if(wEqMode!=EQ_USER)
- #endif
- return;
- //Walace060127#2 end
- #if(UI_USE_USER_EQ)
- #define wEQvalTemp wDecadMode
- #if(_PM_DVR_|PLAY_SUPPORT_WAV) //Nick060629#1
- if((gxbMusicType&M_MAIN_TYPE)==M_WAV)
- {
- #if(UI_USE_USER_EQ)
- for(bNum = 0; bNum<10; bNum ++)
- {
- //Walace060607#5 start
- /*
- if(gxbUserDefEq[bNum>>1]==0x0F)
- wEQvalTemp=0x0F;
- else if(gxbUserDefEq[bNum>>1]==0x00)
- wEQvalTemp=0x03;
- else if(gxbUserDefEq[bNum>>1]<=0x07)
- wEQvalTemp=gxbUserDefEq[bNum>>1]+2;
- else
- wEQvalTemp=gxbUserDefEq[bNum>>1]-1;
- */
- wEQvalTemp=(WORD)cbAdpcmEQTable[(gxbUserDefEq[bNum>>1]>>1)];
- //Walace060607#5 start
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- #endif
- }
- else
- #endif
- {
- for(bNum = 0; bNum<10; bNum ++)
- {
- wEQvalTemp=cwEQTable[gxbUserDefEq[bNum>>1]];
- IdmaPioDmxW(&wEQvalTemp,DSP_USER_EQ_LV1_ADDR+(bNum),1,DSP_W16);
- }
- }
- #undef wEQvalTemp
- #endif //#if(UI_EQ_CUSTOM|UI_USE_USER_EQ)
- }
- #endif //#if(UI_EQ_CUSTOM)
- #endif //#if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_))
- /////////////////////
- // Jeff_051116 end
- /////////////////////
- //Walace060926#1 VideoResume
- #if(!(_PM_PLAY_DEL_ |_PM_DIR_DEL_|_PM_VD_PLAY_))
- void UiRndPlayInit(void) large
- {
- gxbRndOffset=(BYTE)gxdwNowTime;
- if(gxwCurrentFileNum<=gxbRndOffset)
- { gxwRndSeed=gxwCurrentFileNum+1023-gxbRndOffset; }
- else
- { gxwRndSeed=gxwCurrentFileNum-gxbRndOffset; }
- //gxwRndSeed=1;
- gxwRndListIndex=0;
- }
- #endif
- #if(_PM_PLAY_PRC_|_PM_VD_PLAY_) //(_PM_VIDEO_&!_PM_VD_MENU_)) // Jeff070125 #5
- // to get a random play list num
- // If fGetNext==TRUE , get the next song number
- // If fGetNext==FALSE, get the prev song number
- WORD UiGetRndPlayNum(bit fGetNext) large
- {
- WORD wCurrentNum;
- while(1)
- {
- //to get 1024 random number, bit0 xor bit3 , and then put it to bit 10, right shift 1 bit
- if(fGetNext)
- { gxwRndSeed=(gxwRndSeed|(((gxwRndSeed^(gxwRndSeed>>3))&0x01)<<10))>>1; }
- //{ gxwRndSeed=(gxwRndSeed|(((gxwRndSeed&0x01)^((gxwRndSeed&0x08)>>3))<<10))>>1; }
- else
- {
- gxwRndSeed=gxwRndSeed<<1;
- gxwRndSeed=gxwRndSeed|((gxwRndSeed>>10)^(gxwRndSeed>>3)&0x01);
- //gxwRndSeed=gxwRndSeed|(((gxwRndSeed&0x400)>>10)^((gxwRndSeed&0x08)>>3));
- gxwRndSeed=gxwRndSeed&0x3FF;
- }
- wCurrentNum=gxwRndSeed+gxbRndOffset;
- if(wCurrentNum>=1024) wCurrentNum-=1023;
- if(wCurrentNum<=gxwNumTotalFiles)
- return wCurrentNum;
- }
- }
- #endif
- #if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- void UiGoIntroMode(void) large
- {
- gfIntroPlaying=INTRO_PLAY;
- gxdwLastFileSize=0; //cancel resume
- #if(!_PM_SLS_)
- UiShowIntroString();
- #endif
- gxwCurrentPlayTime=0;
- //gxdwCurrentLrcTime=0; //tne 2006/02/10 #1 //Walace060226#remove
- gfFirstResume=FALSE; //tne 2006/01/14 #2
- }
- #endif
- #if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- void UiCancelIntroMode(void) large
- {
- gfIntroPlaying=INTRO_NOP;
- gxbIntroMode=0;
- gxdwLastFileSec=0; //cancel resume function
- }
- #endif
- //Walace060531#1 PlayProcess
- /* //tne 2007/01/15 #1 move to UiCommon.c
- #if(UI_USE_ALARM_DISPLAY &!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- extern XBYTE fUiTagHidden;
- #if(!_PM_SLS_) //Walace060830#3
- API void UiShowWakeUp(void) large
- */
- //tne 2007/01/06 #1 start
- #if(_PM_MENU_|_PM_VD_MENU_)
- void UiDrawBasicMusicMenu(void) large
- {
- UiShowLargeBackground(5,IM_BROWSER_BG_03_S1); //tne 2007/01/10 #2
- StrShowSysString(SYS_STR_MENU, LCD_AUTO_CENTER_COL,ITEM_START_ROW-ITEM_ROW_OFF);
- UiShowNormalTitleInfo();
- }
- #endif
- #if(_PM_MENU_|_PM_VD_MENU_)
- void UiShowMusicMenuText(void) large
- {
- BYTE bI,bJ;
- UiClearAllMenuItem();
- if(gxbUiMenuMainStates==MUSIC_MENU_MAIN_START_NUM)
- {
- bI=0;
- }
- else
- {
- bI=1;
- gfTransparent=TRUE;
- UI_SHOW_MENU_TITLE_ITEM_STRING(cbMenuTitleStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]);
- gfTransparent=FALSE;
- }
- #if(_PM_PLAY_)
- PeFillDspBuf();
- #endif
- switch(gxbUiMenuMainStates)
- {
- #if(_PM_PLAY_ && UI_PLAY_USER_EQ_EDIT)
- case UI_USER_EQ_MENU:
- UiDrawUserDefEq();
- break;
- #endif
- /* //remove by tne 2007/01/06 #1
- case UI_SLIDE_SHOW: //Walace060220#1 use
- UiDrawSlideShow();
- break;
- case UI_INTRO_MENU:
- UiDrawIntro();
- break;
- */
- default:
- //tne 2007/01/06 #1 start
- #define TOTAL_MENU_ITEM_NUM (cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM])
- #define TOTAL_DISP_ITEM_NUM (ITEM_NUM_OPAGE-bI)
- if(TOTAL_MENU_ITEM_NUM>=TOTAL_DISP_ITEM_NUM)
- {
- if((gxbUiMenuSubStates+TOTAL_DISP_ITEM_NUM)>TOTAL_MENU_ITEM_NUM) //Last page
- gxbMenuDispLine=TOTAL_DISP_ITEM_NUM-(TOTAL_MENU_ITEM_NUM-gxbUiMenuSubStates);
- else
- gxbMenuDispLine=0;
- }
- else
- {
- gxbMenuDispLine=gxbUiMenuSubStates;
- }
- for(bJ=0;( (bJ<TOTAL_DISP_ITEM_NUM) && (bJ<TOTAL_MENU_ITEM_NUM) );bJ++)
- {
- #if(_PM_PLAY_)
- PeFillDspBuf();
- #endif
- UiShowMenuItem( bJ,
- IM_EXPLORE_BUTTON_CLEAR_STRING,
- IM_ITEM_UNSELECT,
- pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates-gxbMenuDispLine+bJ]);
- }
- UiShowMenuItem(gxbMenuDispLine,IM_EXPLORE_BUTTON_01,IM_ITEM_SELECT,pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates]);
- #if(_PM_PLAY_)
- PeFillDspBuf();
- #endif
- #undef TOTAL_DISP_ITEM_NUM
- #undef TOTAL_MENU_ITEM_NUM
- //tne 2007/01/06 #1 end
- break;
- }
- }
- #endif
- #if(_PM_MENU_)
- void UiDrawUDefEqSel(void)
- {
- UiClearUDefEqSel();
- gxbSelUserDefEq=gxbUiMenuSubStates;
- UiShowUDefEqSel();
- }
- #endif
- /* //remove by tne 2007/01/06 #1
- void UiDrawSlideShow(void)
- {
- OledClearArea((OLED_MAX_COL-16)/2,ITEM_START_ROW+ITEM_ROW_OFF+PAGE1,16,PAGE1);
- OledShowNumber(gxbUiMenuSubStates,(OLED_MAX_COL-16)/2,ITEM_START_ROW+ITEM_ROW_OFF+PAGE1,2);
- #if(UI_USE_PROGRESS_BAR)
- ShowProgress((OLED_MAX_COL-PROGRESS_MAX)/2,(ITEM_START_ROW+ITEM_ROW_OFF*2),(((WORD)gxbUiMenuSubStates*PROGRESS_MAX)/(MENU_SLIDE_SHOW_ITEM_NUM-1)));
- #endif
- }
- */
- #if(_PM_MENU_|_PM_VD_MENU_)
- void UiNextMenuItem(void) large
- {
- BYTE bI;
- #if(_PM_MENU_)
- PeFillDspBuf(); //Larry070310#4
- #endif
- switch(gxbUiMenuMainStates)
- {
- #if(_PM_PLAY_ && UI_PLAY_USER_EQ_EDIT)
- case UI_USER_EQ_MENU:
- if(gfUserEqStartEdit)
- {
- if(gxbSelUserDefEq==5)
- UiEditUdefEq(UI_EDIT_ALL_EQ_UP);
- else
- UiEditUdefEq(UI_EDIT_EQ_UP);
- }
- else
- {
- if( gxbUiMenuSubStates>=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1) ) //over max
- gxbUiMenuSubStates=0;
- else
- gxbUiMenuSubStates++;
- UiDrawUDefEqSel();
- }
- break;
- #endif
- /* //remove by tne 2007/01/06 #1
- case UI_SLIDE_SHOW:
- if( gxbUiMenuSubStates>=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1) ) //over max
- gxbUiMenuSubStates=0;
- else
- gxbUiMenuSubStates++;
- UiDrawSlideShow();
- break;
- */
- default:
- UiShowMenuItem( gxbMenuDispLine,
- IM_EXPLORE_BUTTON_CLEAR_STRING,
- IM_ITEM_UNSELECT,
- pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates]);
- if(gxbUiMenuMainStates==MUSIC_MENU_MAIN_START_NUM)
- bI=0;
- else
- bI=1;
- if( gxbUiMenuSubStates>=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1) ) //over max
- {
- gxbUiMenuSubStates=0;
- if(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]>(ITEM_NUM_OPAGE-bI)) //not only 1 page
- {
- UiShowMusicMenuText();
- break;
- }
- else
- gxbMenuDispLine=0;
- }
- else
- {
- gxbUiMenuSubStates++;
- if(gxbMenuDispLine>=(ITEM_NUM_OPAGE-bI-1))
- {
- UiMoveOneLine( ITEM_SEL_START_COL,
- ITEM_START_ROW+ITEM_ROW_OFF*bI,
- ITEM_COL_WIDTH,
- ITEM_NUM_OPAGE-bI-1,
- UI_FILE_LIST_UP);
- }
- else
- { gxbMenuDispLine++; }
- }
- UiShowMenuItem( gxbMenuDispLine,
- IM_EXPLORE_BUTTON_01,
- IM_ITEM_SELECT,
- pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates]);
- }
- #if(_PM_MENU_==1)
- UiSelectItemControl();
- #endif
- }
- void UiPrevMenuItem(void) large
- {
- BYTE bI;
- #if(_PM_MENU_)
- PeFillDspBuf(); // Larry070310#4
- #endif
- switch(gxbUiMenuMainStates)
- {
- #if(_PM_PLAY_ && UI_PLAY_USER_EQ_EDIT)
- case UI_USER_EQ_MENU:
- if(gfUserEqStartEdit)
- {
- if(gxbSelUserDefEq==5)
- UiEditUdefEq(UI_EDIT_ALL_EQ_DOWN);
- else
- UiEditUdefEq(UI_EDIT_EQ_DOWN);
- }
- else
- {
- if(gxbUiMenuSubStates==0)
- gxbUiMenuSubStates=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1);
- else
- gxbUiMenuSubStates--;
- UiDrawUDefEqSel();
- }
- break;
- #endif
- /* //remove by tne 2007/01/06 #1
- case UI_SLIDE_SHOW:
- if(gxbUiMenuSubStates==0)
- gxbUiMenuSubStates=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1);
- else
- gxbUiMenuSubStates--;
- UiDrawSlideShow();
- break;
- */
- default:
- UiShowMenuItem( gxbMenuDispLine,
- IM_EXPLORE_BUTTON_CLEAR_STRING,
- IM_ITEM_UNSELECT,
- pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates]);
- if(gxbUiMenuMainStates==MUSIC_MENU_MAIN_START_NUM)
- bI=0;
- else
- bI=1;
- if(gxbUiMenuSubStates==0)
- {
- gxbUiMenuSubStates=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1);
- if(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]>(ITEM_NUM_OPAGE-bI)) //not only 1 page
- {
- UiShowMusicMenuText();
- break;
- }
- else
- gxbMenuDispLine=(cbMenuMaxItemNum[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM]-1);
- }
- else
- {
- gxbUiMenuSubStates--;
- if(gxbMenuDispLine==0)
- {
- UiMoveOneLine( ITEM_SEL_START_COL,
- ITEM_START_ROW+ITEM_ROW_OFF*bI,
- ITEM_COL_WIDTH,
- ITEM_NUM_OPAGE-bI-1,
- UI_FILE_LIST_DOWN);
- }
- else
- { gxbMenuDispLine--; }
- }
- UiShowMenuItem( gxbMenuDispLine,
- IM_EXPLORE_BUTTON_01,
- IM_ITEM_SELECT,
- pcbMenuListStr[gxbUiMenuMainStates-MUSIC_MENU_MAIN_START_NUM][gxbUiMenuSubStates]);
- }
- #if(_PM_MENU_==1)
- UiSelectItemControl();
- #endif
- }
- #endif
- //tne 2007/01/06 #1
- #if(USE_LYRIC_DISPLAY &!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- extern XBYTE fUiTagHidden;
- void UiPlayLyricControl(void)
- {
- #if(UI_LYRIC_TYPE_CENTER)
- if((gxbMusicType&M_LYRICS_FLAG)&&((gxbSysState==S_PE_PLAY)||(gxbSysState==S_PE_PAUSE)))
- #else
- if(gxbMusicType&M_LYRICS_FLAG) // Lyrics Exist
- #endif
- #if(_PM_MENU_|_PM_FLIST_|_PM_CLIST_|_PM_SLS_)
- {
- if( (gxbLrcState==LRC_STS_FORCE_DISP_STR)||(gxbLrcState==LRC_STS_DISP_STR) )
- {
- //tne 2005/08/11
- UiKeepLastLyric();
- LcdSetLyricDone();
- }
- }
- #else
- {
- //tne 2005/08/11
- if( ((gxbLrcState==LRC_STS_FORCE_DISP_STR)||(gxbLrcState==LRC_STS_DISP_STR)) && (fUiTagHidden) )// show menu, skip this lyric
- {
- UiKeepLastLyric();
- LcdSetLyricDone();
- }
- else if(gxbLrcState==LRC_STS_FORCE_DISP_STR) // scroll lyric speed up
- {
- if(gxbLcdLyricStatus==LCD_LYRIC_SCROLL_DONE) //tne lcd scroll2
- LcdShowLyrics();
- else
- LcdScrollLyric();
- }
- }
- #endif
- }
- #endif
- /* //Walace060911#1 Remove to UiCommon.c
- #if(!(_PM_CLIST_|_PM_VD_MENU_))
- WORD UiGetFileNumInDir(struct FILE_INF_DATA xdata *stOldFileInf,struct FILE_INF_DATA xdata *stNewFileInf) large
- {
- #define dwOldFileDirSec stOldFileInf->dwDirSec[stOldFileInf->bPathDepth]
- #define dwNewFileDirSec stNewFileInf->dwDirSec[stNewFileInf->bPathDepth]
- #define wOldFileDirOffset stOldFileInf->wDirOffset[stOldFileInf->bPathDepth]
- #define wNewFileDirOffset stNewFileInf->wDirOffset[stNewFileInf->bPathDepth]
- WORD wFileNum;
- if(!FsOpenFile(FIRST_PLAYBACK_IN_DIR))
- { return 0; }
- wFileNum=1;
- //while(stUiFileListData.dwFileStartClu!=stFsFileInf.dwFileStartClu)
- while( (dwOldFileDirSec!=dwNewFileDirSec) || (wOldFileDirOffset!=wNewFileDirOffset) )
- {
- if(FsOpenFile(NEXT_PLAYBACK_IN_DIR))
- wFileNum++;
- else
- return 0; //not found file.. bug??
- }
- return wFileNum;
- #undef dwOldFileDirSec
- #undef dwNewFileDirSec
- #undef wOldFileDirOffset
- #undef wNewFileDirOffset
- }
- //jump playback file from stOldFileInf->stNewFileInf
- //Please set gxbFileNumSearchMode before calling the function
- //After calling the function, stOldFileInf would equal stNewFileInf
- //and one of the struct must be stUiFileListData (In UiGetFileListNum function)
- void UiCountCurtFileNum(struct FILE_INF_DATA xdata *stOldFileInf,struct FILE_INF_DATA xdata *stNewFileInf) large
- {
- BOOL fRet;//,fTheSameDir; // Walace051026 #3
- #if(!_PM_PLAY_DEL_) //It always speed up in play-del-module
- //SetSysSpeed(0x02);
- #endif
- gpstFileIndex=stOldFileInf;
- // Walace051026 #3
- //fTheSameDir=(stOldFileInf->dwDirStartSec==stNewFileInf->dwDirStartSec);
- if(gxbFileNumSearchMode==FNUM_SEARCH_RESET_MODE)
- {
- FsOpenFile(FIRST_PLAYBACK);
- gxwCurtFileInAll=1;
- gxwCurtFileInDir=1;
- }
- while(1)
- {
- if(stOldFileInf->dwDirStartSec==stNewFileInf->dwDirStartSec) //the same dir
- {
- //if(stOldFileInf->dwFileStartClu==stNewFileInf->dwFileStartClu) //the same file
- if( (stOldFileInf->dwDirSec[stOldFileInf->bPathDepth]==stNewFileInf->dwDirSec[stNewFileInf->bPathDepth]) &&
- (stOldFileInf->wDirOffset[stOldFileInf->bPathDepth]==stNewFileInf->wDirOffset[stNewFileInf->bPathDepth]) )
- break;
- //if((gxbFileNumSearchMode==FNUM_SEARCH_RESET_MODE) || (gxbFileNumSearchMode==FNUM_SEARCH_NEXT_MODE))
- if(gxbFileNumSearchMode<=FNUM_SEARCH_NEXT_MODE)
- gxwCurtFileInDir++;
- else
- gxwCurtFileInDir--;
- }
- //if((gxbFileNumSearchMode==FNUM_SEARCH_RESET_MODE) || (gxbFileNumSearchMode==FNUM_SEARCH_NEXT_MODE))
- if(gxbFileNumSearchMode<=FNUM_SEARCH_NEXT_MODE)
- {
- fRet=FsOpenFile(NEXT_PLAYBACK);
- gxwCurtFileInAll++;
- }
- else
- {
- fRet=FsOpenFile(PREV_PLAYBACK);
- gxwCurtFileInAll--;
- }
- if(!fRet) //if faile, it is a bug??
- { break; }
- }
- // Walace051026 #3
- //if(!fTheSameDir) //not the same dir, re-count file num in dir
- {
- UiGetFileListNum();
- gxwCurtFileInDir=UiGetFileNumInDir(stOldFileInf,stNewFileInf);
- FsOpenFile(RELOAD_FILE_NAME);
- }
- gxwFileNumInFileList=gxwTotalDirInDir+gxwCurtFileInDir;
- if(gfPlayAutoSearchFile)
- {
- gxwCurrentFileNum=gxwCurtFileInAll;
- gxwNumTotalFiles=gxwTotalFileInAll;
- // Walace051026 #3
- }
- else
- {
- gxwCurrentFileNum=gxwCurtFileInDir;
- gxwNumTotalFiles=gxwTotalFileInDir;
- }
- #if(!_PM_PLAY_DEL_)
- //SetSysSpeed(0x08);
- #endif
- }
- #endif
- */
- //tne 2005/08/10
- //You should let stUiFileListData==stFsFileInf and load ext code before calling this function
- #if(_PM_PLAY_PRC_&UI_DISP_DIR_NAME)
- void UiGetCurtDirName(void) large
- {
- BYTE bI;
- gpstFileIndex=&stUiFileListData;
- if(gpstFileIndex->bPathDepth>0)
- {
- FsChangeDir(RESTORE_DIR);
- FsOpenFile(RELOAD_DIR_NAME); //Load dir name
- if(gxbLongFileName[1]==0) //only short file name
- {
- gxbDispDirNameBuf[0]=STRING_TYPE_ASCII;
- gxbDispDirNameBuf[1]=11; //tne 2006/05/05 #1
- for(bI=0;bI<11;bI++)
- gxbDispDirNameBuf[bI+2]=gxbFileName[bI];
- }
- else
- {
- for(bI=0;bI<16;bI++)
- gxbDispDirNameBuf[bI]=gxbLongFileName[bI];
- if(gxbDispDirNameBuf[1]>14)
- gxbDispDirNameBuf[1]=14;
- }
- stUiFileListData=stFsFileInf;
- FsOpenFile(RELOAD_FILE_NAME);
- }
- else //root
- { gxbDispDirNameBuf[1]=0; } //set 0 for display root
- }
- #endif
- //tne 2005/08/11
- #if((_PM_SLS_|(_PM_PLAY_&!_PM_PLAY_PRC_))&USE_LYRIC_DISPLAY)
- void UiKeepLastLyric(void) large
- {
- BYTE bI;
- if(gxbLrcString[1]>OLED_MAX_SEGS)
- {
- if(gxbLrcString[1]>=gcbLryicStrLen)
- {
- if(!LcdChkCjkCutWord(gxbLrcString+2,gcbLryicStrLen))
- gxbLrcString[gcbLryicStrLen+1]=' ';
- }
- gxbLastLyrcBuf[1]=OLED_MAX_SEGS;
- for(bI=2;bI<OLED_MAX_SEGS+2;bI++)
- gxbLastLyrcBuf[bI]=gxbLrcString[bI+(gxbLrcString[1]-OLED_MAX_SEGS)];
- //tne 2006/02/24
- if(!LcdChkCjkCutWord(gxbLrcString+2,gxbLrcString[1]-OLED_MAX_SEGS))
- gxbLastLyrcBuf[2]=' ';
- }
- else
- {
- for(bI=1;bI<=(gxbLrcString[1]+1);bI++)
- gxbLastLyrcBuf[bI]=gxbLrcString[bI];
- }
- }
- #endif
- #if((_PM_PLAY_&!_PM_PLAY_PRC_)|_PM_SLS_)
- void UiPlayGetResumeTime(void) large
- {
- //tne 2005/08/19
- if((gxbSysState!=S_PE_STOP) && (gxbSysState!=S_PE_WAIT) )
- { //vicky070319#3
- if(gxbMusicProcState==MUSIC_PROC_BODY)
- {
- gxdwLastFileSec = gdwFileSector - (PeReptAdjust()>>8); //Vicky051128#2
- gxdwLastFileSize = gpstFileIndex->dwFileTotalSector;
- IdmaPioDmxR(DSP_FRAME_ADDR,&gxdwLastFrameNum,2,DSP_W16); //Get frame number
- }
- }
- }
- #endif
- // Walace050927 for bug00055
- #if((_PM_PLAY_|_PM_SLS_)&(FADE_IN_OUT_MODE==0))
- void UiSetVolFadeOut(void) large
- {
- CdcSetPaGain(FADEOUT_VOL); // Walace051005 //tne 2006/12/26 #1
- if(gxbLastErrCode==ERR_NO_ERROR) // no scroll if error happend
- {
- while(gdwFileSector<=(gpstFileIndex->dwFileTotalSector))
- {
- PlayEngine(P_NOP);
- UiDispCtrl(UI_SCROLL_DISPLAY); // Scrolling
- #if(!EXT_ADC | !EXT_DAC | !EXT_PA)
- if(gxbTargetVolume==gxbLastVolume)
- return;
- else
- //IntCdcSetPaGainTask(FALSE);
- CdcSetPaGainTask(PA_TASK_UNIMMEDIATE|PA_TASK_DELAY); //Walace060525#4 //tne 2006/12/26 #1
- #endif
- }
- }
- }
- #endif
- //vicky050528
- #if(_PM_PLAY_MAIN_) //Walace060210
- #if(!USE_NEW_FF_PLAY) //vicky061001#1
- BYTE CalFramNum(void) large //vicky050602#3 Stereo DEC
- {
- XBYTE bval;
- //Vicky051028#3
- //bval=(WORD)10 *512*2/(gxwPacketSize*2);
- bval=5120/gxwPacketSize;
- if(!(gxbMusicFeature&MF_STEREO)) //Vicky051028#3
- bval>>=1;
- /*
- switch(gxwSampleRate)
- {
- case 8000:
- bval=4;
- break;
- case 11025:
- bval=5;
- break;
- case 16000:
- bval=8;
- break;
- case 22050:
- bval=11;
- break;
- case 32000:
- bval=16;
- break;
- case 44100:
- bval=22;
- break;
- default:
- bval=5;
- break;
- }
- if(gfStereo)
- bval<<=1;
- */
- return bval;
- }
- #endif //End
- #endif
- #if(_PM_PLAY_PRC_&!_PM_DVR_& UI_USE_CLASS_LIST)
- void UiCdbSearchData(BYTE bSearchType) large
- {
- BYTE bI,bJ,bCommand;
- WORD wTotalMusicInClass;
- wTotalMusicInClass=gxwTotalFileInClass;
- if(gxbPlayClassMode!=P_CLASS_MODE_TITLE)
- {
- if( (bSearchType==CDB_SEARCH_FIRST_TITLE) || (bSearchType==CDB_SEARCH_LAST_TITLE) )
- {
- if(bSearchType==CDB_SEARCH_FIRST_TITLE)
- bCommand=CDB_SEARCH_ENTER;
- else //if(bSearchType==CDB_SEARCH_LAST_TITLE)
- bCommand=CDB_SEARCH_ENTER_LAST;
- if( (!gfPlayAutoSearchFile) || (gxbPlayClassMode==P_CLASS_MODE_ALBUM) )
- { bJ=1; } //Dir repeat or Album First would jump 1 level in database
- else
- {
- if(gxbPlayClassMode==P_CLASS_MODE_GENRE)
- bJ=3; //Genre First would jump 3 level in database
- else //gxbPlayClassMode==P_CLASS_MODE_ARTIST
- bJ=2; //Artist First would jump 2 level in database
- }
- for(bI=0;bI<bJ;bI++)
- CdbSearchData(CDB_SEARCH_BACK);
- for(bI=0;bI<bJ;bI++)
- {
- wTotalMusicInClass=stCdbClassInfo_wTotalChild;
- CdbSearchData(bCommand);
- }
- goto FINISH_SEARCH;
- }
- else if( (gfPlayAutoSearchFile) && (gxbPlayClassMode!=P_CLASS_MODE_ALBUM) )
- {
- #define dwCdbWhichPoint (*(DWORD *)((&*(DWORD *)(&stCdbClassInfo)) + ((bSearchType&CDB_SEARCH_WAY)>>4)))
- //if( (bSearchType==CDB_SEARCH_NEXT) && (stCdbClassInfo.dwNextPoint==CDB_NULL_POINT) ) ||
- // (bSearchType==CDB_SEARCH_PREV) && (stCdbClassInfo.dwPrePoint==CDB_NULL_POINT) )
- if(dwCdbWhichPoint==CDB_NULL_POINT)
- {
- if(bSearchType==CDB_SEARCH_NEXT)
- bCommand=CDB_SEARCH_ENTER;
- else //if(bSearchType==CDB_SEARCH_PREV)
- bCommand=CDB_SEARCH_ENTER_LAST;
- CdbSearchData(CDB_SEARCH_BACK); //Album level
- if(dwCdbWhichPoint==CDB_NULL_POINT) //&&(gxbPlayClassMode==P_CLASS_MODE_GENRE)
- {
- CdbSearchData(CDB_SEARCH_BACK); //Artist level
- //Higher level UI should control here, not send Next command if no file
- CdbSearchData(bSearchType); //Next or Prive Artist
- CdbSearchData(bCommand); //Album Level
- }
- else
- { CdbSearchData(bSearchType); } //Next or Priv Album
- wTotalMusicInClass=stCdbClassInfo_wTotalChild;
- CdbSearchData(bCommand); //Title Level
- goto FINISH_SEARCH;
- }
- #undef dwCdbWhichPoint
- }
- }
- //P_CLASS_MODE_TITLE or Next, Prev normal search
- CdbSearchData(bSearchType);
- FINISH_SEARCH:
- //Count File Number
- gxwTotalFileInClass=wTotalMusicInClass;
- switch(bSearchType)
- {
- case CDB_SEARCH_FIRST_TITLE:
- if(gfPlayAutoSearchFile)
- gxwCurtFileInAllClass=1;
- else
- gxwCurtFileInAllClass=gxwCurtFileInAllClass-gxwCurtFileInClass+1;
- gxwCurtFileInClass=1;
- break;
- case CDB_SEARCH_LAST_TITLE:
- if(gfPlayAutoSearchFile)
- gxwCurtFileInAllClass=gxwTotalFileInAllClass;
- else
- gxwCurtFileInAllClass=gxwCurtFileInAllClass+gxwTotalFileInClass-gxwCurtFileInClass;
- gxwCurtFileInClass=gxwTotalFileInClass;
- break;
- case CDB_SEARCH_NEXT:
- if(stCdbClassInfo.dwPrePoint==CDB_NULL_POINT) //change album in autosearch mode
- gxwCurtFileInClass=1;
- else
- gxwCurtFileInClass++;
- gxwCurtFileInAllClass++;
- break;
- case CDB_SEARCH_PREV:
- if(stCdbClassInfo.dwNextPoint==CDB_NULL_POINT) //change album in autosearch mode
- gxwCurtFileInClass=gxwTotalFileInClass;
- else
- gxwCurtFileInClass--;
- gxwCurtFileInAllClass--;
- break;
- }
- }
- #endif
- #if( (((_PM_PLAY_PRC_|_PM_CLIST_) &!_PM_DVR_)| _PM_PLAY_DEL_ |_PM_DIR_DEL_) & UI_USE_CLASS_LIST )
- void UiCopyCdbSt2FsSt(void) large
- {
- gpstFileIndex->bPathDepth=stCdbClassInfo.bDepth;
- gpstFileIndex->dwDirSec[stCdbClassInfo.bDepth]=stCdbClassInfo.dwDirSec;
- gpstFileIndex->wDirOffset[stCdbClassInfo.bDepth]=stCdbClassInfo.wDirOff;
- gpstFileIndex->dwDirStartSec=stCdbClassInfo.dwDirStartSec;
- }
- #endif
- #if( (((_PM_PLAY_PRC_|_PM_CLIST_) &!_PM_DVR_)| _PM_PLAY_DEL_|_PM_DIR_DEL_) & UI_USE_CLASS_LIST )
- void UiOpenClassFile(void) large
- {
- #if(CDB_OPTION_SAVE_DIR_INFO)
- WORD wDirInfNum;
- PBYTE pbDirInfo;
- #endif
- gpstFileIndex=&stFsFileInf;
- UiCopyCdbSt2FsSt();
- #if(CDB_OPTION_SAVE_DIR_INFO)
- wDirInfNum=stCdbClassInfo.wDirInfoNum;
- while(stFsFileInf.bPathDepth>0)
- {
- stFsFileInf.bPathDepth--;
- #if(_PM_PLAY_DEL_ |_PM_DIR_DEL_)
- NandPrivateEn(); //tne CDB for SD
- #endif
- pbDirInfo=CdbLoadDirInfo(wDirInfNum);
- #if(_PM_PLAY_DEL_ |_PM_DIR_DEL_)
- NandPrivateDis(); //tne CDB for SD
- #endif
- stFsFileInf.dwDirSec[stFsFileInf.bPathDepth]=(*(DWORD *)(pbDirInfo+CDB_DIR_INF_DIR_SEC_ADD));
- stFsFileInf.wDirOffset[stFsFileInf.bPathDepth]=(*(WORD *)(pbDirInfo+CDB_DIR_INF_DIR_OFF_ADD));
- wDirInfNum=(*(WORD *)(pbDirInfo+CDB_DIR_INF_PRE_DIR_INF_ADD));
- }
- stFsFileInf.bPathDepth=stCdbClassInfo.bDepth;
- #endif
- FsOpenFile(RELOAD_FILE_NAME);
- }
- #endif
- #if((_PM_PLAY_PRC_&!_PM_DVR_)|_PM_FLIST_|_PM_CLIST_)
- void UiSetPeStop(void) large
- {
- CdcCtrl(CDC_PLAYBACK_PAUSE);
- gdwFileSector=0;
- gxdwMcuSampleNum=0;
- gxbLrcState=LRC_STS_NONE;
- //gxbSysState=S_PE_WAIT;
- gxdwLastFileSec = 0;
- gxbAbRepeatSts=AB_REPT_RESET;
- gfFirstResume=FALSE; //tne 2005/11/21 #1
- }
- #endif
- //#if( (_PM_FLIST_|_PM_CLIST_) & !_PM_DVR_ & UI_USE_CLASS_LIST)
- #if(0) //tne 2007/01/24 #2
- void UiGoSelectListMenu(void) large
- {
- gxbUiMenuMainStates=UI_SEL_LIST_MENU;
- // WHH #14 301_070107(start)
- UiShowLargeBackground(5,IM_BROWSER_BG_S1); //tne 2007/01/10 #2
- StrShowSysString(SYS_STR_ITEM_START_SEL_LIST,UI_FILST_SELECT_TITLE_COL_START,UI_FILST_SELECT_TITLE_ROW_START);
- if(gxbModuleState==MODULE_PLAY_CLIST)
- {
- OledShowIconNew(1,IM_MAINMENU_BUTTON_01 ,0,UI_FILST_SELECT_ROW_START+UI_FILST_SELECT_ROW_DIFF);
- OledShowIconNew(1, IM_EXPLORE_ICON_02_GROUP_SELECT,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- OledShowIconNew(1,IM_EXPLORE_ICON_02_FILE,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1);
- }
- else if(gxbModuleState==MODULE_PLAY_FLIST)
- {
- OledShowIconNew(1,IM_MAINMENU_BUTTON_01 ,0,UI_FILST_SELECT_ROW_START);
- OledShowIconNew(1, IM_EXPLORE_ICON_02_GROUP,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- OledShowIconNew(1,IM_EXPLORE_ICON_02_FILE_SELECT,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1);
- }
- gfTransparent=TRUE;
- StrShowSysString(SYS_STR_SEL_FILE_BROWSE,UI_FILST_SELECT_COL_START+18,UI_FILST_SELECT_ROW_START+1);
- StrShowSysString(SYS_STR_SEL_CLASSIFICATION,UI_FILST_SELECT_COL_START+18,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- gfTransparent=FALSE;
- // WHH #14 301_070107(end)
- /*OLED_CLEAR_ALL();
- OledShowIcon(ICON_LAB_CLASS,WORD0,LINE0);
- OledShowIcon(ICON_FBS_MODEL_FILE,WORD0,LINE1);
- OledShowIcon(ICON_FBS_MODEL_CLASS,WORD0,LINE2);
- StrShowSysString(SYS_STR_ITEM_START_SEL_LIST,WORD1,LINE0);
- StrShowSysString(SYS_STR_SEL_FILE_BROWSE,WORD1,LINE1); //tne 2005/12/29 #6
- StrShowSysString(SYS_STR_SEL_CLASSIFICATION,WORD1,LINE2); //tne 2005/12/29 #6
- OledReverse(WORD0,LINE2PIXEL(gxbUiMenuSubStates+1),OLED_MAX_COL,LINE1);*/
- }
- void UiDispSelectListMenu(void) large
- {
- // WHH #14 301_070107(start)
- OledShowIconNew(1,IM_EXPLORE_BUTTON_CLEAR_ALL ,0,UI_FILST_SELECT_ROW_START+gxbUiMenuSubStates*UI_FILST_SELECT_ROW_DIFF);
- gfTransparent=TRUE;
- if(gxbUiMenuSubStates)
- {
- OledShowIconNew(1, IM_EXPLORE_ICON_02_GROUP,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- StrShowSysString(SYS_STR_SEL_CLASSIFICATION,UI_FILST_SELECT_COL_START+20,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- }
- else
- {
- OledShowIconNew(1,IM_EXPLORE_ICON_02_FILE,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1);
- StrShowSysString(SYS_STR_SEL_FILE_BROWSE,UI_FILST_SELECT_COL_START+20,UI_FILST_SELECT_ROW_START+1);
- }
- gxbUiMenuSubStates ^= 0x01;
- OledShowIconNew(1,IM_MAINMENU_BUTTON_01 ,0,UI_FILST_SELECT_ROW_START+gxbUiMenuSubStates*UI_FILST_SELECT_ROW_DIFF);
- if(gxbUiMenuSubStates)
- {
- OledShowIconNew(1,IM_EXPLORE_ICON_02_GROUP_SELECT,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- StrShowSysString(SYS_STR_SEL_CLASSIFICATION,UI_FILST_SELECT_COL_START+20,UI_FILST_SELECT_ROW_START+1+UI_FILST_SELECT_ROW_DIFF);
- }
- else
- {
- OledShowIconNew(1,IM_EXPLORE_ICON_02_FILE_SELECT,UI_FILST_SELECT_COL_START,UI_FILST_SELECT_ROW_START+1);
- StrShowSysString(SYS_STR_SEL_FILE_BROWSE,UI_FILST_SELECT_COL_START+20,UI_FILST_SELECT_ROW_START+1);
- }
- gfTransparent=FALSE;
- // WHH #14 301_070107(end)
- //LcdReverse(2,0,4,MAX_COLNUM+1);
- /*
- gxbUiMenuSubStates ^= 0x01;
- OledReverse(WORD0,LINE1,OLED_MAX_COL,LINE1); //Walace051229#1
- OledReverse(WORD0,LINE2,OLED_MAX_COL,LINE1);*/
- }
- #endif
- #if(_PM_PLAY_PRC_& !_PM_DVR_& UI_USE_CLASS_LIST)
- void UiStartPlayClassFile(void) large
- {
- UiOpenClassFile();
- stUiFileListData=stFsFileInf;
- UiSetPeStop();
- //PeStart();
- }
- #endif
- #if(_PM_PLAY_PRC_)
- BYTE UiSelectRandMusic(BYTE bPeCommand) large
- {
- WORD wRndNum,wI;
- if(bPeCommand==P_NEXT)
- { wRndNum=UiGetRndPlayNum(UI_RND_PLAY_NEXT); }
- else
- { wRndNum=UiGetRndPlayNum(UI_RND_PLAY_PREV); }
- if(wRndNum>=gxwCurrentFileNum)
- gxbFileNumSearchMode=FNUM_SEARCH_NEXT_MODE;
- else
- gxbFileNumSearchMode=FNUM_SEARCH_PREV_MODE;
- gpstFileIndex=&stFsFileInf;
- #if(!_PM_DVR_&UI_USE_CLASS_LIST)
- if(gxbPlayClassMode==P_CLASS_MODE_FILE)
- #endif
- {
- PlayEngine(P_RND_FIRST);
- for(wI=1;wI<wRndNum;wI++)
- PlayEngine(P_RND_NEXT);
- bPeCommand=P_RND_START;
- }
- #if(!_PM_DVR_&UI_USE_CLASS_LIST)
- else
- {
- UiCdbSearchData(CDB_SEARCH_FIRST_TITLE);
- for(wI=1;wI<wRndNum;wI++)
- UiCdbSearchData(CDB_SEARCH_NEXT);
- gxwCurrentFileNum=wRndNum;
- UiStartPlayClassFile();
- bPeCommand=P_RESTART;
- }
- #endif
- gfChangeMusic=TRUE;
- return bPeCommand;
- }
- #endif
- #if(_PM_PLAY_PRC_)
- BYTE UiSelectNextMusic(BYTE bPeCommand) large
- {
- #if(!_PM_DVR_&UI_USE_CLASS_LIST)
- if(gxbPlayClassMode==P_CLASS_MODE_FILE)
- #endif
- {
- if(bPeCommand==P_NEXT)
- {
- if(gxwCurrentFileNum>=gxwNumTotalFiles)
- bPeCommand=P_FIRST;
- }
- else //if(bPeCommand==P_PREV)
- {
- if(gxwCurrentFileNum==1)
- bPeCommand=P_LAST;
- }
- }
- #if(!_PM_DVR_&UI_USE_CLASS_LIST)
- else
- {
- if(bPeCommand==P_NEXT)
- {
- if(gxwCurrentFileNum>=gxwNumTotalFiles)
- {
- UiCdbSearchData(CDB_SEARCH_FIRST_TITLE);
- gxwCurrentFileNum=1;
- }
- else
- {
- UiCdbSearchData(CDB_SEARCH_NEXT);
- gxwCurrentFileNum++;
- }
- }
- else //if(bPeCommand==P_PREV)
- {
- if(gxwCurrentFileNum==1)
- {
- UiCdbSearchData(CDB_SEARCH_LAST_TITLE);
- gxwCurrentFileNum=gxwNumTotalFiles;
- }
- else
- {
- UiCdbSearchData(CDB_SEARCH_PREV);
- gxwCurrentFileNum--;
- }
- }
- UiStartPlayClassFile();
- bPeCommand=P_RESTART;
- gfChangeMusic=TRUE;
- }
- #endif
- return bPeCommand;
- }
- #endif
- //tne dir del
- #if( (_PM_DIR_DEL_|_PM_PLAY_DEL_) & (UI_USE_CLASS_LIST) )
- //if(gxbPlayClassMode!=P_CLASS_MODE_FILE)
- void UiCountClassAfterDel(PWORD pwTotalFileInClass, PWORD pwCurtFileInClass, PWORD pwCurtFileInAllClass) large
- {
- DWORD dwOldCdbAddPoint;
- dwOldCdbAddPoint=gdwCdbAddPoint;
- #if(_PM_PLAY_DEL_)
- gxwTotalFileInAll--;
- #endif
- if(gxbModuleState==MODULE_PLAY_CLIST) //Walace060607#1 PlayProcess
- gdwCdbAddPoint=gdwOldDelCdbAddPoint;
- CdbGetClassHeader(gdwCdbAddPoint);
- *pwCurtFileInClass=stCdbClassInfo.wItemNum;
- *pwCurtFileInAllClass=stCdbClassInfo.wItemNum;
- if(gxbPlayClassMode==P_CLASS_MODE_TITLE)
- {
- gxwTotalFileInAllClass=CdbGetDataBaseHeader(CDB_HEADER_TITLE_NUM_ADD);
- *pwTotalFileInClass=gxwTotalFileInAllClass;
- }
- else
- {
- CdbSearchData(CDB_SEARCH_BACK);
- *pwTotalFileInClass=stCdbClassInfo_wTotalMusic;
- switch(gxbPlayClassMode)
- {
- case P_CLASS_MODE_ALBUM:
- gxwTotalFileInAllClass=stCdbClassInfo_wTotalMusic;
- break;
- case P_CLASS_MODE_GENRE:
- while(stCdbClassInfo.dwPrePoint!=CDB_NULL_POINT)
- {
- CdbSearchData(CDB_SEARCH_PREV);
- *pwCurtFileInAllClass += stCdbClassInfo_wTotalMusic;
- }
- CdbSearchData(CDB_SEARCH_BACK);
- case P_CLASS_MODE_ARTIST:
- while(stCdbClassInfo.dwPrePoint!=CDB_NULL_POINT)
- {
- CdbSearchData(CDB_SEARCH_PREV);
- *pwCurtFileInAllClass += stCdbClassInfo_wTotalMusic;
- }
- CdbSearchData(CDB_SEARCH_BACK);
- gxwTotalFileInAllClass=stCdbClassInfo_wTotalMusic;
- break;
- }
- }
- gdwCdbAddPoint=dwOldCdbAddPoint;
- CdbGetClassHeader(gdwCdbAddPoint);
- }
- #endif
- #if( (_PM_DIR_DEL_|_PM_PLAY_DEL_) & (UI_USE_CLASS_LIST) )
- //if(gxbPlayClassMode==P_CLASS_MODE_FILE)
- void UiCountFileAfterDelClass(void) large
- {
- WORD wOldTotalFileInClass,wOldCirtFileInClass;
- #if(_PM_PLAY_DEL_)
- gxwTotalFileInAll--;
- #endif
- wOldTotalFileInClass=gxwTotalFileInClass; //gxwTotalFileInDir
- wOldCirtFileInClass=gxwCurtFileInClass; //gxwCurtFileInDir
- //point to an impossible sector,UiCountCurtFileNum will detect "Different dir"
- //let UiCountCurtFileNum to force getting file number
- //it's safe because we set gxbFileNumSearchMode=FNUM_SEARCH_RESET_MODE
- stUiFileListData.dwDirStartSec=0;
- gxbFileNumSearchMode=FNUM_SEARCH_RESET_MODE;
- UiCountCurtFileNum(&stUiFileListData,&stFsFileInf);
- gxwOldDelTotalFileInClass=gxwTotalFileInDir; //gxwTotalFileInClass
- gxwOldDelCurtFileInClass=gxwCurtFileInDir; //gxwCurtFileInClass
- gxwTotalFileInClass=wOldTotalFileInClass;
- gxwCurtFileInClass=wOldCirtFileInClass;
- }
- #endif
- //David051130#4 start
- #if(_PM_PLAY_|_PM_SLS_)
- /*--------------------------------------------------------------------------
- Description:
- Let DSP process fade out, wait it finish or not
- Arguments:
- wDspFadeCmd
- the command that send to dsp (check const.c "Dsp Fade in/out command" for details)
- fWait
- TRUE: wait until dsp finish
- FALSE: no waiting
- Global arguments:
- None
- Returns:
- None
- --------------------------------------------------------------------------*/
- //Vicky060112#2 Updated
- void UiDspFade(WORD wDspFadeCmd,BOOL fWait) //Walace061228#CodeSize
- {
- WORD wTimeOut,wDspVal;
- //Vicky060112#2
- BYTE bClkDiv;
- bClkDiv=obCLKMCUDIVF;
- //#if(USE_STEP_UP_CONVERTER)
- McuClockDivfAdjust(0x08);// WHH #1 061017
- //#else
- // obCLKMCUDIVF=0x08;
- //#endif
- //End
- #ifdef FADEIN_LOWRATEMUSIC //Vicky060127#2
- gxbRecOption&=~PLAY_LOWRATE_FADEIN_CHECK; //Vicky060127#2
- #endif
- //Vicky060127#1
- if(wDspFadeCmd&DSP_FADE_OUT_EN)
- {
- wDspVal=FALSE;
- IdmaPioDmxW(&wDspVal, DSP_MUTE_PA_ADDR, 1, DSP_W16);
- gxbRecOption|=PLAY_CHECK_MUTEPA;
- }
- //End
- if( ((gxbMusicType&M_MAIN_TYPE)==M_WMA_2)
- || ((gxbMusicType&M_MAIN_TYPE)==M_WMA_4)
- || ((gxbMusicType&M_MAIN_TYPE)==M_WMA_6)
- )
- {
- if(fWait)
- {
- if(wDspFadeCmd&DSP_FADE_OUT_EN)
- {
- IdmaPioDmxR(DSP_GAIN_ADDR,&wDspVal,1,DSP_W16);
- while(wDspVal>0)
- {
- if(wDspVal>0x1000)
- wDspVal-=0x1000;
- else
- wDspVal=0;
- IdmaPioDmxW(&wDspVal,DSP_GAIN_ADDR,1,DSP_W16);
- for(wTimeOut=0;wTimeOut<800;wTimeOut++) {}
- }
- //Since Low Rate WMA Decoder does not have dsp Fade Out Feauter. Smoothly Adjust Digital Gain
- }
- else //Fade In
- {
- wDspVal=0;
- while(wDspVal<FADE_TARGET_DSP_GAIN) //Walace060907#4
- {
- if((wDspVal+=0x1000)>FADE_TARGET_DSP_GAIN ) //Walace060907#4
- wDspVal=FADE_TARGET_DSP_GAIN; //Walace060907#4
- IdmaPioDmxW(&wDspVal,DSP_GAIN_ADDR,1,DSP_W16);
- for(wTimeOut=0;wTimeOut<800;wTimeOut++) {}
- }
- }
- }
- else
- {
- if(wDspFadeCmd&DSP_FADE_OUT_EN)
- wDspVal=0;
- else
- wDspVal=FADE_TARGET_DSP_GAIN; //Walace060907#4
- IdmaPioDmxW(&wDspVal,DSP_GAIN_ADDR,1,DSP_W16);
- //Vicky060127#2
- #ifdef FADEIN_LOWRATEMUSIC
- if(wDspFadeCmd&DSP_FADE_IN_EN)
- {
- gxbRecOption|=PLAY_LOWRATE_FADEIN_CHECK;
- }
- #endif
- //End
- }
- }
- else
- {
- IdmaPioDmxW(&wDspFadeCmd,DSP_FADE_ADDR,1,DSP_W16);
- if(fWait)
- {
- //wTimeOut=0x8FFF;
- //0xA80=>measured with Scope [126ms: 48K domain (14.7Mhz)]; [137ms: 44.1k domain (13.6Mhz)]
- wTimeOut=0xA80; //Vicky060109#4
- while(wTimeOut)
- {
- /*
- if(wDspFadeCmd&DSP_FADE_OUT_EN)
- {
- //#define wDspVal wTimeOut
- IdmaPioDmxR(DSP_FADE_ADDR,&wDspVal,1,DSP_W16);
- if((wDspVal&DSP_FADE_OUT_EN))
- {
- IdmaPioDmxR(DSP_OUT_BUF_EMPTY,&wDspVal,1,DSP_W16);
- if(wDspVal)
- {
- obGPIOADAT&=~0x20; //Vicky Debug Fade Out
- return;
- }
- }
- //#undef wDspVal
- }
- /*/
- /*
- LCD_CTRL_EN();//bk
- LcdShowTitleNum(wTimeOut,2,80,5);//test
- LCD_CTRL_DIS();
- */
- if(UiCheckDspFadeDone())
- {
- break;
- }
- wTimeOut--;
- }
- /*
- while(1)
- {
- IdmaPioDmxR(0x1fda,&wDspFadeCmd,1,DSP_W16);
- if(wDspFadeCmd!=0)
- {
- while(1);
- }
- IdmaPioDmxR(DSP_OUT_BUF_EMPTY,&wDspFadeCmd,1,DSP_W16);
- if(wDspFadeCmd)
- break;
- }
- */
- }
- }
- //#if(USE_STEP_UP_CONVERTER)
- McuClockDivfAdjust(bClkDiv);// WHH #1 061017
- //#else
- //obCLKMCUDIVF=bClkDiv; //Vicky060112#2
- //#endif
- }
- #if(!_PM_PLAY_PRC_)
- /*--------------------------------------------------------------------------
- Description:
- Check Dsp in buffer empty
- Arguments:
- Global arguments:
- None
- Returns:
- TRUE: In buffer emptty
- FALSE: In buffer not empty
- --------------------------------------------------------------------------*/
- BOOL UiCheckDspInBufEmpty(WORD wNum) large //vicky061028#2
- {
- #if(1)
- XWORD wRemaindata;
- wRemaindata=PeReptAdjust();
- if(wRemaindata<wNum)
- return TRUE;
- else
- return FALSE;
- #else
- XWORD xwDspW,xwDspR;
- IdmaPioDmxR(DSP_IN_W_IDX_ADDR,&xwDspW,1,DSP_W16);
- IdmaPioDmxR(DSP_IN_R_IDX_ADDR,&xwDspR,1,DSP_W16);
- if( ((xwDspW>=xwDspR) && ((xwDspW-xwDspR)<wNum)) ||
- ((xwDspW<xwDspR) && ((1024+xwDspW-xwDspR)<wNum))
- )
- return TRUE;
- else
- return FALSE;
- #endif
- }
- #endif
- /*--------------------------------------------------------------------------
- Description:
- Check Dsp Fading done
- Arguments:
- None
- Global arguments:
- None
- Returns:
- bFadeDone: fade in/out done status
- 0: fading
- 1: fade in done
- 2: fade out done
- --------------------------------------------------------------------------*/
- //Vicky060112#2
- BYTE UiCheckDspFadeDone(void) large
- {
- XWORD xwDspVal;
- // XDWORD xdwTemp;
- /*
- LCD_CTRL_EN();
- //IdmaPioDmxR(0x0c4a,&xwDspVal,1,DSP_W16);//bk
- //LcdShowTitleNum(xwDspVal,6,0,5);//test
- //IdmaPioDmxR(0x0c4b,&xwDspVal,1,DSP_W16);
- //LcdShowTitleNum(xwDspVal,6,40,5);//test
- //IdmaPioDmxR(DSP_FADE_ADDR,&xwDspVal,1,DSP_W16);
- //LcdShowTitleNum(xdwTemp,6,0,10);//test
- IdmaPioDmxR(0x1fdb,&xwDspVal,1,DSP_W16);
- LcdShowTitleNum(xwDspVal,6,0,5);//test
- IdmaPioDmxR(0x1fdc,&xwDspVal,1,DSP_W16);
- LcdShowTitleNum(xwDspVal,6,40,5);//test
- IdmaPioDmxR(0x1fdd,&xwDspVal,1,DSP_W16);
- LcdShowTitleNum(xwDspVal,6,80,5);//test
- LCD_CTRL_DIS();
- */
- if( ((gxbMusicType&M_MAIN_TYPE)==M_WMA_2)
- || ((gxbMusicType&M_MAIN_TYPE)==M_WMA_4)
- || ((gxbMusicType&M_MAIN_TYPE)==M_WMA_6)
- )
- {
- IdmaPioDmxR(DSP_GAIN_ADDR,&xwDspVal,1,DSP_W16);
- if(xwDspVal==0)
- return 0x02;
- else if(xwDspVal>=FADE_TARGET_DSP_GAIN); //Walace060907#4
- return 0x01;
- }
- else
- {
- IdmaPioDmxR(DSP_FADE_ADDR,&xwDspVal,1,DSP_W16);
- return (xwDspVal & DSP_FADE_DONE)>>14;
- }
- }
- //End
- //Vicky051219#2
- //Vicky060109#2
- /*
- BYTE UiSetFadeUnit(void) large
- {
- XBYTE bFadOutUnit;
- switch(gxwSampleRate)
- {
- case 8000:
- bFadOutUnit=16; //;
- if(gxwByteRate<=100) //equal or less than 8Kbps
- bFadOutUnit=30; //8;
- else if(gxwByteRate<=300) //equal or less than 24Kbps
- bFadOutUnit=24; //6;
- break;
- case 11025:
- case 12000:
- bFadOutUnit=12; // 3;
- if(gxwByteRate<=100) //equal or less than 8Kbps
- bFadOutUnit=24; // 6;
- else if(gxwByteRate<=300) //equal or less than 24Kbps)
- bFadOutUnit=16; // 4;
- break;
- default: bFadOutUnit=3;
- }
- return bFadOutUnit;
- }
- */
- //Vicky060112#2 Updated
- #if(_PM_PLAY_MAIN_|_PM_DVR_MAIN_)
- void UiFWFadeOut(void) //valid only Set "FADE_IN_OUT_MODE=1" //Walace061228#CodeSize
- {
- #if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_))
- BYTE bVol;
- XWORD wcnt;
- XWORD wDspVal;
- /*
- BYTE bVol;
- for(bVol=gxbVolume; bVol>=1;bVol--)
- {
- IntCdcSetPaGain(bVol);
- IntCdcSetPaGainTask(TRUE);
- }
- */
- //Vicky060112#2
- BYTE bClkDiv;
- bClkDiv=obCLKMCUDIVF;
- //#if(USE_STEP_UP_CONVERTER)
- McuClockDivfAdjust(0x08);// WHH #1 061017
- //#else
- // obCLKMCUDIVF=0x08;
- //#endif
- //End
- wcnt=230; //From Max -> Min : Cost 230->25+5 ms,460->50+5ms
- for(bVol=gxbLastVolume; bVol>FADEOUT_VOL;bVol--) //Walace060402#2
- {
- IdmaPioDmxR(DSP_OUT_BUF_EMPTY,&wDspVal,1,DSP_W16);
- if(wDspVal)
- {
- //IntCdcSetPaGain(FADEOUT_VOL); //tne 2006/07/03 #1
- gxbTargetVolume=FADEOUT_VOL; //tne 2006/07/03 #1
- CdcSetPaGainTask(PA_TASK_IMMEDIATE|PA_TASK_NO_EQ_ADJ); //tne 2006/07/03 #1 //tne 2006/12/26 #1
- break;
- }
- //IntCdcSetPaGain(bVol); //tne 2006/07/03 #1
- gxbTargetVolume=bVol; //tne 2006/07/03 #1
- for(wDspVal=0;wDspVal<wcnt;wDspVal++) {}
- CdcSetPaGainTask(PA_TASK_IMMEDIATE|PA_TASK_NO_EQ_ADJ); //tne 2006/07/03 #1 //tne 2006/12/26 #1
- }
- #endif
- //#if(USE_STEP_UP_CONVERTER)
- McuClockDivfAdjust(bClkDiv);// WHH #1 061017
- //#else
- // obCLKMCUDIVF=bClkDiv;
- //#endif
- }
- #endif
- //Vicky060109#2 //Vicky060112#2 Updated
- #if(!_PM_PLAY_PRC_)
- BOOL UiGetFadePoint(void) //Walace061228#CodeSize
- {
- XWORD wDSPval,wSamples;
- if((gxwSampleRate>=44100 )&& ((gxbMusicType&M_MAIN_TYPE)<=M_WMA_6))
- return TRUE;
- IdmaPioDmxR(DSP_OUT_W_IDX_ADDR,&wDSPval,1,DSP_W16); //Get out buffer Write Index
- if(gxwOBWI==wDSPval)
- {
- if(gxbOBWICnt<20) //Vicky60117 Debug POP across file
- {
- gxbOBWICnt++;
- }
- else
- {
- if(gxwSampleRate>22050)
- return TRUE;
- else
- {
- wSamples=gxwSampleRate/1000*50; // gxwSampleRate*90 //Vicky60117 Debug POP across file
- //wSamples=10000; //Vicky60117 Debug POP across file
- if(gxbMusicFeature&MF_STEREO)
- wSamples<<=1;
- IdmaPioDmxR(DSP_OUT_R_IDX_ADDR,&wDSPval,1,DSP_W16);
- if( ( (gxwOBWI>=wDSPval) && ((gxwOBWI-wDSPval)<(wSamples)) )
- || ((gxwOBWI<wDSPval) && ((4096+gxwOBWI-wDSPval)<(wSamples)))
- )
- {
- return TRUE;
- }
- }
- }
- }
- else
- {
- gxwOBWI=wDSPval;
- gxbOBWICnt=0;
- }
- return FALSE;
- }
- #endif
- //End
- #endif
- //End
- //tne 2005/11/07
- //check unicode tag (odd string length error)
- #if(_PM_PLAY_PRC_&!_PM_DVR_)
- void UiCheckTag(void) large
- {
- #if(USE_TAG_DISPLAY)
- BYTE bI; //tne 2005/12/24
- /* //Remove by tne 512 tag
- code PBYTE pbTagPoint[]=
- {
- gxbTagTitle,
- gxbTagArtist,
- gxbTagAlbum,
- };
- for(bI=0;bI<3;bI++)
- {
- if( (pbTagPoint[bI][0]==STRING_TYPE_UNICODE) && (pbTagPoint[bI][1]&0x01) )
- {
- pbTagPoint[bI][1]++;
- pbTagPoint[bI][(pbTagPoint[bI][1])+1]=0x00;
- }
- if(pbTagPoint[bI][1]>=254)
- pbTagPoint[bI][1]=252;
- //tne 2005/12/24/// Display nothing if only space in the string
- bJ=2;
- while(1)
- {
- if(pbTagPoint[bI][0]==STRING_TYPE_UNICODE)
- {
- if( (pbTagPoint[bI][bJ]!=0x20) || (pbTagPoint[bI][bJ+1]!=0x00) )
- break;
- bJ += 2;
- }
- else
- {
- if(pbTagPoint[bI][bJ]!=0x20)
- break;
- bJ++;
- }
- if(bJ>=pbTagPoint[bI][1]+2)
- {
- pbTagPoint[bI][1]=0;
- break;
- }
- }
- //////////////////////////////
- }
- */
- //tne 2006/01/15 #1 //tne 512 tag
- for(bI=0;bI<LCD_TAG_TOTAL_NUMBER;bI++)
- {
- if(gxwNameBufLen[bI]!=0)
- return;
- }
- gxbMusicType &= (~M_SUB_TYPE); //Clean Tag Informatin
- /////////////////////
- #endif
- }
- #endif
- //Vicky060223#1
- #if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- BOOL UiAbReachB(void) //Walace061228#CodeSize
- {
- XWORD wNum;
- //Vicky060703#1
- BOOL fGet;
- fGet=FALSE;
- //End
- if(gxbPlayVar & AB_WAIT_BFINISH)
- {
- if(gxwUiLastBitRate>128)
- wNum=512;
- else if(gxwUiLastBitRate>=20)
- wNum=256;
- else
- wNum=72;
- if(UiCheckDspInBufEmpty(wNum))
- fGet=TRUE;
- //Vicky060703#1
- IdmaPioDmxR(DSP_DSP_10MS_H_ADDR,&gxdwCurrentLrcTime,2,DSP_W16); //get 0.01 sec
- if( ((gxbMusicType&M_MAIN_TYPE)<=M_WMA_6) &&(gxwByteRate<250) && (gxdwCurrentLrcTime>gxdwSecReptB) )
- fGet=TRUE;
- if(fGet)
- //End
- {
- #if(FADE_IN_OUT_MODE==1)
- if((UiCheckDspFadeDone()!=0x02) &&(gxbSysState==S_PE_PLAY) ) //if fade out done, won't do it again
- {
- UiDspFade((DSP_FADE_OUT_EN|DSP_FADE_1_UNIT),TRUE);
- }
- #endif
- //Vicky060224#1
- gxbPlayVar&=~AB_WAIT_BFINISH;
- return TRUE;
- /*
- IdmaPioDmxR(DSP_OUT_BUF_EMPTY,&wDspVal,1,DSP_W16);
- if(wDspVal)
- {
- gxbPlayVar&=~AB_WAIT_BFINISH;
- return TRUE;
- }
- */
- }
- }
- else
- {
- if(gdwFileSector>gxdwFileSectorReptB)
- gxbPlayVar|=AB_WAIT_BFINISH;
- }
- return FALSE;
- }
- #endif
- //End
- #if(_PM_PLAY_PRC_)
- void UiPeStartStartCallBack(void)
- {
- BYTE bSubModule;
- gxbLastErrCode=ERR_NO_ERROR; //Walace061024#2
- bSubModule = (gxbModuleState&MODULE_SUB);
- switch(gxbModuleState&MODULE_MASTER)
- {
- case MODULE_PLAY:
- case MODULE_PLAY_MENU:
- case MODULE_PLAY_FLIST:
- if(gxbPlayClassMode==P_CLASS_MODE_FILE)
- {
- if(bSubModule==MODULE_FILE_DEL)
- break;
- gfFillDspBufEn=FALSE;
- UiCountCurtFileNum(&stUiFileListData,&stFsFileInf);
- #if(_PM_DVR_)
- stFsFileInf=stUiFileListData;//tne 2006/06/15
- #endif
- #if(UI_DISP_DIR_NAME)
- UiGetCurtDirName();
- #endif
- }
- break;
- case MODULE_PLAY_CLIST:
- break;
- default:
- break;
- }
- gxbPeDispCmd=UI_PE_START_START;
- }
- #endif
- #if(_PM_PLAY_PRC_)
- void UiPeStartEndCallBack(void)
- {
- WORD wDspVal;
- BYTE bSubModule;
- bSubModule = (gxbModuleState&MODULE_SUB);
- if(gxbErrCode!=ERR_NO_ERROR) //Walace061024#3
- return ;
- gxbAbRepeatSts=AB_REPT_RESET;
- #if(!_PM_DVR_)
- UiCheckTag();
- #endif
- IdmaPioDmxW(&gxw3DMode,DSP_3D_ADDR,1,DSP_W16);
- UiSetEqGain(gxwEqMode);
- switch(gxbModuleState&MODULE_MASTER)
- {
- case MODULE_PLAY:
- break;
- case MODULE_PLAY_MENU:
- wDspVal=gxbUiMenuSubStates;
- switch(gxbUiMenuMainStates)
- {
- case UI_EQ_MENU: //Walace060402#1
- case UI_USER_EQ_MENU: //Walace060402#1
- UiSetEqGain(wDspVal); //Walace060127#2
- break;
- case UI_3D_MENU:
- //Vicky060303#1
- DetermineDspClock(gxbPlaybackRate, wDspVal);
- IdmaPioDmxW(&wDspVal,DSP_3D_ADDR,1,DSP_W16);
- break;
- //#endif //tne 2006/01/16
- case UI_PLAYBACK_RATE_MENU:
- PeSetPlaybackRate(wDspVal);
- break;
- }
- break;
- case MODULE_PLAY_FLIST:
- if(bSubModule==MODULE_FILE_DEL)
- break;
- gxwFileNumInFileList=gxwCurtFileInDir+gxwTotalDirInDir;
- gxwOldTotalDirInDir=gxwTotalDirInDir;
- gxwOldTotalFileInDir=gxwTotalFileInDir;
- break;
- case MODULE_PLAY_CLIST:
- if(bSubModule==MODULE_FILE_DEL)
- break;
- //gxwOldCurtFileInClass=gxwCurtFileInClass;
- //gxwOldTotalFileInClass=gxwTotalFileInClass;
- //gdwOldCdbAddPoint=gdwCdbAddPoint;
- break;
- default:
- break;
- }
- #if(USE_LYRIC_DISPLAY)
- gxbLcdLyricStatus=LCD_LYRIC_SCROLL_DONE; // set done to show first lyric
- gxbLastLyrcBuf[1]=0; //tne 2005/08/11
- #endif
- gxwUiLastBitRate=0; //display zero after change music
- if(!gfFirstResume) //tne 2005/08/19
- {
- gxwCurrentPlayTime=0; //set 0 for intro mode
- gxwLastPlayTime=0; //vicky061113#1
- //gxdwCurrentLrcTime=0; //tne 2006/02/10 #1 //Walace060226#remove
- //Vicky061001#1 start
- #if(USE_NEW_FF_PLAY)
- if( (gxbFastPlaySts&PLAY_DIRECTION)==PLAY_REW)
- {
- gxwCurrentPlayTime=gxwMusicTotalTime;
- if(gxwCurrentPlayTime>FB_ACROSS_SKIP_TIME)
- gxwCurrentPlayTime-=FB_ACROSS_SKIP_TIME;
- }
- #endif
- //Vicky061001#1 end
- }
- gfFillDspBufEn=TRUE;
- gxbPeDispCmd=UI_PE_START_END;
- }
- #endif
- #if(_PM_PLAY_|_PM_SLS_)
- void UiPeStopCallBack(void)
- {
- gxbLastErrCode=gxbErrCode; //Walace070116#6
- LoadExtendMemCode(); //Walace070109#2
- if(gxbErrCode==ERR_NO_ERROR) //Walace070116#6
- gxbErrCode=gxbLastErrCode;
- UiRndPlayInit();
- gfFillDspBufEn=FALSE;
- if(!gfPwOffStop)
- gxwCurrentPlayTime=0;
- gxbPeDispCmd=UI_PE_STOP;
- }
- #endif
- #if(!(_PM_PLAY_PRC_|_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_))
- void UiPePlayUpdateCallBack(void)
- {
- gxbPeDispCmd=UI_PE_PLAY_UPDATE;
- }
- #endif
- //function move here by tne 2006/08/16 #1
- #if(_PM_PLAY_MAIN_ || _PM_DVR_MAIN_)
- void UiShowPlayTime(void)
- {
- #if(UI_DISP_MUSIC_INF)
- BYTE bTimeNum ;
- // WHH #13 301_070105(start)
- bTimeNum=(BYTE)( (gxwCurrentPlayTime%3600)/60); //Show Minutes //vicky060525#1
- OledShowNumber(bTimeNum,91,64,2);
- bTimeNum=(BYTE)(gxwCurrentPlayTime%60); //Show Second
- OledShowNumber(bTimeNum,110,64,2);
- OledShowIconNew(1,IM_MUSIC_SMALLNUMBER_COLON,102,64);
- //bTimeNum=(BYTE)( (gxwCurrentPlayTime%3600)/60); //Show Minutes //vicky060525#1
- //OledShowNumber(bTimeNum,50,PAGE2,2); //Walace060322#3
- //bTimeNum=(BYTE)(gxwCurrentPlayTime%60); //Show Second
- //OledShowNumber(bTimeNum,66,PAGE2,2); //Walace060322#3
- // WHH #13 301_070105(start)
- //draw progress bar
- #if(UI_USE_PROGRESS_BAR) //Walace060525#1 dword to caculate
- if(gxwMusicTotalTime!=0) //Walace060815#1
- bTimeNum = ((DWORD)gxwCurrentPlayTime*PROGRESS_MAX)/(DWORD)gxwMusicTotalTime ;
- else
- bTimeNum=0;
- // WHH #13 301_070105
- // ShowProgress(11,25,bTimeNum);
- ShowProgress(28,147,bTimeNum);
- #endif // UI_USE_PROGRESS_BAR
- #endif
- }
- #endif
- //tne 2006/08/16 #1 //end
- //Walace061011 PlayProcess
- #if(!(_PM_PLAY_PRC_|_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_))
- void LoadPlayProcess(BYTE bProcessCmd)
- {
- SetSysSpeed(SYS_SPEED_UP_UI);
- gxbPlayProcessCmd=bProcessCmd;
- KeepMemory(KEEP_MEMORY);
- #if(_PM_DVR_)
- LoadProgram(PM_DVR_PRC,NORMAL_CODE);
- #else
- LoadProgram(PM_PLAY_PRC,NORMAL_CODE);
- #endif
- }
- #endif
- //vicky061001#1
- #if( (_PM_PLAY_|_PM_DVR_|_PM_SLS_)&&!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_PLAY_PRC_) )
- //vicky061113#2 update start
- void UIAcrossPre(void)
- {
- //OledShowNumber(31 , 60, LINE3, 2); //V debug only
- if((gfDspCtrlCdc) &&(gxbSysState==S_PE_PLAY) && (gxbMusicProcState==MUSIC_PROC_BODY )) //Walace060822#4
- {
- //vicky061001#1
- if( ( (gxbDSPDataCnt&DATA_RESTART) &&(gxbDSPDataCnt&DATA_SENT_NUM) ) ||
- ( !(gxbDSPDataCnt&DATA_RESTART)&& ((gxbDSPDataCnt&DATA_SENT_NUM)>=3) /*&&((gdwFileSector<<9) >= (gxdwFirstPackLoc+1536))*/) )
- {
- PlayEngine(P_FF_X2);
- //OledShowNumber(32 , 60, LINE3, 2); //V debug only
- }
- }
- }
- //vicky061113#2 update end
- #endif
- //Walace060821#1
- #if((_PM_PLAY_&!_PM_PLAY_PRC_)|_PM_SLS_)
- void UiCheckFadeout()
- {
- #if(FADE_IN_OUT_MODE==0)
- UiSetVolFadeOut();
- #elif(FADE_IN_OUT_MODE==1)
- if((UiCheckDspFadeDone()!=0x02) &&(gxbSysState==S_PE_PLAY) ) //if fade out done, won't do it again
- {
- UiDspFade((DSP_FADE_OUT_EN|DSP_FADE_1_UNIT),TRUE);//Vicky060119
- }
- #endif
- }
- #endif
- //function add by tne 2006/08/16 #1
- #if(!(_PM_PLAY_DEL_|_PM_DIR_DEL_|_PM_VIDEO_|_PM_PLAY_PRC_))
- API BYTE UiNormalChMusicStartJob(BYTE bPeCommand) large
- {
- //Walace060821#1
- //#if(_PM_PLAY_MAIN_ || _PM_DVR_MAIN_)
- // UiShowLastPlayTime(); //tne 2006/07/07 #1
- //#endif
- switch(gxbRepeatMode)
- {
- case NO_REPEAT:
- //
- #if(USE_NEW_FF_PLAY) //Vicky061001#1
- if( ( ((gxbFastPlaySts&PLAY_DIRECTION)==PLAY_FF) && (gxwCurrentFileNum>=gxwNumTotalFiles) )||
- ( ((gxbFastPlaySts&PLAY_DIRECTION)==PLAY_REW) && (gxwCurrentFileNum<=1) ) )
- {
- bPeCommand=P_STOP;
- break;
- }
- #else
- if(gxwCurrentFileNum>=gxwNumTotalFiles)
- {
- bPeCommand=P_STOP;
- break;
- }
- #endif
- case RND_ALL_REPEAT:
- case ALL_REPEAT:
- bPeCommand=P_NEXT;
- #if(UI_USE_FF_PLAY) //Vicky061001#1
- if((gxbFastPlaySts&PLAY_DIRECTION)==PLAY_REW)
- bPeCommand=P_PREV;
- #endif
- break;
- case SINGLE_REPEAT:
- bPeCommand=P_RESTART;
- //gfChangeMusic=TRUE; //tne 2006/02/15 #1
- break;
- #if(UI_USE_RND_PLAY_ONE_EN)
- case RND_REPEAT:
- gxwRndListIndex++;
- if(gxwRndListIndex>=gxwNumTotalFiles)
- { bPeCommand=P_STOP; }
- else
- {
- bPeCommand=P_NEXT;
- #if(UI_USE_FF_PLAY) //Vicky061001#1
- if((gxbFastPlaySts&PLAY_DIRECTION)==PLAY_REW)
- bPeCommand=P_PREV;
- #endif
- }
- break;
- #endif
- }
- gxbAbRepeatSts=AB_REPT_RESET; // not support AB repeat across two music
- gxdwLastFileSize = 0;
- #if((USE_NEW_FF_PLAY & !UI_USE_FB_ACROSS) || (UI_USE_FF_PLAY& !USE_NEW_FF_PLAY) ) //Vicky061001#1
- gxbFastPlaySts=PLAY_SPEED_NORMAL;
- #endif
- return bPeCommand;
- }
- #endif
- #if(_PM_PLAY_MAIN_ || _PM_DVR_MAIN_)
- //tne 2006/07/07 #1
- void UiShowLastPlayTime(void) large
- {
- #if(UI_DISP_MUSIC_INF)
- //#define TIME_DEBUG //vicky060810#2
- #ifdef TIME_DEBUG
- XWORD wtemp;
- #endif
- if(fUiTagHidden) return;//Walace060821#1
- if(gxbSysState==S_PE_PLAY)
- {
- gxbLcdCounter=0;
- #ifdef TIME_DEBUG
- while(1)
- #else
- while(gxbLcdCounter<=UI_SHW_LAST_PLAY_DELAY_TIME)
- #endif
- {
- IdmaPioDmxR(DSP_DSP_SEC_ADDR,&gxwCurrentPlayTime,1,DSP_W16);
- UiShowPlayTime();
- #ifdef TIME_DEBUG
- IdmaPioDmxR(DSP_DSP_10MS_H_ADDR,&wtemp,1,DSP_W16);
- OledShowNumber(wtemp, 0, LINE3, 4);
- IdmaPioDmxR(DSP_DSP_10MS_L_ADDR,&wtemp,1,DSP_W16);
- OledShowNumber(wtemp, 40, LINE3, 4);
- IdmaPioDmxR(DSP_FRAME_ADDR,&wtemp,1,DSP_W16);
- OledShowNumber(wtemp, 0, LINE3+8, 4);
- IdmaPioDmxR(DSP_FRAME_ADDR+1,&wtemp,1,DSP_W16);
- OledShowNumber(wtemp, 40, LINE3+8, 4);
- #endif
- }
- }
- #endif
- }
- #endif
- //Vicky070105#3
- #if((_PM_PLAY_&!_PM_PLAY_PRC_)|_PM_SLS_)
- void UiCheckNandRestore(XBYTE bState)
- {
- //Nick061120 start //NandRestore start //Walace061221#1
- #if(NAND_ECC_DEBUG)
- if((gxbRestoreBlkNum || (gxwTimeToScanPM > SCAN_PM_DURATION)) &&
- (gfChangeMusic)&&gfMLCMode) //Nick061204
- #else
- if((gxbRestoreBlkNum || (gxwTimeToScanPM > SCAN_PM_DURATION)) &&
- (gfChangeMusic || gxbSysState==S_PE_PAUSE||gxbSysState==S_PE_WAIT)&&gfMLCMode) //Nick061204
- #endif
- {
- //LCD_CTRL_DIS(); //Walace061126#1
- gxbModuleState=bState;
- //Nick061204 start
- if(gxwTimeToScanPM > SCAN_PM_DURATION)
- gxbRestoreCMD |= PM_SCAN;
- else
- gxbRestoreCMD = FullStep;
- //Nick061204 end
- if( !( (bState==MODULE_DVR)||(bState==MODULE_PLAY)))
- KeepMemory(KEEP_MEMORY) ;
- LoadProgram(PM_PLAY_DATA_RTN_RESTORE, BASIC_CODE_ONLY);
- }
- //Nick061120 end //NandRestore end
- }
- #endif
- //
- //vicky070424#1 start
- #if(_PM_PLAY_PRC_|(_PM_MENU_==1) )
- //Vicky060303#1 //Vicky060303#2 Update
- void PeSetPlaybackRate(BYTE bRate) //Renshuo050217#A
- {
- WORD wDspVal;
- //DetermineDspClock(); //determine DSP clock by global setting
- DetermineDspClock(bRate, gxw3DMode);
- switch(gxbMusicType&M_MAIN_TYPE)
- {
- case M_MP3:
- case M_MP2:
- case M_MP1: //Vicky051028#1
- case M_WAV:
- case M_AAC: //David050612#3
- SetSysSpeed(SYS_SPEED_NORMAL); //Nick060629#1
- switch(bRate)
- {
- case 0: // 1.00X
- wDspVal =PLAY_RATE_100;
- break;
- case 1: // 1.14X
- wDspVal = PLAY_RATE_114;
- break;
- case 2: // 1.33X
- wDspVal = PLAY_RATE_133;
- SetSysSpeed(0x06);//Nick060629#1 speed up MCU to fill in-buffer for high bit rate PCM
- break;
- case 3: // 0.67X
- wDspVal = PLAY_RATE_067;
- break;
- case 4: // 0.80X
- wDspVal = PLAY_RATE_080;
- break;
- //vick070424#1
- case 5:
- wDspVal=PLAY_RATE_050;
- case 6:
- wDspVal=PLAY_RATE_060;
- break;
- case 7:
- wDspVal=PLAY_RATE_070;
- break;
- case 8:
- wDspVal=PLAY_RATE_090;
- break;
- case 9:
- wDspVal=PLAY_RATE_120;
- break;
- case 10:
- wDspVal=PLAY_RATE_140;
- SetSysSpeed(0x06);//Nick060629#1 speed up MCU to fill in-buffer for high bit rate PCM
- break;
- case 11:
- wDspVal=PLAY_RATE_160;
- SetSysSpeed(0x06);//Nick060629#1 speed up MCU to fill in-buffer for high bit rate PCM
- break;
- //End
- }
- IdmaPioDmxW(&wDspVal,0x1fe6,1,DSP_W16);
- break;
- }
- return;
- }
- #endif
- #if(_PM_PLAY_|_PM_SLS_)
- //Renshuo050217#A start //Vicky060303#1 updated : Add two Arguments
- /*--------------------------------------------------------------------------
- Description:
- Because DSP clock is determined by user setting, music type....,
- a function is created to handle it (according to global variable setting).
- Arguments:
- Global arguments:
- Returns:
- --------------------------------------------------------------------------*/
- void DetermineDspClock(XBYTE bPlayRate,XWORD w3DMode ) //Walace061228#CodeSize
- {
- obCLKDSPDIVF = 0x02;
- switch(gxbMusicType&M_MAIN_TYPE) //Vicky051028#1
- {
- case M_WMA_UNKNOWN:
- case M_WMA_1:
- case M_WMA_2:
- case M_WMA_3:
- case M_WMA_4:
- case M_WMA_5:
- case M_WMA_6:
- //Vicky051209#1
- #if(ENABLE_FLUSH)
- if(gxbDSPFlush&FLUSH_FLAG)// if(gfNeedFlush)
- obCLKDSPDIVF = FLUSH_DSPCLK;
- #endif
- //End
- //David051207 Start
- if(gxwSampleRate>=44100)
- obCLKDSPDIVF = 0x01;
- //End
- if(w3DMode == SOUND_3D_ON)
- {
- if(gxwSampleRate > 16000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
- obCLKDSPDIVF = 0x01;
- if( (gfDrm) && (gxwSampleRate==44100) && (gxwByteRate>=2000) ) //Vicky060601#1
- obCLKDSPDIVF = 0x00;
- }
- break;
- case M_MP3:
- case M_MP2:
- case M_MP1:
- //For Power Consumption, Speed down DSP Clk //Vicky070313
- if( (gxwByteRate<=1600) && (w3DMode !=SOUND_3D_ON) ) // 128Kbps(=128/8*100)
- {
- obCLKDSPDIVF = 0x03; //vicky070426#1
- }
- //end
- switch(bPlayRate)
- {
- case 1: // 1.14 X
- case 2: // 1.33 X
- case 4: //0.8 x
- //vicky070424#1
- case 8: //0.9x
- case 9: // 1.2x
- case 10: // 1.4x
- case 11: // 1.6x
- //End
- if(gxwSampleRate > 16000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
- obCLKDSPDIVF = 0x01;
- //Vicky060106#1
- if(
- ( (gxwByteRate>=2000)|| (gxbMusicFeature&MF_VBR) ) //Vicky060627#1 fix noise (3D on + Playrate+>=160Kbps(=160/8*100) )
- && (gxwSampleRate >= 44100)
- //&&(w3DMode == SOUND_3D_ON)
- //&& (bPlayRate >= 2) //Vicky060303#1
- )
- obCLKDSPDIVF=0x00; //48Khz:73Mhz,,44.1Khz:67Mhz
- //End
- break;
- }
- //Vicky060630#1
- if((gxwSampleRate >= 44100)&& (gxwByteRate>=4000)) //More than 44.1Khz and 320Kbps
- obCLKDSPDIVF = 0x00;
- break;
- case M_WAV: //Vicky050527
- if(gxwSampleRate > 24000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
- obCLKDSPDIVF = 0x02; //vicky050606#1
- else
- obCLKDSPDIVF = 0x06; // divide 8 //147(135)/8=18.375(16.875)Mhz
- //Vicky060428
- if(w3DMode == SOUND_3D_ON)
- {
- if(gxwSampleRate > 16000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
- obCLKDSPDIVF = 0x01;
- }
- switch(bPlayRate)
- {
- case 1: // 1.14 X
- case 2: // 1.33 X
- case 4: //0.8 x
- //vicky070424#1
- case 8: //0.9x
- case 9: // 1.2x
- case 10: // 1.4x
- case 11: // 1.6x
- //End
- obCLKDSPDIVF = 0x01;
- if(gxwSampleRate > 16000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
- obCLKDSPDIVF=0x00; //48Khz:73Mhz,,44.1Khz:67Mhz
- break;
- }
- break;
- }
- }
- //Renshuo050217#A end
- #endif
- //vicky070424#1 end