UiPlayMenu.c
上传用户:hjhsjcl
上传日期:2020-09-25
资源大小:11378k
文件大小:23k
源码类别:

压缩解压

开发平台:

C++ Builder

  1. /*==========================================================================
  2. Copyright (c) 2004 ALi Corporation. All Rights Reserved
  3. File: UiPlayMenu.c
  4. content: music menu in playback module
  5. History: Created by TNE 2005/6/6
  6. ==========================================================================*/
  7. #define _UI_MENU_H_
  8. #include <DP8051XP.H>
  9. #include "TypeDef.h"
  10. #include "Const.h"
  11. #include "Reg5661.h"
  12. #include "Common.h"
  13. #include "UiCommon.h"
  14. #include "SysStrDef.h"
  15. #include "UiSysStr.h"
  16. #include "OledString.h"
  17. #include "Key.h"
  18. #include "SaveSetting.h"
  19. #include "Playback.h"
  20. #include "NandFlash.h"
  21. #include "Idma.h"
  22. #include "FileSystem.h"
  23. #include "ExtCodec.h"
  24. #include "IntCodec.h"
  25. #include "UiPlayCommon.h"
  26. #include "UiFileList.h"
  27. #include "UiPlayMenu.h"
  28. #include "ClassDataBase.h"
  29. #include "IconDefine.h"
  30. #include "OLED.h"
  31. void UiErrHandle(void) large;
  32. void UiEnterMenuItem(void) large;
  33. void UiBackMenuItem(void) large;
  34. void UiMusicMenuEnter(void) large;
  35. void UiRepeatMenuEnter(void) large;
  36. void UiEqMenuEnter(void) large;
  37. void Ui3DMenuEnter(void) large;
  38. void UiPlayRateMenuEnter(void) large;
  39. void UiId3TagMenuEnter(void) large;
  40. void UiIntroMenuEnter(void) large;
  41. void UiDrawIntro(void) large;
  42. void UiResumeMenuEnter(void) large;
  43. void UiWorkBackMenu(void) large;
  44. void UiUserEqMenuEnter(void) large;
  45. void UiPlayGoFileList(void);
  46. void UiPlayMenuDispCtrl(BYTE gxbPeDispCmd);  //Walace060606#PlayProcess
  47. code CWORD *pcbMenuListStr[]=
  48. {
  49. cwStringMusicList,
  50. cwStringRepeatList,
  51. cwStringEQList,
  52. cwStringOffOnList,
  53. cwStringPlaybackRateList,
  54. 0, //File List, Dummy //tne 2007/01/06 #1
  55. //0, //Class List, Dummy //tne 2007/01/24 #2
  56. cwStringSlideList, //Walace060220#1 //tne 2007/01/06 #1
  57. 0, //User EQ, Dummy
  58. };
  59. CBYTE cbMenuMaxItemNum[]=
  60. {
  61. MENU_MUSIC_MAX_ITEM_NUM,
  62. MENU_REPEAT_MAX_ITEM_NUM,
  63. MENU_EQ_MAX_ITEM_NUM,
  64. MENU_3D_MAX_ITEM_NUM,
  65. MENU_PLAY_RATE_MAX_ITEM_NUM,
  66. 0, //File List, Dummy //tne 2007/01/06 #1
  67. // 0, //Class List, Dummy //tne 2007/01/24 #2
  68. //MENU_INTRO_MAX_ITEM_NUM, //tne 2007/01/06 #1
  69. MENU_SLIDE_SHOW_ITEM_NUM,
  70. MENU_USER_EQ_MAX_ITEM_NUM,
  71. };
  72. CBYTE cbMenuTitleStr[]=
  73. {
  74. SYS_STR_MENU,
  75. SYS_STR_MENU_REPEAT,
  76. SYS_STR_SMP_TITLE_EQ,
  77. SYS_STR_MENU_3D,
  78. SYS_STR_SMP_TITLE_PRATE,
  79. SYS_STR_SEL_FILE_BROWSE, //tne 2007/01/06 #1
  80.        //SYS_STR_SEL_CLASSIFICATION, //tne 2007/01/24 #2
  81. //SYS_STR_MENU_INTRO, //tne 2007/01/06 #1
  82. SYS_STR_SMP_TITLE_SSHOW,
  83. SYS_STR_MENU_EQ_CUSTOM
  84. };
  85. CBYTE cbSlsTimeTable[]={0,5,10,15,30,60};
  86. //#endif //tne 2006/01/16
  87. ////////////////////////////////////////////////////////////////////////////////////
  88. /////////////////////////////////  Ui Header End ///////////////////////////////////
  89. ////////////////////////////////////////////////////////////////////////////////////
  90. void main(void)
  91. {
  92. BYTE bKey,bPeCommand;
  93. //Walace060607#1 PlayProcess
  94. if((gxbModuleState&MODULE_SUB)==MODULE_PRC_EOF_CTRL||
  95. (gxbModuleState&MODULE_SUB)==MODULE_NAND_RTN_RESOTRE) //NandRestore
  96. KeepMemory(RESTORE_MEMORY);
  97. EA = 1;
  98. ET0=1;
  99. #if(ICE_REAL_MODE) //vicky061001#2 Debug Play
  100. EnableTimer0();
  101. IE=0x83;
  102. #endif
  103. bKey=KEY_INVALID;
  104. bPeCommand=P_NOP;
  105. //gxbMenuDispLine=0; //tne 2007/01/06 #1      // Jeff070215#3
  106. //tne 2007/01/08 #1
  107. if(gxwTotalFileInAll>0)
  108. {
  109. //gpstFileIndex=&stUiFileListData;//Vicky050321#2 //tne 2005/11/21 #2
  110. //FsOpenFile(RELOAD_FILE_NAME); //stUiFileListData //tne 2005/11/21 #2
  111. gxwFileNumInFileList=gxwCurtFileInDir+gxwTotalDirInDir;
  112. }
  113. else
  114. {
  115. gxwFileNumInFileList=0;
  116. gxbLastErrCode=ERR_FS_NO_FILE_FOUND;
  117. }
  118. SetSysSpeed(0x08);
  119. #if(_PM_PLAY_)
  120. PeFillDspBuf() ;
  121. #endif
  122. if((gxbModuleState&MODULE_SUB)==MODULE_PRC_EOF_CTRL)
  123. {
  124. gxbModuleState=MODULE_PLAY_MENU;
  125. goto ERROR_HANDLE;
  126. }
  127.         //NandRestore start
  128. else if((gxbModuleState&MODULE_SUB)==MODULE_NAND_RTN_RESOTRE) //Nick061120
  129. {
  130. gxbModuleState=MODULE_PLAY_MENU;
  131. goto RETURN_FROM_NANDRESTORE;
  132.         }
  133. //NandRestore end
  134. else
  135. {
  136. gxbMenuDispLine=0; //tne 2007/01/06 #1      // Jeff070215#3
  137. }
  138. gxbModuleState=MODULE_PLAY_MENU;
  139. OLED_DISP_MASK_INIT(); //Walace070108#1
  140. //set default value
  141. gxfSourceUnicode=STRING_TYPE_ASCII;
  142. gxbCheckBattCounter=0;
  143. gxbBtyReTestNum=0;
  144. gxbBtyLowNum=0;
  145. gxbPwOffCounter=0;
  146. gpstFileIndex=&stFsFileInf;
  147. #if(UI_PLAY_USER_EQ_EDIT)
  148. gxbSelUserDefEq=5;
  149. #endif
  150. #if(SYS_USE_KEY_HOLD)
  151. gfLastKeyLocked=KEY_UNLOCK;
  152. #endif
  153. UiFileListFileType=UI_FILE_LIST_PLAYBACK;
  154. gfPwOffStop=FALSE;
  155. gxbLcdLimitCol=MAX_COLNUM; //tne lcd scroll2
  156. gbKeyCnt=0; // Larry070310#4
  157. #if(UI_USE_CHK_CARD)
  158. if(gxbStorage!=STOR_NAND)
  159. UiCheckCardRemoved();
  160. #endif
  161. UiDrawBasicMusicMenu();
  162. UiShowMusicMenuText();
  163. goto ERROR_HANDLE;
  164. while(1)
  165. {
  166. KeyGet(bKey);
  167. UiCheckBackLight(bKey);
  168. UiNormalCheck();
  169. #if(USE_LYRIC_DISPLAY)
  170. UiPlayLyricControl();
  171. #endif
  172. bPeCommand=P_NOP;
  173. #if(!EXT_ADC | !EXT_DAC | !EXT_PA)
  174. if(gxbMusicProcState==MUSIC_PROC_BODY) //Renshuo050603#A
  175. {   
  176. //IntCdcSetPaGainTask(FALSE); //Renshuo041203#A //Ren050312#1
  177. CdcSetPaGainTask(PA_TASK_UNIMMEDIATE|PA_TASK_DELAY);  //Walace060525#4 //tne 2006/12/26 #1
  178. }
  179. #endif
  180. switch(bKey)
  181. {
  182. case KEY_LEFT_LONG:
  183. case KEY_LEFT_BREAK:
  184. if(bKey==KEY_LEFT_LONG&&gbKeyCnt!=2)// Larry070310#4START
  185. {
  186. gbKeyCnt++;
  187. break;
  188. }// Larry070310#4END
  189. UiPrevMenuItem();
  190. gbKeyCnt=0;// Larry070310#4
  191. break;
  192. case KEY_RIGHT_LONG:
  193. case KEY_RIGHT_BREAK:
  194. if(bKey==KEY_RIGHT_LONG&&gbKeyCnt!=2)// Larry070310#4START
  195. {
  196. gbKeyCnt++;
  197. break;
  198. }// Larry070310#4END
  199. UiNextMenuItem();
  200. gbKeyCnt=0;// Larry070310#4
  201. break;
  202. #if(UI_PLAY_USER_EQ_EDIT)
  203. //tne 2007/01/06 #1 start
  204. #if(FIVEKEY)
  205. case KEY_VOL_BREAK:
  206. #else
  207. case KEY_REC_BREAK:
  208. #endif
  209. if(gxbUiMenuMainStates==UI_USER_EQ_MENU)
  210. {
  211. gfUserEqStartEdit = (!gfUserEqStartEdit);
  212. UiShowUDefEqSel();
  213. }
  214. break;
  215. /*
  216. case KEY_VOL_UP_LONG:
  217. case KEY_VOL_UP_BREAK:
  218. if(gxbUiMenuMainStates==UI_USER_EQ_MENU)
  219. {
  220. if(gxbSelUserDefEq==5)
  221. UiEditUdefEq(UI_EDIT_ALL_EQ_UP);
  222. else
  223. UiEditUdefEq(UI_EDIT_EQ_UP);
  224. }
  225. break;
  226. case KEY_VOL_DOWN_LONG:
  227. case KEY_VOL_DOWN_BREAK:
  228. if(gxbUiMenuMainStates==UI_USER_EQ_MENU)
  229. {
  230. if(gxbSelUserDefEq==5)
  231. UiEditUdefEq(UI_EDIT_ALL_EQ_DOWN);
  232. else
  233. UiEditUdefEq(UI_EDIT_EQ_DOWN);
  234. }
  235. break;
  236. */
  237. #endif
  238. case KEY_UP_BREAK:
  239. UiEnterMenuItem();
  240.   break;
  241. case KEY_FUNC_BREAK:
  242. case KEY_MODE_BREAK:
  243. UiBackMenuItem();
  244. break;
  245. }
  246. #if(PLAY_ERR_THEN_NEXT_MUSIC) //Walace061024#2
  247. EOF_CTRL_PROC:
  248. #endif
  249. //End of file control
  250. #include "EOF_Ctrl.h"
  251. gpstFileIndex=&stFsFileInf; //Vicky050321#2
  252. PlayEngine(bPeCommand);
  253. ERROR_HANDLE:
  254. if(gxbErrCode!=ERR_NO_ERROR)
  255. {
  256. #if(PLAY_ERR_THEN_NEXT_MUSIC) //Walace061024#2
  257. if(gxbErrCode==ERR_PE_UNSUPPORT_FORMAT||gxbErrCode==ERR_PE_NO_AUTHORITY)
  258. {
  259. bPeCommand=P_NEXT; 
  260. gxbErrCode = ERR_NO_ERROR;
  261. goto EOF_CTRL_PROC;
  262. }
  263. else
  264. {
  265. PlayEngine(P_STOP); //Walace061024#2  
  266. }
  267. #else
  268. PlayEngine(P_STOP); //Walace061024#2 
  269. #endif
  270. }
  271.    
  272. UiPlayMenuDispCtrl(gxbPeDispCmd);
  273. gxbPeDispCmd=UI_PE_NOP;           
  274. #if(1)
  275. //vicky070105#3 remove to function
  276. #if(_PM_DVR_)
  277. UiCheckNandRestore(MODULE_DVR_MENU);
  278. #else
  279. UiCheckNandRestore(MODULE_PLAY_MENU);
  280. #endif
  281. #else
  282. //Nick061120 start //NandRestore start
  283. if((gxbRestoreBlkNum || (gxwTimeToScanPM > SCAN_PM_DURATION)) && 
  284. (gfChangeMusic || gxbSysState==S_PE_PAUSE||gxbSysState==S_PE_WAIT)&&gfMLCMode) //Nick061204
  285. {
  286. //LCD_CTRL_DIS(); //Walace061126#1
  287. #if(_PM_DVR_)
  288. gxbModuleState=MODULE_DVR_MENU;
  289. #else
  290. gxbModuleState=MODULE_PLAY_MENU;
  291. #endif
  292. //Nick061204 start
  293. if(gxwTimeToScanPM > SCAN_PM_DURATION)
  294. gxbRestoreCMD |= PM_SCAN;
  295. else
  296. gxbRestoreCMD = FullStep;
  297. //Nick061204 end
  298. KeepMemory(KEEP_MEMORY) ;
  299. LoadProgram(PM_PLAY_DATA_RTN_RESTORE, BASIC_CODE_ONLY);
  300. }
  301. #endif
  302. RETURN_FROM_NANDRESTORE:
  303. //Nick061120 end //NandRestore end
  304. if(gfChangeMusic)
  305. {
  306. gxdwLastFileSize=0;
  307. if( (gxbIntroMode) && (gfIntroPlaying!=INTRO_PLAY) )
  308. {
  309. UiGoIntroMode();
  310. UiGoNoMenu();
  311. }
  312. gfChangeMusic=FALSE;
  313. }
  314. }
  315. }
  316. API void UiFsDispCtrl(BYTE bStatus) large //tne play 320 music
  317. {
  318. switch(bStatus)
  319. {
  320. default:
  321. case UI_FS_OPENING_FILE:
  322. //PeFillDspBuf(); //not need
  323. break;
  324. }
  325. }
  326. //Walace060606#1 PlayProcess start
  327. API void UiPlayMenuDispCtrl(BYTE bStatus)
  328. {
  329. bStatus=bStatus; //tne 2007/01/14 #3
  330. #if(USE_ERR_MSG_DISPLAY)
  331. if(gxbErrCode!=ERR_NO_ERROR)
  332. {
  333. UiErrHandle();
  334. return;
  335. }
  336. #endif
  337. }
  338. //Walace060606#1 PlayProcess end
  339. #if(0) //Walace060606#1 PlayProcess
  340. API void UiDispCtrl(BYTE bStatus)
  341. {
  342. // #if(!_PM_DVR_) //tne 2006/01/16
  343. WORD wDspVal=gxbUiMenuSubStates;
  344. //#endif  //tne 2006/01/16
  345. #if(USE_ERR_MSG_DISPLAY)
  346. if(gxbErrCode!=ERR_NO_ERROR)
  347. {
  348. UiErrHandle();
  349. return;
  350. }
  351. #endif
  352. if(bStatus==UI_PE_START_END)
  353. {
  354. gxbLastErrCode=ERR_NO_ERROR;
  355. //UiCountCurtFileNum(&stUiFileListData,&stFsFileInf);
  356. //Walace060127#2 start
  357. /*
  358. #if(!UI_EQ_CUSTOM)                                         //  Jeff_051116
  359. IdmaPioDmxW(&gxwEqMode,DSP_EQ_ADDR,1,DSP_W16);
  360. #else
  361. UiSetEqGain();
  362. #endif
  363. //chun_chi 060105
  364. #if(UI_USE_USER_EQ)
  365. if(gxwEqMode==EQ_USER)
  366. UiSetEqGain(EQ_USER);
  367. #endif
  368. IdmaPioDmxW(&gxw3DMode,DSP_3D_ADDR,1,DSP_W16);
  369.               */
  370.               IdmaPioDmxW(&gxw3DMode,DSP_3D_ADDR,1,DSP_W16);
  371. if((gxbUiMenuMainStates!=UI_EQ_MENU)||(gxbUiMenuMainStates!=UI_USER_EQ_MENU)) //Walace060402#1
  372.               UiSetEqGain(gxwEqMode);
  373.               //Walace060127#2 end
  374.               
  375. #if(USE_LYRIC_DISPLAY)
  376. gxbLcdLyricStatus=LCD_LYRIC_SCROLL_DONE; // set done to show first lyric
  377. gxbLastLyrcBuf[1]=0; //tne 2005/08/11
  378. #endif
  379. switch(gxbUiMenuMainStates)
  380. {
  381. //#if(!_PM_DVR_) //tne 2006/01/16
  382. case UI_EQ_MENU: //Walace060402#1
  383. case UI_USER_EQ_MENU:  //Walace060402#1
  384. //Walace060127#2 start
  385. /*
  386. #if(!UI_EQ_CUSTOM)                                         //  Jeff_051116
  387. IdmaPioDmxW(&gxwEqMode,DSP_EQ_ADDR,1,DSP_W16);
  388. #else
  389. UiSetEqGain();
  390. #endif
  391. //chun_chi 060105
  392. #if(UI_USE_USER_EQ)
  393. if(gxwEqMode==EQ_USER)
  394. UiSetEqGain(EQ_USER);
  395. #endif
  396. IdmaPioDmxW(&gxw3DMode,DSP_3D_ADDR,1,DSP_W16);
  397.               */               
  398.               UiSetEqGain(wDspVal);
  399.               //Walace060127#2 end
  400. break;
  401.   
  402. case UI_3D_MENU:
  403. //Vicky060303#1
  404. DetermineDspClock(gxbPlaybackRate, wDspVal);
  405. IdmaPioDmxW(&wDspVal,DSP_3D_ADDR,1,DSP_W16);
  406. /*
  407. //Vicky060106#1
  408. if(gxwSampleRate > 24000) //for low Fs, don't raise clk, or DSP<->CODEC will halt //Renshuo050218#Y
  409. obCLKDSPDIVF = 0x01; //raise DSP clock
  410. if( 
  411.   (gxbPlaybackRate == 2)
  412. &&((gxbMusicType&M_MAIN_TYPE) == M_MP3)
  413. &&( ((gxwByteRate*2/25)>160) || (gxbMusicFeature&MF_VBR) )
  414. &&  (gxwSampleRate >= 44100)
  415. //&&(gxw3DMode == SOUND_3D_ON)
  416. )
  417. obCLKDSPDIVF=0x00; //48Khz:73Mhz,,44.1Khz:67Mhz
  418. //End
  419. */
  420. /* //Walace060317#3
  421. #if(UI_USE_USER_EQ)
  422. UiSetEqGain(EQ_USER);
  423. #endif
  424. */
  425. break;
  426. //#endif //tne 2006/01/16
  427. case UI_PLAYBACK_RATE_MENU:
  428. PeSetPlaybackRate(gxbUiMenuSubStates);
  429. break;
  430. }
  431. #if(!_PM_DVR_)
  432. UiCheckTag(); //tne 2005/11/07
  433. #endif
  434. gxwCurrentPlayTime=0; //set 0 for intro mode
  435. // gxdwCurrentLrcTime=0; //tne 2006/02/10 #1 //Walace060226#Remove
  436. gfFillDspBufEn=TRUE;
  437. }
  438. else if(bStatus==UI_PE_START_START) //tne 2005/08/10
  439. {
  440. LoadExtendMemCode();
  441. gfFillDspBufEn=FALSE;
  442. UiCountCurtFileNum(&stUiFileListData,&stFsFileInf);
  443. #if(UI_DISP_DIR_NAME)
  444. UiGetCurtDirName();
  445. #endif
  446. }
  447. else if(bStatus==UI_PE_STOP)
  448. {
  449. if(!gfPwOffStop) //tne 2005/11/21 #2
  450. {
  451. UiRndPlayInit();
  452. gxwCurrentPlayTime=0;
  453. // gxdwCurrentLrcTime=0; //tne 2006/02/10 #1 //Walace060226#Remove
  454. }
  455. }
  456. }
  457. #endif
  458. void UiErrHandle(void) large
  459. {
  460. #if(USE_ERR_MSG_DISPLAY)
  461. if(gxbErrCode!=ERR_NO_ERROR)
  462. gxbLastErrCode=gxbErrCode;
  463. #endif
  464. }
  465. //tne 2007/01/06 #1 move to UiPlayCommon.c
  466. //void UiShowMusicMenuText(void) large
  467. //function modify by tne 2007/01/06 #1
  468. void UiEnterMenuItem(void) large
  469. {
  470. switch(gxbUiMenuMainStates)
  471. {
  472. case UI_MUSIC_MENU:
  473. UiMusicMenuEnter();
  474. break;
  475. case UI_REPEAT_MENU:
  476. UiRepeatMenuEnter();
  477. gxbUiMenuMainStates=UI_MUSIC_MENU;
  478. gxbUiMenuSubStates=UI_MUSIC_REPEAT_MENU;
  479. break;
  480. // #if(!_PM_DVR_) //tne 2006/01/16
  481. case UI_EQ_MENU:
  482. UiEqMenuEnter();
  483. if(gxbUiMenuMainStates!=UI_USER_EQ_MENU)
  484. {
  485. gxbUiMenuMainStates=UI_MUSIC_MENU;
  486. gxbUiMenuSubStates=UI_MUSIC_EQ_MENU;
  487. }
  488. break;
  489. #if(UI_PLAY_USER_EQ_EDIT)
  490. case UI_USER_EQ_MENU:
  491. UiUserEqMenuEnter();
  492. gxbUiMenuMainStates=UI_MUSIC_MENU;
  493. gxbUiMenuSubStates=UI_MUSIC_EQ_MENU;
  494. UiDrawBasicMusicMenu();
  495. UiShowMusicMenuText();
  496. break;
  497. #endif
  498. case UI_3D_MENU:
  499. Ui3DMenuEnter();
  500. gxbUiMenuMainStates=UI_MUSIC_MENU;
  501. gxbUiMenuSubStates=UI_MUSIC_3D_MENU;
  502. break;
  503. // #endif //tne 2006/01/16
  504. /* //tne 2007/01/06 #1
  505. case UI_INTRO_MENU:           
  506. UiIntroMenuEnter();
  507. break;
  508. */
  509. case UI_PLAYBACK_RATE_MENU:
  510. UiPlayRateMenuEnter();
  511. gxbUiMenuMainStates=UI_MUSIC_MENU;
  512. gxbUiMenuSubStates=UI_MUSIC_PLAYBACK_RATE_MENU;
  513. break;
  514. #if(!_PM_DVR_)
  515. case UI_SLIDE_SHOW:
  516. //UiSlideShowMenuEnter();
  517. //gfSlideShow=(BOOL)gxbUiMenuSubStates; //Walace060220#1 
  518. gxbSlideShowSet=cbSlsTimeTable[gxbUiMenuSubStates]; //Walace060220#1 start //tne 2007/01/06 #1
  519. gxbUiMenuMainStates=UI_MUSIC_MENU;
  520. gxbUiMenuSubStates=UI_MUSIC_SLIDE_SHOW;
  521. break;
  522. #endif
  523. }
  524. UiShowMusicMenuText();
  525. //UiGoNoMenu();
  526. }
  527. void UiBackMenuItem(void) large
  528. {
  529. UiWorkBackMenu();
  530.     
  531. #if(UI_PLAY_USER_EQ_EDIT)
  532. if(gxbUiMenuMainStates==UI_USER_EQ_MENU)
  533. gxbUiMenuMainStates=UI_EQ_MENU;
  534. else
  535. #endif
  536. gxbUiMenuMainStates=UI_MUSIC_MENU;
  537. UiShowMusicMenuText();
  538. }
  539. void UiWorkBackMenu(void) large
  540. {
  541. #if(UI_PLAY_USER_EQ_EDIT)
  542. BYTE bI;
  543. #endif
  544. switch(gxbUiMenuMainStates)
  545. {
  546. case UI_MUSIC_MENU:
  547. UiGoNoMenu();
  548. break;
  549. case UI_REPEAT_MENU:
  550. gxbUiMenuSubStates=UI_MUSIC_REPEAT_MENU;
  551. break;
  552. //#if(!_PM_DVR_) //tne 2006/01/16
  553. case UI_EQ_MENU:
  554. gxbUiMenuSubStates=UI_MUSIC_EQ_MENU; //tne 2006/01/14 #3
  555. //Walace060127#2 start
  556. /*
  557. #if(!UI_EQ_CUSTOM)                                         //  Jeff_051116
  558. IdmaPioDmxW(&gxwEqMode,DSP_EQ_ADDR,1,DSP_W16);
  559. #else
  560. UiSetEqGain();
  561. #endif
  562. //chun_chi 060105
  563. #if(UI_USE_USER_EQ)
  564. if(gxwEqMode==EQ_USER)
  565. UiSetEqGain(EQ_USER);
  566. #endif
  567.               */
  568.               UiSetEqGain(gxwEqMode);
  569.               //Walace060127#2 end
  570. break;
  571. #if(UI_PLAY_USER_EQ_EDIT)
  572. case UI_USER_EQ_MENU:
  573. UiDrawBasicMusicMenu();
  574. gxbUiMenuSubStates=EQ_USER;
  575. //restore old user def eq value
  576. for(bI=0;bI<=5;bI++)
  577. gxbUserDefEq[bI]=gxbOldUserDefEq[bI];
  578. UiSetEqGain(EQ_USER);
  579. break;
  580. #endif
  581. case UI_3D_MENU:
  582. gxbUiMenuSubStates=UI_MUSIC_3D_MENU;
  583. DetermineDspClock(gxbPlaybackRate, gxw3DMode); //Vicky060303#1
  584. IdmaPioDmxW(&gxw3DMode,DSP_3D_ADDR,1,DSP_W16);
  585. break;
  586. //#endif //tne 2006/01/16
  587. /* tne 2007/01/06 #1
  588. case UI_INTRO_MENU:
  589. UiDrawBasicMusicMenu();
  590. gxbUiMenuSubStates=UI_MUSIC_INTRO_MENU;
  591. #if(MAX_VOL_OUTPUT_POWER_TUNE) //Walace060301
  592. obDCVARRD = 0x09;
  593. obDCVWRDATA=0x00;
  594. #endif
  595. break;
  596. */
  597. case UI_SLIDE_SHOW: //Walace060220#1
  598. UiDrawBasicMusicMenu();
  599. gxbUiMenuSubStates=UI_MUSIC_SLIDE_SHOW;
  600. break;
  601. case UI_PLAYBACK_RATE_MENU:
  602. gxbUiMenuSubStates=UI_MUSIC_PLAYBACK_RATE_MENU;
  603. PeSetPlaybackRate(gxbPlaybackRate);
  604. break;
  605. }
  606. }
  607. void UiMusicMenuEnter(void) large
  608. {
  609. switch(gxbUiMenuSubStates)
  610. {
  611. case UI_MUSIC_REPEAT_MENU:
  612. gxbUiMenuMainStates=UI_REPEAT_MENU;
  613. gxbUiMenuSubStates=gxbRepeatMode;
  614. if(!gfPlayAutoSearchFile) //dir repeat
  615. {
  616. switch(gxbRepeatMode)
  617. {
  618. case NO_REPEAT:
  619. gxbUiMenuSubStates=UI_REPEAT_DIR_MENU;
  620. break;
  621. case ALL_REPEAT:
  622. gxbUiMenuSubStates=UI_REPEAT_ALL_DIR_MENU;
  623. break;
  624. case RND_ALL_REPEAT:
  625. gxbUiMenuSubStates=UI_REPEAT_RND_ALL_DIR_MENU;
  626. break;
  627. }
  628. }
  629. break;
  630. //#if(!_PM_DVR_) //tne 2006/01/16
  631. case UI_MUSIC_EQ_MENU:
  632. gxbUiMenuMainStates=UI_EQ_MENU;
  633. gxbUiMenuSubStates=gxwEqMode;
  634. break;
  635. case UI_MUSIC_3D_MENU:
  636. gxbUiMenuMainStates=UI_3D_MENU;
  637. gxbUiMenuSubStates=gxw3DMode;
  638. break;
  639. //#endif //tne 2006/01/16
  640. /* tne 2007/01/06 #1 start
  641. case UI_MUSIC_INTRO_MENU:
  642. OledClearArea(14,LINE1,25,LINE1) ;
  643. UI_CLEAR_MENU_TAG_AREA(); 
  644.        OledClearArea(SEG2,LINE0,OLED_MAX_COL-WORD2,LINE1) ; //Walace060220#1
  645. StrShowSysString(SYS_STR_MENU_INTRO,SEG2,PAGE0);
  646. gxbUiMenuMainStates=UI_INTRO_MENU;
  647. gxbUiMenuSubStates=gxbIntroMode;
  648. break;
  649. */
  650. // case UI_MUSIC_ENTER_CLIST_MENU: //tne 2007/01/24 #2
  651. case UI_MUSIC_ENTER_FLIST_MENU:
  652. if((!gbFsUnableUse)&&(gxbLastErrCode!=ERR_FS_NO_FILE_FOUND))
  653. UiPlayGoFileList();
  654. break;
  655. case UI_MUSIC_PLAYBACK_RATE_MENU:
  656. gxbUiMenuMainStates=UI_PLAYBACK_RATE_MENU;
  657. gxbUiMenuSubStates=gxbPlaybackRate;
  658. break;
  659.         #if((!_PM_DVR_)&UI_USE_SLIDE_SHOW)
  660. case UI_MUSIC_SLIDE_SHOW: //Walace060220#1
  661. /* //tne 2007/01/06 #1
  662. OledClearArea(14,LINE1,25,LINE1) ;
  663. UI_CLEAR_MENU_TAG_AREA();
  664.        OledClearArea(SEG2,LINE0,OLED_MAX_COL-WORD2,LINE1) ;
  665. StrShowSysString(SYS_STR_MENU_SLIDE,SEG2,PAGE0);
  666. */
  667. gxbUiMenuMainStates=UI_SLIDE_SHOW;
  668. //tne 2007/01/06 #1
  669. for(gxbUiMenuSubStates=0;gxbUiMenuSubStates<MENU_SLIDE_SHOW_ITEM_NUM;gxbUiMenuSubStates++)
  670. {
  671. if(cbSlsTimeTable[gxbUiMenuSubStates]==gxbSlideShowSet)
  672. break;
  673. }
  674. break;
  675.         #endif
  676. }
  677. //UiShowMusicMenuText(); //tne 2007/01/07 #1
  678. }
  679. void UiRepeatMenuEnter(void) large
  680. {
  681. if(gxbUiMenuSubStates>=UI_REPEAT_DIR_MENU)
  682. {
  683. gfPlayAutoSearchFile=FALSE;
  684. switch(gxbUiMenuSubStates)
  685. {
  686. case UI_REPEAT_DIR_MENU:
  687. gxbRepeatMode=NO_REPEAT;  
  688. break;
  689. case UI_REPEAT_ALL_DIR_MENU:
  690. gxbRepeatMode=ALL_REPEAT;  
  691. break;
  692. case UI_REPEAT_RND_ALL_DIR_MENU:
  693. gxbRepeatMode=RND_ALL_REPEAT;
  694. break;
  695. }
  696. gxwNumTotalFiles=gxwTotalFileInDir; //=gxwTotalFileInClass
  697. gxwCurrentFileNum=gxwCurtFileInDir; //=gxwCurtFileInClass
  698. }
  699. else
  700. {
  701. gfPlayAutoSearchFile=TRUE;
  702.        gxbRepeatMode=gxbUiMenuSubStates;
  703. //UI for class
  704. if(gxbPlayClassMode==P_CLASS_MODE_FILE)
  705. gxwNumTotalFiles=gxwTotalFileInAll;
  706. else
  707. gxwNumTotalFiles=gxwTotalFileInAllClass;
  708. gxwCurrentFileNum=gxwCurtFileInAll; //gxwCurtFileInAllClass
  709. }
  710. #if(UI_USE_PLAY_LIST_EN)
  711. if((gxbRepeatMode==RND_ALL_REPEAT)||(gxbRepeatMode==RND_REPEAT))
  712. #else
  713. if(gxbRepeatMode>=RND_ALL_REPEAT)
  714. #endif
  715. UiRndPlayInit();
  716. }
  717. //#if(!_PM_DVR_) //tne 2006/01/16
  718. void UiEqMenuEnter(void) large
  719. {
  720. #if(UI_PLAY_USER_EQ_EDIT)
  721. WORD wI;
  722. if(gxbUiMenuSubStates==EQ_USER)
  723. {
  724. //enter user define EQ
  725. gxbUiMenuMainStates=UI_USER_EQ_MENU;
  726.           gxbUiMenuSubStates=gxbSelUserDefEq;
  727.               UiSetEqGain(EQ_USER);
  728. wI=EQ_USER;
  729. IdmaPioDmxW(&wI,DSP_EQ_ADDR,1,DSP_W16);
  730. //saev old user define eq value
  731. for(wI=0;wI<=5;wI++)
  732. gxbOldUserDefEq[wI]=gxbUserDefEq[wI];
  733. /* //tne 2007/01/06 #1 start
  734.               OLED_CLEAR_ALL();
  735. //OledShowIcon(ICON_LAB_MUSIC,SEG0,LINE0); //tne 2006/12/26 #2
  736. #if(SYS_USE_KEY_HOLD)//Nick061120
  737. //UiShowKeyHold(); //Walace060915#2 //tne 2006/12/26 #2
  738. #endif
  739.               StrShowSysString(SYS_STR_MENU_EQ_CUSTOM,LCD_AUTO_CENTER_COL,PAGE0);
  740. UiDrawUserDefEq();
  741. */
  742. gfUserEqStartEdit=FALSE;
  743. //tne 2007/01/06 #1 end
  744. }
  745. else
  746. #endif
  747. {
  748. gxwEqMode=gxbUiMenuSubStates;
  749. }
  750. }
  751. //#endif //tne 2006/01/16
  752. #if(UI_PLAY_USER_EQ_EDIT) //tne 2006/01/16
  753. void UiUserEqMenuEnter(void) large
  754. {
  755. gxwEqMode=EQ_USER;
  756. }
  757. #endif
  758. //#if(!_PM_DVR_) //tne 2006/01/16
  759. void Ui3DMenuEnter(void) large
  760. {
  761. gxw3DMode=gxbUiMenuSubStates;
  762. }
  763. //#endif //tne 2006/01/16
  764. /* //tne 2007/01/06 #1
  765. void UiIntroMenuEnter(void) large 
  766. {
  767.   gxbIntroMode=gxbUiMenuSubStates;
  768. if(gxbIntroMode==0)
  769. gfIntroPlaying=INTRO_NOP;
  770. else if( (gxbSysState==S_PE_STOP) || (gxbSysState==S_PE_WAIT) )
  771. gfIntroPlaying=INTRO_WAIT;
  772. #if(MAX_VOL_OUTPUT_POWER_TUNE) //Walace060301
  773. OledShowNumber(99,WORD0,LINE0,2);
  774. obDCVARRD = 0x09;
  775. obDCVWRDATA=0x00;
  776. #endif
  777. }
  778. */
  779. /* //tne 2007/01/06 #1
  780. void UiDrawIntro(void) large
  781. {
  782. #if(MAX_VOL_OUTPUT_POWER_TUNE)  //Walace060301
  783. BYTE bDelay;
  784. #endif
  785. CLEAR_MENU_NUM_AREA();
  786.   OledShowNumber(gxbUiMenuSubStates,18,PAGE3,2);
  787. #if(UI_USE_PROGRESS_BAR)
  788. ShowProgress(11,38,((WORD)gxbUiMenuSubStates*PROGRESS_MAX)/15);
  789. #endif
  790. #if(MAX_VOL_OUTPUT_POWER_TUNE) //Walace060301
  791. if(gxbUiMenuSubStates<=7)
  792. {
  793. OledShowNumber(gxbUiMenuSubStates,WORD0,LINE1,2);
  794. GPIOC_ON(2);
  795. obDCVARRD = 0x09;
  796. obDCVWRDATA=((gxbUiMenuSubStates<<4)|0x00);
  797. bDelay=80; //about 400us
  798. while(bDelay--){};
  799. GPIOC_OFF(2);
  800. }
  801. #endif
  802. }
  803. */
  804. void UiPlayRateMenuEnter(void) large
  805. {
  806. gxbPlaybackRate=gxbUiMenuSubStates;
  807. }
  808. #if(_PM_MENU_==1)
  809. void UiSelectItemControl(void) large
  810. {
  811. WORD wDspVal;
  812. wDspVal=gxbUiMenuSubStates;
  813. switch(gxbUiMenuMainStates)
  814. {
  815. //#if(!_PM_DVR_) //tne 2006/01/16
  816. case UI_EQ_MENU:
  817. //Walace060127#2 start
  818. /*
  819. #if(!UI_EQ_CUSTOM)                                         //  Jeff_051116
  820. IdmaPioDmxW(&gxwEqMode,DSP_EQ_ADDR,1,DSP_W16);
  821. #else
  822. UiSetEqGain();
  823. #endif
  824. //chun_chi 060105
  825. #if(UI_USE_USER_EQ)
  826. if(gxwEqMode==EQ_USER)
  827. UiSetEqGain(EQ_USER);
  828. #endif
  829. */
  830. UiSetEqGain(wDspVal);                              
  831.               //Walace060127#2 end
  832. break;
  833. case UI_USER_EQ_MENU:
  834. break;
  835. case UI_3D_MENU:
  836. //Vicky060303 Update#1
  837. DetermineDspClock(gxbPlaybackRate,wDspVal); //determine DSP clock by global setting
  838. IdmaPioDmxW(&wDspVal,DSP_3D_ADDR,1,DSP_W16);
  839. break;
  840. //#endif //tne 2006/01/16
  841. /* tne 2007/01/06 #1
  842. case UI_INTRO_MENU:
  843. //Intro control
  844. break;
  845. */
  846. case UI_PLAYBACK_RATE_MENU:
  847. PeSetPlaybackRate(gxbUiMenuSubStates);
  848. break;
  849. case UI_REPEAT_MENU:
  850. case UI_MUSIC_MENU:
  851. default:
  852. //do nothing
  853. break;
  854. }
  855. }
  856. #endif
  857. void UiGoNoMenu(void)
  858. {
  859. DetermineDspClock(gxbPlaybackRate,gxw3DMode); //Vicky060303#1
  860. PeFillDspBuf();
  861. //speed up to download code
  862. SetSysSpeed(0x02);
  863. gxbModuleState=MODULE_PLAY_MENU; //Walace060607#1 PlayProcess
  864. #if(_PM_DVR_)
  865. LoadProgram(PM_PLAY_DVR,BASIC_CODE_ONLY);
  866. #else
  867. LoadProgram(PM_PLAY_FAT_LARGE,BASIC_CODE_ONLY);
  868. #endif
  869. }
  870. //tne 2007/01/06 #1
  871. void UiPlayGoFileList(void)
  872. {
  873. PeFillDspBuf();
  874. SetSysSpeed(0x02);
  875. gxbModuleState=MODULE_PLAY_MENU; //Walace060607#1 PlayProcess
  876. #if(_PM_DVR_)
  877. LoadProgram(PM_DVR_FILE_LIST,BASIC_CODE_ONLY);
  878. #else
  879. //if(gxbPlayClassMode==P_CLASS_MODE_FILE)
  880. if(gxbUiMenuSubStates==UI_MUSIC_ENTER_FLIST_MENU) //tne 2007/01/24 #2
  881. LoadProgram(PM_PLAY_FILE_LIST,BASIC_CODE_ONLY);
  882. else
  883. LoadProgram(PM_CLASS_LIST,BASIC_CODE_ONLY);
  884. #endif
  885. }