ui_play.i

来自「MP3 整个 SDK」· I 代码 · 共 3,181 行 · 第 1/4 页

I
3,181
字号



int ui_menu2 (function_menu_t *menu , const void (*callback)(int value));

int ui_show_progress(const progress_t *progress, int string_id);
void ui_show_guage(int step, unsigned char  para);




int ui_filelist(file_location_t *location, int type, int string_id);
int ui_explore(file_location_t *location, int type, int string_id);







extern char file_name[12];
extern char dir_name[30];



int rm_dir_from_buf(int n);







extern  unsigned char  read_idm_data(char *name, int count);
extern  unsigned char  write_idm_data(char *name, int count);
extern void init_dir_buf();
extern  unsigned char  get_dir_name(char *file,  unsigned short  num);
extern void get_dir_name2(char *file, int num);
extern int init_sel_dir_buf(void);
extern  unsigned char  del_all_my_file(int type,  unsigned char  string_id);
extern void reinit_idm_buf(int top, int bottom, int total_dir, int string_id);
void show_active_list(int old_active, int active, int top);
 unsigned char  show_popup_list(int string_id);
int ui_explore_sub(file_location_t *location, int type, int string_id);
int init_active(int string_id);
int init_active_dironly(file_location_t *location);
void reset_cur_list_bg_color(int i, int tmp);
void get_dir_long_name(file_location_t *location, int string_id);
void redraw_window(void);
void Clearexplore(void);
void ui_show_data(char *buf,  unsigned char  x,  unsigned char  y);






















































































typedef struct
{
char magic[4]; 
 unsigned short  counts; 
char reserved[10];
}res_head_t;


typedef struct
{
long offset; 
 unsigned short  length; 
 unsigned char  type; 
char name[9]; 
}res_entry_t;






























extern SD_FILE *res_fp;
extern  unsigned char  ui_auto_update; 
extern  unsigned char  ui_auto_select; 
extern  unsigned char  ui_run_realtime; 
extern region_t res_region;
extern const char mychar[]; 
extern const char menu_pos[6];
extern const char music_ext[][4];
extern const char voice_ext[][4];
extern const char pic_ext[][4];
extern const char txt_ext[][4];
extern  unsigned char  charge_flag; 




SD_FILE *ResOpen(const char * filename);
void ResClose(const SD_FILE *fp_res);
int ResShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);



int main_ResShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);


int ResShowString( unsigned short  id,  unsigned char  x,  unsigned char  y); 
int ResShowMultiString( unsigned short  id,  unsigned char  string_id,  unsigned char  x,  unsigned char  y); 



int ResInvertShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);
void ap_message_init(const comval_t *comval);
non_banked char ap_get_message(void);


non_banked char ap_handle_hotkey(char key);
char ap_sleep(int half_sec); 

void ap_set_event( unsigned short  event);
 unsigned short  ap_get_event( unsigned short  event,  unsigned short  condition);
void ap_del_event( unsigned short  event);







char *itoa_1( unsigned char  i, char *buf); 
char *itoa_2( unsigned char  i, char *buf); 
char *itoa_3( unsigned short  i, char *buf); 
char *itoa_4( unsigned short  i, char *buf); 

int get_text_width(const char *string);
int get_large_text_width(const char *string);


void ui_show_a( unsigned short  id);
void ui_show_b( unsigned short  id);
void ui_show_c( unsigned short  id);
void ui_show_d(const char *string);
void ui_show_d2(const char *string); 
void ui_show_cd(const char *string,  unsigned char  part);
void ui_show_d_pic( unsigned short  id); 
void ui_show_e( unsigned short  id);
void ui_show_f(const char *string );
void ui_show_ef(const char *string,  unsigned char  part);
void ui_show_batt(int value, char batt_type, unsigned char  fmflag); 
void ui_show_g(const char *string);
void ui_show_h(const char *string);

