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

📄 song_task.lst

📁 atmel at89c51snd1c mp3芯片方案源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
 273   5              //  case KEY_SOUND:
 274   5              //   song_snd_select();              /* select next sound control */
 275   5              //   print_sound();                  /* display selected sound icon */
 276   5              //    print_sound_level();            /* display new level */
 277   5              //    break;
 278   5      
 279   5                case KEY_REPEAT:
 280   5                  song_loop = ~song_loop;         /* display repeat or not */
 281   5                  print_repeat(song_loop);
 282   5                  break;
 283   5      
 284   5                case KEY_STOP:
 285   5                  song_stop();                    /* stop playing song */
 286   5                  Fclose();
 287   5                  song_state = SONG_STOP;
 288   5                  break;
 289   5      
 290   5        
 291   5      //          case KEY_FILE_SELECT:
 292   5      //            song_stop();                    /* stop playing song */
 293   5      //            Fclose();
 294   5      //                      File_entry_root(FILE_MP3 | FILE_DIR); /* goto root directory */
 295   5                 // print_file_name(); 
 296   5      //            song_state = SONG_FILE_SELECT;
 297   5      //            break;
 298   5      
 299   5                default:
 300   5                  break;
 301   5              }
 302   4              gl_key_press = FALSE;               /* ack key usage */
