mp3.c
branchtrunk
changeset 7 f5e05e2022f1
parent 6 111ef8181229
child 9 dc75c2890a31
equal deleted inserted replaced
6:111ef8181229 7:f5e05e2022f1
   230   //
   230   //
   231   cMP3Player *player;
   231   cMP3Player *player;
   232   bool visible, shown, bigwin, statusActive;
   232   bool visible, shown, bigwin, statusActive;
   233   time_t timeoutShow, greentime, oktime;
   233   time_t timeoutShow, greentime, oktime;
   234   int lastkeytime, number;
   234   int lastkeytime, number;
   235   bool selecting, selecthide;
   235   bool selecting;
   236   //
   236   //
   237   cMP3PlayInfo *lastMode;
   237   cMP3PlayInfo *lastMode;
   238   time_t fliptime, listtime;
   238   time_t fliptime, listtime;
   239   int hashlist[MAXROWS];
   239   int hashlist[MAXROWS];
   240   int flip, flipint, top, rows;
   240   int flip, flipint, top, rows;
   267   };
   267   };
   268 
   268 
   269 cMP3Control::cMP3Control(void)
   269 cMP3Control::cMP3Control(void)
   270 :cControl(player=new cMP3Player)
   270 :cControl(player=new cMP3Player)
   271 {
   271 {
   272   visible=shown=bigwin=selecting=selecthide=jumpactive=jumphide=statusActive=false;
   272   visible=shown=bigwin=selecting=jumpactive=jumphide=statusActive=false;
   273   timeoutShow=greentime=oktime=0;
   273   timeoutShow=greentime=oktime=0;
   274   lastkeytime=number=0;
   274   lastkeytime=number=0;
   275   lastMode=0;
   275   lastMode=0;
   276   framesPerSecond=SecondsToFrames(1);
   276   framesPerSecond=SecondsToFrames(1);
   277 #if APIVERSNUM >= 10307
   277 #if APIVERSNUM >= 10307
   328 
   328 
   329 void cMP3Control::ShowTimed(int Seconds)
   329 void cMP3Control::ShowTimed(int Seconds)
   330 {
   330 {
   331   if(!visible) {
   331   if(!visible) {
   332     ShowProgress(true);
   332     ShowProgress(true);
   333     if(Seconds>0) timeoutShow=time(0)+Seconds;
   333     timeoutShow=(Seconds>0) ? time(0)+Seconds : 0;
   334     }
   334     }
   335 }
   335 }
   336 
   336 
   337 void cMP3Control::Hide(void)
   337 void cMP3Control::Hide(void)
   338 {
   338 {
   339   HideStatus();
   339   HideStatus();
       
   340   timeoutShow=0;
   340   if(visible) {
   341   if(visible) {
   341 #if APIVERSNUM >= 10307
   342 #if APIVERSNUM >= 10307
   342     delete osd; osd=0;
   343     delete osd; osd=0;
   343     delete disp; disp=0;
   344     delete disp; disp=0;
   344 #else
   345 #else
   763 
   764 
   764 eOSState cMP3Control::ProcessKey(eKeys Key)
   765 eOSState cMP3Control::ProcessKey(eKeys Key)
   765 {
   766 {
   766   if(!player->Active()) return osEnd;
   767   if(!player->Active()) return osEnd;
   767 
   768 
   768   if(visible && timeoutShow && time(0)>timeoutShow) { Hide(); timeoutShow=0; }
   769   if(timeoutShow && time(0)>timeoutShow) Hide();
   769   ShowProgress();
   770   ShowProgress();
   770 #if APIVERSNUM >= 10307
   771 #if APIVERSNUM >= 10307
   771   ShowStatus(Key==kNone && !Skins.IsOpen());
   772   ShowStatus(Key==kNone && !Skins.IsOpen());
   772 #else
   773 #else
   773   ShowStatus(Key==kNone && !Interface->IsOpen());
   774   ShowStatus(Key==kNone && !Interface->IsOpen());
   854 #endif
   855 #endif
   855 
   856 
   856     case k0 ... k9:
   857     case k0 ... k9:
   857       number=number*10+Key-k0;
   858       number=number*10+Key-k0;
   858       if(lastMode && number>0 && number<=lastMode->MaxNum) {
   859       if(lastMode && number>0 && number<=lastMode->MaxNum) {
   859         if(!visible) { ShowTimed(); selecthide=true; }
   860         if(!visible) ShowTimed(SELECTHIDE_TIMEOUT);
       
   861         else if(timeoutShow>0) timeoutShow=time(0)+SELECTHIDE_TIMEOUT;
   860         selecting=true; lastkeytime=time_ms();
   862         selecting=true; lastkeytime=time_ms();
   861         char buf[32];
   863         char buf[32];
   862 #if APIVERSNUM >= 10307
   864 #if APIVERSNUM >= 10307
   863         if(MP3Setup.ReplayDisplay) {
   865         if(MP3Setup.ReplayDisplay) {
   864           snprintf(buf,sizeof(buf),"%s%d-/%d",trVDR("Jump: "),number,lastMode->MaxNum);
   866           snprintf(buf,sizeof(buf),"%s%d-/%d",trVDR("Jump: "),number,lastMode->MaxNum);
   877       number=0; lastkeytime=0;
   879       number=0; lastkeytime=0;
   878       // fall through
   880       // fall through
   879     case kNone:
   881     case kNone:
   880       if(selecting && time_ms()-lastkeytime>SELECT_TIMEOUT) {
   882       if(selecting && time_ms()-lastkeytime>SELECT_TIMEOUT) {
   881         if(number>0) { mgr->Goto(number); player->Play();  }
   883         if(number>0) { mgr->Goto(number); player->Play();  }
   882         if(selecthide) timeoutShow=time(0)+SELECTHIDE_TIMEOUT;
       
   883         if(lastMode) lastMode->Hash=-1;
   884         if(lastMode) lastMode->Hash=-1;
   884         number=0; selecting=selecthide=false;
   885         number=0; selecting=false;
   885 #if APIVERSNUM >= 10307
   886 #if APIVERSNUM >= 10307
   886         if(MP3Setup.ReplayDisplay) disp->SetJump(0);
   887         if(MP3Setup.ReplayDisplay && disp) disp->SetJump(0);
   887 #endif
   888 #endif
   888         }
   889         }
   889       break;
   890       break;
   890     case kOk:
   891     case kOk:
   891       if(time(0)>oktime || MP3Setup.ReplayDisplay) {
   892       if(time(0)>oktime || MP3Setup.ReplayDisplay) {