int ui_delete(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_delete_all(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_deleteplaylist(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_directory(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_playlist(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_function_menu(function_menu_t *menu, const void (*callback)(int res_id));
int ui_slider(slider_t *slider, const void (*callback)(int res_id));

char ui_show_lock(char islock);
void ui_show_vol( unsigned char  volume);
















typedef struct{
unsigned char LcmWidth; 
unsigned char LcmHeigh; 
unsigned char RScale; 
unsigned char GScale; 
unsigned char BScale; 
unsigned char RGBOrder; 

} ColorLcmInfor;


typedef struct {
long AmvFileFLashDot; 
unsigned char TimeSec; 
unsigned char TimeMin; 
unsigned char TimeHou; 
unsigned char Reserve; 
} AmvFileBreakPntInfor;






extern unsigned char AmvViewOrder; 


 unsigned char  AmvDecSetCMD( unsigned char  cmd,int param);
char AmvDecStart(ColorLcmInfor *PicInfor, unsigned int  fp,AmvFileBreakPntInfor *BreakInfor); 
signed char AmvDecModPolling(void);

non_banked void AmvViewInit( unsigned int  fp);


non_banked void AmvViewInit( unsigned int  fp);
non_banked void AMVPicSetParament(ColorLcmInfor *infor);
non_banked void AmvViewExit(void);
non_banked void DscDecoderMsg(void);
non_banked void ReadOnePageFromDisk(void);












typedef enum
{
StopSta, 
PauseSta, 
PlaySta, 
FFPlaySta, 
FBPlaySta, 
NextPlaySta, 
PrevPlaySta, 
HotkeyPlaysta 
}Play_status_t;

typedef enum
{
LoopNor, 
LoopOne, 
LoopOneDir, 
LoopDir, 
LoopAll, 
Random, 
Intro, 
MaxRepeatMod
}Repeat_Mode_t;

typedef enum
{
Music_NON,
Music_MP3,
Music_WMA,
Music_ASF,
Music_WMV,
Music_MTV
}Music_type_t;

typedef enum
{
Stop_key,
Play_play,
Play_key
}Music_sel_mod_t;



typedef struct
{
 unsigned short  magic; 
char volume; 
Repeat_Mode_t repeat_mode; 
eq_t eq_type; 




file_location_t location; 


AmvFileBreakPntInfor amvfilebreakpoint;
}amv_vars_t;








extern amv_vars_t g_amv_vars;
extern comval_t g_comval;
extern Play_status_t PlayStatus;
extern int g_result; 
extern function_menu_t menu;
extern slider_t slider;
extern  unsigned char  g_currentMusicType;
extern  unsigned char  g_musicamount;
extern  unsigned char  g_musicsequence;
extern  unsigned char  BufferFullFlag;
extern  unsigned char  BufferStart;
extern  unsigned short  g_2HZ_CNT;
extern  unsigned char  g_2HZFlag;
extern char g_TagInfoBuf[66];
extern char g_TagInfoBuf1[]; 
extern region_t mainscreensize;
extern  unsigned char  need_draw;
extern  unsigned char  g_volume;
extern  unsigned char  g_introCntMode;
extern  unsigned char  g_OldSecTempBackup;
extern  unsigned char  g_introCNT;
extern char temp_buffer[9];
extern const region_t region_msg;
extern  unsigned char  g_PAOpenFlag;


extern  unsigned char  g_langid ;
extern  unsigned char  g_BatteryType;

extern time_t Totaltime;
extern  unsigned int  fp;

extern int Total_time;
extern int Current_time;
extern  unsigned char  g_changevolume;







void read_var( void );
void openDAC(void);


int ui_stop( void );
int ui_play( void );
int ui_stop_menu( void );
int ui_loop_menu( void );



extern int InitFileSelector(void);
extern UpdateFileSelector(void);
int RealDisplay( void );
void ShowNowTime( unsigned char  para);
void RefreshMainScreen( void );
void Scroll( char *,  unsigned char , char ); 
void Show_Bitrate( void ); 
void DisplayErrMsg(int ErrMsg);
void Show_MusicType(void);



Music_type_t CheckMusicType( char * filename );
int ToNextMusic( Music_sel_mod_t mod );
int GetInformation( void );
int GetInformation1( void );
 unsigned char  ChangeMusic(  unsigned char  Direct, Music_sel_mod_t mod );
void SelectCurMusic(void);
 unsigned char  musicpSendCommand( unsigned char , int);
 unsigned char  DealErrCase( void );
int DealMusicFileEnd( char DisMod );
int PrevMusicInPlay(void);
void ClearTimePara(void); 
void openPA(char volume);
int show_volume( unsigned char  set_hardware);
void vol_callback(int value);
void ui_show_t(const char *string,  unsigned char  part);





















ColorLcmInfor Dscinf;






extern  unsigned char  g_introCntMode; 
extern region_t AmvRegion; 
int InitLcmDeviceInfor(ColorLcmInfor *infor);


int ui_play( void )
{
char key;
int i;
signed char tmp;
int result;

need_draw =  1 ; 

InitLcmDeviceInfor(&Dscinf);
openPA(g_amv_vars.volume);
while (1)
{

if (need_draw)
{
fp=FS_FOpen(g_amv_vars.location.filename, 0x0 );
ClearScreen( 0 );
AmvDecStart(&Dscinf,fp,&g_amv_vars.amvfilebreakpoint);
g_introCNT=0;
while(ap_get_message() != 0);
PlayStatus = PlaySta;
need_draw =  0 ;
}

do
{

key = ap_get_message(); 

}while(((PlayStatus == FFPlaySta) || (PlayStatus == FBPlaySta))
&&(key!=0)
&&(key!=( 0x05  |  0x20 ))
&&(key!=( 0x06  |  0x20 )));

switch(key)
{

case  0x03 :
case  0x03  |  0x40 :
g_amv_vars.volume-=2;
case  0x04 :
case  0x04  |  0x40 :
g_amv_vars.volume++;
if(g_amv_vars.volume==0xff)g_amv_vars.volume=0;
if(g_amv_vars.volume>=31)g_amv_vars.volume=31;
SetPAVolume(g_amv_vars.volume);
break;
case  29 :
break;
case  0x06  |  0x80 :
if(PlayStatus==PlaySta)
{
AmvDecSetCMD( 0x07 ,4);
PlayStatus=FFPlaySta;
}
break;
case  0x05  |  0x80 :
if(PlayStatus==PlaySta)
{
AmvDecSetCMD( 0x07 ,-4);
PlayStatus=FBPlaySta;
}
break;
case  0x05 | 0x20 :
if(PlayStatus==FBPlaySta)
{
PlayStatus=PlaySta;
AmvDecSetCMD( 0x04 ,0);
}
else if(PlayStatus==PlaySta)
{
PlayStatus=PrevPlaySta;
AmvDecSetCMD( 0x06 ,0);
}

break;
case  0x06 | 0x20 :
if(PlayStatus==FFPlaySta)
{
PlayStatus=PlaySta;
AmvDecSetCMD( 0x04 ,0);
}
else if(PlayStatus==PlaySta)
{
PlayStatus=NextPlaySta;
AmvDecSetCMD( 0x06 ,0);
}

break;
case  0x01  |  0x20 :
output8(0x27,input8(0x27)&0xbf);
AmvDecSetCMD( 0x06 ,0); 
PlayStatus=StopSta;
g_result=0;
break;
case  28 :
if(g_amv_vars.repeat_mode==Intro)
{
g_introCNT++;
if(g_introCNT>=20)AmvDecSetCMD( 0x06 ,0);
}
break;
default:
key = ap_handle_hotkey( key);
if(key ==  50 ) ; 
else if(key != 0)
{
PlayStatus=HotkeyPlaysta;
AmvDecSetCMD( 0x06 ,0);
g_result=key;
}
}

tmp=AmvDecModPolling();
if(tmp==2)
{
int i;
for(i=0;i<1000;i++); 
output8(0x27,input8(0x27)|0x40);
output8(0x4e,input8(0x4e)|0x08);
if ( (g_amv_vars.location.disk == 'H')
&&(DRV_DetectUD(1)!= 0x20))
{
AmvDecSetCMD( 0x06 ,0);
FS_FClose(fp);
g_amv_vars.location.disk = 'C';

DisablePA();
return  100 +3 ;
}

FS_FClose(fp);
output8(0x27,input8(0x27)&0xfe); 
DisablePA();
DisplayErrMsg( 398 );
return  0 ;
}
else if(tmp==-1)
{
output8(0x27,input8(0x27)|0x40);
FS_FClose(fp);
switch(PlayStatus)
{
case PlaySta:
case FFPlaySta:
case FBPlaySta:
g_result = DealMusicFileEnd(0);
if ( g_result !=  0  )
{
return g_result;
}
need_draw =  1 ;
break;
case NextPlaySta:
g_result = ToNextMusic(Play_key);
if ( g_result !=  0  )
{
return g_result;
}
need_draw =  1 ;
break;
case PrevPlaySta:
g_result = PrevMusicInPlay();
if ( g_result !=  0  )
{
return g_result;
}
need_draw =  1 ;
break;

default:
AmvDecSetCMD( 0x02 ,(int )&g_amv_vars.amvfilebreakpoint);
return g_result;
}

}



{
if((PlayStatus!=FFPlaySta)&&(PlayStatus!=FBPlaySta))
ReadOnePageFromDisk(); 
}

} 

}



void ShowNowTime( unsigned char  para)
{
long int totaltime,nowtime;
int num,i;

nowtime = g_amv_vars.amvfilebreakpoint.TimeHou*3600+g_amv_vars.amvfilebreakpoint.TimeMin*60
+ g_amv_vars.amvfilebreakpoint.TimeSec;
totaltime = Totaltime.hour*3600+Totaltime.minute*60+Totaltime.second;
num=(nowtime*193)/totaltime;
itoa_1(g_amv_vars.amvfilebreakpoint.TimeHou, temp_buffer);
itoa_2(g_amv_vars.amvfilebreakpoint.TimeMin, & temp_buffer[1]);
itoa_2(g_amv_vars.amvfilebreakpoint.TimeSec, & temp_buffer[3]);
temp_buffer[5] = 0x00;
ui_show_d(temp_buffer);
if(!para)
{
main_ResShowPic( 75 ,  (15) -2,  (30) -1); 
for(i=0;i<num;i++)
main_ResShowPic( 74 , (15) +i, (30) );
}
else
{
main_ResShowPic( 74 , (15) +num-1, (30) ); 
main_ResShowPic( 74 , (15) +num, (30) );
}
}





void Show_Bitrate( void )
{
audio_format_t pFormat;

pFormat.bit_rate[0] = 0;
pFormat.bit_rate[1] = 8;
pFormat.bit_rate[2] = 8;

main_ResShowPic( 81 +pFormat.bit_rate[0], (9) , (4) );
main_ResShowPic( 81 +pFormat.bit_rate[1], (9) +6, (4) );
main_ResShowPic( 81 +pFormat.bit_rate[2], (9) +12, (4) );
}


int InitLcmDeviceInfor(ColorLcmInfor *infor)
{
infor->LcmWidth= 220 ; 
infor->LcmHeigh= 176 ; 
infor->RScale=5; 
infor->GScale=6;
infor->BScale=5;
infor->RGBOrder=0; 
return 0;
}



int ToNextMusic( Music_sel_mod_t mod )
{
output8(0x4e,input8(0x4e)|0x08);
g_result = ChangeMusic( 3 , mod);
if(!g_result)
{
return  100 +2 ;
}
GetInformation(); 
return  0 ;
}


int PrevMusicInPlay(void)
{

g_result = ChangeMusic( 4 , Play_key);
if(!g_result)
{
return  100 +2 ;
}
GetInformation(); 
return  0 ;
}


void SetAmvWin(void)
{

SetWindow(&AmvRegion); 

}


⌨️ 快捷键说明

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