C51 COMPILER V7.50   SONG_TASK                                                             02/16/2009 09:59:55 PAGE 6   

 303   4            }
 304   3            break;
 305   3          }
 306   2      
 307   2          case SONG_PAUSE:                        /* one file openned */
 308   2          { 
 309   3                LED_GREEN = 1;
 310   3                LED_RED = 0;
 311   3            if (gl_key_press)                     /* a key is pressed? */
 312   3            {
 313   4              switch (gl_key)
 314   4              {
 315   5                case KEY_PLAY:
 316   5                  disp_clock_start();             /* restart clock timer */
 317   5                  Aud_song_play();                /* restart sample request */
 318   5                  print_state_play();             /* display play icon */
 319   5                  song_state = SONG_PLAY;
 320   5                  break;
 321   5      
 322   5                case KEY_NEXT:
 323   5                  song_pause();                   /* pause playing song */
 324   5                  Fclose();
 325   5                  loop = TRUE;                    /* keypad action so loop */
 326   5                  song_state = SONG_NEXT;
 327   5                  break;
 328   5      
 329   5                case KEY_PREV:
 330   5                  song_pause();                   /* pause playing song */
 331   5                  Fclose();
 332   5                  loop = TRUE;                    /* keypad action so loop */
 333   5                  song_state = SONG_PREV;
 334   5                  break;
 335   5      
 336   5                case KEY_INC:
 337   5                  song_snd_inc();                 /* increment selected control */
 338   5                  print_sound_level();            /* display new level */
 339   5                  break;
 340   5      
 341   5                case KEY_DEC:
 342   5                  song_snd_dec();                 /* decrement selected control */
 343   5                  print_sound_level();            /* display new level */
 344   5                  break;
 345   5      
 346   5              //  case KEY_SOUND:
 347   5              //    song_snd_select();              /* select next sound control */
 348   5              //    print_sound();                  /* display selected sound icon */
 349   5              //    print_sound_level();            /* display new level */
 350   5              //    break;
 351   5      
 352   5                case KEY_REPEAT:
 353   5                  song_loop = ~song_loop;         /* display repeat or not */
 354   5                  print_repeat(song_loop);
 355   5                  break;
 356   5      
 357   5                case KEY_STOP:
 358   5                  song_stop();                    /* stop playing song */
 359   5                  Fclose();
 360   5                  song_state = SONG_STOP;
 361   5                  break;
 362   5      
 363   5                default:
 364   5                  break;
C51 COMPILER V7.50   SONG_TASK                                                             02/16/2009 09:59:55 PAGE 7   

 365   5              }
 366   4              gl_key_press = FALSE;               /* ack key usage */
 367   4            }
 368   3            break;
 369   3          }
 370   2      
 371   2      
 372   2          case SONG_NEW:
 373   2          {
 374   3          #if PLAYER_PLAY_MODE == PLAY_DISK
 375   3            if (File_type() == FILE_DIR)
 376   3            {
 377   4              if (file_entry_dir(FILE_MP3 | FILE_DIR) == OK)
 378   4              { /* mp3 or dir in sub-dir */
 379   5                song_state = SONG_NEW;            /* stay in same state */
 380   5              }
 381   4              else
 382   4              { /* no mp3 or dir in sub-dir */
 383   5                song_state = SONG_NEXT;           /* select next */
 384   5              }
 385   4            }
 386   3            else
 387   3            { /* file is MP3 */
 388   4              song_state = SONG_INIT;             /* new song */
 389   4              // print_repeat(song_loop);
 390   4              //Mp3_set_right_vol(0);
 391   4              //Mp3_set_left_vol(0);
 392   4              print_file_name();                  /* display file name */
 393   4            }
 394   3            break;
 395   3          #else /* PLAYER_MODE == PLAY_DIR */
                    song_state = SONG_INIT;               /* new song */
                    print_repeat(song_loop);
                    //Mp3_set_right_vol(0);
                    //Mp3_set_left_vol(0);
                    print_file_name();                    /* display file name */
                    break;
                  #endif
 403   3          }
 404   2      
 405   2          case SONG_NEXT:
 406   2          {   
 407   3          //disp_name_stop();                     /* stop scrolling */
 408   3          #if PLAYER_PLAY_MODE == PLAY_DISK
 409   3            if (file_seek_next(FILE_MP3 | FILE_DIR, FALSE))/* next song or dir */
 410   3            { /* mp3 or dir selected */
 411   4              song_state = SONG_NEW;
 412   4            }
 413   3            else
 414   3            { /* at end of dir */
 415   4              if (File_goto_parent(FILE_MP3 | FILE_DIR) == OK)
 416   4              { /* parent exists, point on dir */
 417   5                song_state = SONG_NEXT;           /* next will select next file */
 418   5              }
 419   4              else
 420   4              { /* no parent: end of root dir */
 421   5                if (loop)
 422   5                {
 423   6                  song_state = SONG_NEW;
 424   6                }
 425   5                else
 426   5                {
C51 COMPILER V7.50   SONG_TASK                                                             02/16/2009 09:59:55 PAGE 8   

 427   6                  song_stop();
 428   6                  song_state = SONG_STOP;
 429   6                }
 430   5              }
 431   4            }
 432   3            break;
 433   3          #else /* PLAYER_MODE == PLAY_DIR */
                    if (file_seek_next(FILE_MP3, loop))   /* select next song */
                    { /* still some file to play */
                      song_state = SONG_NEW;
                    }
                    else
                    { /* end of dir: stop */
                      song_stop();
                      song_state = SONG_STOP;
                    }
                    break;
                  #endif
 445   3          }
 446   2      
 447   2          case SONG_PREV:
 448   2          {
 449   3                  //disp_name_stop();                     /* stop scrolling */
 450   3          #if PLAYER_PLAY_MODE == PLAY_DISK
 451   3                      while( song_state == SONG_PREV )
 452   3                      {       /* prev song or dir */
 453   4                    if( !file_seek_prev(FILE_MP3 | FILE_DIR, FALSE))
 454   4                    { /* No mp3 or dir selected, at beginning of dir */
 455   5                      if (File_goto_parent(FILE_MP3 | FILE_DIR) != OK)
 456   5                      { /* no parent: beginning of root dir */
 457   6                         if (loop)
 458   6                         {
 459   7                                       if(File_goto_last() != OK)    /* goto to the end of dir */
 460   7                                       {      /* error system */
 461   8                                  song_stop();
 462   8                                  song_state = SONG_STOP;
 463   8                                       }
 464   7                         }
 465   6                         else
 466   6                         { /* end of dir: stop */
 467   7                           song_stop();
 468   7                           song_state = SONG_STOP;
 469   7                         }
 470   6                       }
 471   5                               else
 472   5                               {
 473   6                                 continue;                                                                                    /* goto to previous file in dir parent */
 474   6                               }
 475   5                    }
 476   4      
 477   4                    while (File_type() == FILE_DIR)
 478   4                    { /* file found is directory -> enter directory and goto last file */
 479   5                           if (file_entry_dir(FILE_MP3 | FILE_DIR) == OK)
 480   5                       { /* mp3 or dir in sub-dir */
 481   6                                 if(File_goto_last() != OK)               /* goto to the end of dir */
 482   6                                 { /* error system */
 483   7                           song_stop();
 484   7                           song_state = SONG_STOP;
 485   7                                 }
 486   6                               }
 487   5                               else
 488   5                               {
C51 COMPILER V7.50   SONG_TASK                                                             02/16/2009 09:59:55 PAGE 9   

 489   6                                 break;                                       /* directory empty goto search previous file */
 490   6                               }
 491   5                         }
 492   4      
 493   4                         if (File_type() == FILE_MP3)
 494   4                { /* mp3 file -> stop research previous file */
 495   5                               song_state = SONG_NEW;
 496   5                        }
 497   4                                      /* HERE song_state == SONG_PREV, if select file is empty directory or not mp3 file */
 498   4                 }
 499   3             break;
 500   3          #else /* PLAYER_MODE == PLAY_DIR */
                    if (file_seek_prev(FILE_MP3, loop))   /* select prev song */
                    { /* still some file to play */
                      song_state = SONG_NEW;
                    }
                    else
                    { /* beginning of dir: stop */
                      song_stop();
                      song_state = SONG_STOP;
                    }
                    break;
                  #endif
 512   3          }
 513   2      
 514   2      
 515   2          case SONG_STOP:
 516   2          {
 517   3            lcd_print_string(0x40,"stop");
 518   3            disp_end_of_play();                   /* end of music... */
 519   3            disp_clock_reset();                   /* reset clock timer */
 520   3            print_file_name();                    /* display file name */
 521   3            song_state = SONG_IDLE;
 522   3            break;
 523   3          }
 524   2      
 525   2      
 526   2          case SONG_ERROR:
 527   2          {
 528   3            song_stop();                          /* stop playing song */
 529   3            Fclose();                             /* close opened file */
 530   3            disp_clock_reset();                   /* reset clock timer */
 531   3            print_state_error();                  /* display error icon */
 532   3            disp_name_stop();
 533   3            song_state = SONG_IDLE;
 534   3            break;
 535   3          }
 536   2        }
 537   1      }
 538          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    911    ----
   CONSTANT SIZE    =      5    ----
   XDATA SIZE       =      2    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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