forked from len0rd/rockbox
Custom WPS update - works for recorder and player now. Also updated how the WPS refreshes the screen when using Custom WPS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2046 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
de14e53c66
commit
8097ee6af1
3 changed files with 264 additions and 102 deletions
|
@ -97,8 +97,13 @@ static Menu scroll_speed(void)
|
||||||
static Menu wps_set(void)
|
static Menu wps_set(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
char* names[] = { "ID3 Tags", "File ", "Parse ", "Custom WPS" };
|
||||||
|
set_option("[WPS display]", &global_settings.wps_display, names, 4 );
|
||||||
|
#else
|
||||||
char* names[] = { "ID3 Tags", "File ", "Parse " };
|
char* names[] = { "ID3 Tags", "File ", "Parse " };
|
||||||
set_option("[WPS display]", &global_settings.wps_display, names, 3 );
|
set_option("[WPS display]", &global_settings.wps_display, names, 3 );
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
char* names[] = { "1 Line ID3", "2 Line ID3", "File ",
|
char* names[] = { "1 Line ID3", "2 Line ID3", "File ",
|
||||||
|
@ -179,7 +184,7 @@ static Menu ff_rewind_accel(void)
|
||||||
"2x/8s ", "2x/9s ", "2x/10s", "2x/11s",
|
"2x/8s ", "2x/9s ", "2x/10s", "2x/11s",
|
||||||
"2x/12s", "2x/13s", "2x/14s", "2x/15s", };
|
"2x/12s", "2x/13s", "2x/14s", "2x/15s", };
|
||||||
set_option("[FF/rewind accel]", &global_settings.ff_rewind_accel,
|
set_option("[FF/rewind accel]", &global_settings.ff_rewind_accel,
|
||||||
names, 16 );
|
names, 16 );
|
||||||
return MENU_OK;
|
return MENU_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +208,7 @@ Menu settings_menu(void)
|
||||||
{ "Time/Date", timedate_set },
|
{ "Time/Date", timedate_set },
|
||||||
#endif
|
#endif
|
||||||
{ "Show hidden files", show_hidden_files },
|
{ "Show hidden files", show_hidden_files },
|
||||||
{ "FF/rewind accel", ff_rewind_accel },
|
{ "FF/Rewind Accel", ff_rewind_accel },
|
||||||
{ "Resume", resume },
|
{ "Resume", resume },
|
||||||
{ "Disk spindown", spindown },
|
{ "Disk spindown", spindown },
|
||||||
};
|
};
|
||||||
|
|
288
apps/wps.c
288
apps/wps.c
|
@ -52,6 +52,7 @@
|
||||||
#define PLAY_DISPLAY_2LINEID3 0
|
#define PLAY_DISPLAY_2LINEID3 0
|
||||||
#define PLAY_DISPLAY_FILENAME_SCROLL 1
|
#define PLAY_DISPLAY_FILENAME_SCROLL 1
|
||||||
#define PLAY_DISPLAY_TRACK_TITLE 2
|
#define PLAY_DISPLAY_TRACK_TITLE 2
|
||||||
|
#define PLAY_DISPLAY_CUSTOM_WPS 3
|
||||||
#else
|
#else
|
||||||
#define PLAY_DISPLAY_1LINEID3 0
|
#define PLAY_DISPLAY_1LINEID3 0
|
||||||
#define PLAY_DISPLAY_2LINEID3 1
|
#define PLAY_DISPLAY_2LINEID3 1
|
||||||
|
@ -70,17 +71,22 @@ bool keys_locked = false;
|
||||||
bool device_muted = false;
|
bool device_muted = false;
|
||||||
static bool ff_rewind = false;
|
static bool ff_rewind = false;
|
||||||
static bool paused = false;
|
static bool paused = false;
|
||||||
|
int ff_rewind_count = 0;
|
||||||
|
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
static char custom_wps[64];
|
static char custom_wps[5][64];
|
||||||
|
static char wps_display[5][64];
|
||||||
|
static int scroll_line;
|
||||||
|
static int scroll_line_custom;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void draw_screen(struct mp3entry* id3)
|
static void draw_screen(struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
int font_height;
|
int font_height;
|
||||||
|
|
||||||
#ifdef LOADABLE_FONTS
|
#ifdef LOADABLE_FONTS
|
||||||
unsigned char *font = lcd_getcurrentldfont();
|
unsigned char *font = lcd_getcurrentldfont();
|
||||||
font_height = ajf_get_fontheight(font);
|
font_height = ajf_get_fontheight(font);
|
||||||
#else
|
#else
|
||||||
font_height = 8;
|
font_height = 8;
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,7 +105,6 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
static int last_wps = -1;
|
static int last_wps = -1;
|
||||||
if ((last_wps != global_settings.wps_display
|
if ((last_wps != global_settings.wps_display
|
||||||
&& global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS))
|
&& global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS))
|
||||||
|
@ -107,7 +112,6 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
load_custom_wps();
|
load_custom_wps();
|
||||||
last_wps = global_settings.wps_display;
|
last_wps = global_settings.wps_display;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
switch ( global_settings.wps_display ) {
|
switch ( global_settings.wps_display ) {
|
||||||
case PLAY_DISPLAY_TRACK_TITLE:
|
case PLAY_DISPLAY_TRACK_TITLE:
|
||||||
|
@ -120,7 +124,9 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
char szArtist[26];
|
char szArtist[26];
|
||||||
char szBuff[257];
|
char szBuff[257];
|
||||||
szBuff[sizeof(szBuff)-1] = 0;
|
szBuff[sizeof(szBuff)-1] = 0;
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
int tmpcnt = 0;
|
||||||
|
#endif
|
||||||
strncpy(szBuff, id3->path, sizeof(szBuff));
|
strncpy(szBuff, id3->path, sizeof(szBuff));
|
||||||
|
|
||||||
szTok = strtok_r(szBuff, "/", &end);
|
szTok = strtok_r(szBuff, "/", &end);
|
||||||
|
@ -136,14 +142,33 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
szPeriod = strrchr(szDelimit, '.');
|
szPeriod = strrchr(szDelimit, '.');
|
||||||
if (szPeriod != NULL)
|
if (szPeriod != NULL)
|
||||||
*szPeriod = 0;
|
*szPeriod = 0;
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
snprintf(wps_display[0],sizeof(wps_display[0]),"%s",
|
||||||
|
(++szDelimit));
|
||||||
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
snprintf(wps_display[1],sizeof(wps_display[1]),"%s",
|
||||||
|
"%pc/%pt");
|
||||||
|
#endif
|
||||||
|
for(tmpcnt=2;tmpcnt<=5;tmpcnt++)
|
||||||
|
wps_display[tmpcnt][0] = 0;
|
||||||
|
scroll_line = 0;
|
||||||
|
refresh_wps(true);
|
||||||
|
#else
|
||||||
lcd_puts_scroll(0, 1, (++szDelimit));
|
lcd_puts_scroll(0, 1, (++szDelimit));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PLAY_DISPLAY_FILENAME_SCROLL:
|
case PLAY_DISPLAY_FILENAME_SCROLL:
|
||||||
{
|
{
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
display_custom_wps(0, 0, true, "%pp/%pe: %fn");
|
snprintf(wps_display[0],sizeof(wps_display[0]),"%s",
|
||||||
|
"%pp/%pe: %fn");
|
||||||
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
snprintf(wps_display[1],sizeof(wps_display[1]),"%s",
|
||||||
|
"%pc/%pt");
|
||||||
|
#endif
|
||||||
|
scroll_line = 0;
|
||||||
|
refresh_wps(true);
|
||||||
#else
|
#else
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
char ch = '/';
|
char ch = '/';
|
||||||
|
@ -169,8 +194,37 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
}
|
}
|
||||||
case PLAY_DISPLAY_2LINEID3:
|
case PLAY_DISPLAY_2LINEID3:
|
||||||
{
|
{
|
||||||
int l = 0;
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
snprintf(wps_display[l],sizeof(wps_display[l]),"%s","%fn");
|
||||||
|
snprintf(wps_display[l++],sizeof(wps_display[l]),"%s","%it");
|
||||||
|
snprintf(wps_display[l++],sizeof(wps_display[l]),"%s","%id");
|
||||||
|
snprintf(wps_display[l++],sizeof(wps_display[l]),"%s","%ia");
|
||||||
|
if(!global_settings.statusbar && font_height <= 8)
|
||||||
|
{
|
||||||
|
if(id3->vbr)
|
||||||
|
snprintf(wps_display[l++],sizeof(wps_display[l]),"%s",
|
||||||
|
"%fb kbit (avg)");
|
||||||
|
else
|
||||||
|
snprintf(wps_display[l],sizeof(wps_display[l]),"%s",
|
||||||
|
"%fb kbit");
|
||||||
|
snprintf(wps_display[l],sizeof(wps_display[l]),"%s",
|
||||||
|
"%ff Hz");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(id3->vbr)
|
||||||
|
snprintf(wps_display[l++],sizeof(wps_display[l]),"%s",
|
||||||
|
"%fb kbit(a) %ffHz");
|
||||||
|
else
|
||||||
|
snprintf(wps_display[l],sizeof(wps_display[l]),"%s",
|
||||||
|
"%fb kbit %ffHz");
|
||||||
|
}
|
||||||
|
scroll_line = 0;
|
||||||
|
refresh_wps(true);
|
||||||
|
#else
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
lcd_puts_scroll(0, l++, id3->path);
|
lcd_puts_scroll(0, l++, id3->path);
|
||||||
|
@ -200,13 +254,16 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
|
|
||||||
lcd_puts(0, l++, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
display_custom_wps(0, l++, false, "%ia");
|
snprintf(wps_display[0],sizeof(wps_display[0]),"%s","%ia");
|
||||||
display_custom_wps(0, l++, true, "%it");
|
snprintf(wps_display[1],sizeof(wps_display[1]),"%s","%it");
|
||||||
|
scroll_line = 1;
|
||||||
|
refresh_wps(true);
|
||||||
#else
|
#else
|
||||||
lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>");
|
lcd_puts(0, 0, id3->artist?id3->artist:"<no artist>");
|
||||||
lcd_puts_scroll(0, l++, id3->title?id3->title:"<no title>");
|
lcd_puts_scroll(0, 1, id3->title?id3->title:"<no title>");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -215,7 +272,12 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
case PLAY_DISPLAY_1LINEID3:
|
case PLAY_DISPLAY_1LINEID3:
|
||||||
{
|
{
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
display_custom_wps(0, 0, true, "%pp/%pe: %fc");
|
snprintf(wps_display[0],sizeof(wps_display[0]),"%s",
|
||||||
|
"%pp/%pe: %fc");
|
||||||
|
snprintf(wps_display[1],sizeof(wps_display[1]),"%s",
|
||||||
|
"%pc/%pt");
|
||||||
|
scroll_line = 0;
|
||||||
|
refresh_wps(true);
|
||||||
#else
|
#else
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
char ch = '/';
|
char ch = '/';
|
||||||
|
@ -234,16 +296,20 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
case PLAY_DISPLAY_CUSTOM_WPS:
|
case PLAY_DISPLAY_CUSTOM_WPS:
|
||||||
{
|
{
|
||||||
if(custom_wps[0] == 0)
|
if(custom_wps[0] == 0)
|
||||||
snprintf(custom_wps, sizeof(custom_wps),
|
{
|
||||||
|
snprintf(wps_display[0],sizeof(wps_display[0]),"%s",
|
||||||
"Couldn't Load Custom WPS");
|
"Couldn't Load Custom WPS");
|
||||||
display_custom_wps(0, 0, true, custom_wps);
|
snprintf(wps_display[1],sizeof(wps_display[1]),"%s",
|
||||||
|
"%pc/%pt");
|
||||||
|
}
|
||||||
|
refresh_wps(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,19 +318,108 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
|
bool refresh_wps(bool refresh_scroll)
|
||||||
|
{
|
||||||
|
int l;
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
int bmp_time_line;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct mp3entry* id3 = NULL;
|
||||||
|
id3 = mpeg_current_track();
|
||||||
|
|
||||||
|
if(!id3)
|
||||||
|
{
|
||||||
|
lcd_stop_scroll();
|
||||||
|
lcd_clear_display();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_CHARCELL
|
||||||
|
for(l = 0; l <= 1; l++)
|
||||||
|
#else
|
||||||
|
for(l = 0; l <= 5; l++)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if(global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS)
|
||||||
|
{
|
||||||
|
scroll_line = scroll_line_custom;
|
||||||
|
if(scroll_line != l)
|
||||||
|
display_custom_wps(0, l, false, custom_wps[l]);
|
||||||
|
else
|
||||||
|
if(refresh_scroll)
|
||||||
|
display_custom_wps(0, l, true, custom_wps[l]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(scroll_line != l)
|
||||||
|
display_custom_wps(0, l, false, wps_display[l]);
|
||||||
|
else
|
||||||
|
if(refresh_scroll)
|
||||||
|
display_custom_wps(0, l, true, wps_display[l]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
if(global_settings.statusbar)
|
||||||
|
bmp_time_line = 5;
|
||||||
|
else
|
||||||
|
bmp_time_line = 6;
|
||||||
|
snprintf(wps_display[bmp_time_line],sizeof(wps_display[bmp_time_line]),
|
||||||
|
"%s","Time: %pc/%pt");
|
||||||
|
|
||||||
|
slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, id3->elapsed*100/id3->length, Grow_Right);
|
||||||
|
lcd_update();
|
||||||
|
#endif
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool load_custom_wps(void)
|
bool load_custom_wps(void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
int l = 0;
|
||||||
|
int numread = 1;
|
||||||
|
char cchr[0];
|
||||||
|
|
||||||
|
for(l=0;l<=5;l++)
|
||||||
|
{
|
||||||
|
custom_wps[l][0] = 0;
|
||||||
|
}
|
||||||
|
l = 0;
|
||||||
|
|
||||||
fd = open("/wps.config", O_RDONLY);
|
fd = open("/wps.config", O_RDONLY);
|
||||||
if(-1 == fd)
|
if(-1 == fd)
|
||||||
{
|
{
|
||||||
custom_wps[0] = 0;
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
read(fd, custom_wps, sizeof(custom_wps));
|
|
||||||
|
while(l<=5)
|
||||||
|
{
|
||||||
|
numread = read(fd, cchr, 1);
|
||||||
|
if(numread==0)
|
||||||
|
break;
|
||||||
|
switch(cchr[0])
|
||||||
|
{
|
||||||
|
case 10: /* LF */
|
||||||
|
l++;
|
||||||
|
break;
|
||||||
|
case 13: /* CR ... Ignore it */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snprintf(custom_wps[l], sizeof(custom_wps[l]), "%s%c", custom_wps[l], cchr[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
scroll_line_custom = 0;
|
||||||
|
for(l=0;l<=5;l++)
|
||||||
|
{
|
||||||
|
if(custom_wps[l][0] == '%' && custom_wps[l][1] == 's')
|
||||||
|
scroll_line_custom = l;
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,10 +480,6 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
|
||||||
case 'd': /* ID3 Album/Disc */
|
case 'd': /* ID3 Album/Disc */
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%s", id3->album);
|
snprintf(tmpbuf, sizeof(tmpbuf), "%s", id3->album);
|
||||||
break;
|
break;
|
||||||
case '\r':
|
|
||||||
case '\n':
|
|
||||||
/* As of yet, do nothing with these */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'f': /* File Information */
|
case 'f': /* File Information */
|
||||||
|
@ -371,10 +522,6 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%d",
|
snprintf(tmpbuf, sizeof(tmpbuf), "%d",
|
||||||
id3->filesize / 1024);
|
id3->filesize / 1024);
|
||||||
break;
|
break;
|
||||||
case '\r':
|
|
||||||
case '\n':
|
|
||||||
/* As of yet, do nothing with these */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p': /* Playlist/Song Information */
|
case 'p': /* Playlist/Song Information */
|
||||||
|
@ -390,17 +537,13 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
|
||||||
break;
|
break;
|
||||||
case 'c': /* Current Time in Song */
|
case 'c': /* Current Time in Song */
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%d:%02d",
|
snprintf(tmpbuf, sizeof(tmpbuf), "%d:%02d",
|
||||||
id3->elapsed / 60000,
|
(id3->elapsed + ff_rewind_count) / 60000,
|
||||||
id3->elapsed % 60000 / 1000);
|
(id3->elapsed + ff_rewind_count) % 60000 / 1000);
|
||||||
break;
|
break;
|
||||||
case 't': /* Total Time */
|
case 't': /* Total Time */
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%d:%02d",
|
snprintf(tmpbuf, sizeof(tmpbuf), "%d:%02d",
|
||||||
id3->elapsed / 60000,
|
id3->length / 60000,
|
||||||
id3->elapsed % 60000 / 1000);
|
id3->length % 60000 / 1000);
|
||||||
break;
|
|
||||||
case '\r':
|
|
||||||
case '\n':
|
|
||||||
/* As of yet, do nothing with these */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -441,10 +584,6 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\r':
|
|
||||||
case '\n':
|
|
||||||
/* As of yet, do nothing with these */
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
switch(con_flag)
|
switch(con_flag)
|
||||||
{
|
{
|
||||||
|
@ -462,9 +601,11 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
|
||||||
}
|
}
|
||||||
if(seek >= strlen(wps_string))
|
if(seek >= strlen(wps_string))
|
||||||
{
|
{
|
||||||
lcd_stop_scroll();
|
|
||||||
if(do_scroll)
|
if(do_scroll)
|
||||||
|
{
|
||||||
|
lcd_stop_scroll();
|
||||||
lcd_puts_scroll(x_val, y_val, buffer);
|
lcd_puts_scroll(x_val, y_val, buffer);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
lcd_puts(x_val, y_val, buffer);
|
lcd_puts(x_val, y_val, buffer);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -541,38 +682,38 @@ int player_id3_show(void)
|
||||||
switch(menu_pos)
|
switch(menu_pos)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
lcd_puts(0, 0, "Title");
|
lcd_puts(0, 0, "[Title]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
||||||
id3->title?id3->title:"<no title>");
|
id3->title?id3->title:"<no title>");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
lcd_puts(0, 0, "Artist");
|
lcd_puts(0, 0, "[Artist]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
||||||
id3->artist?id3->artist:"<no artist>");
|
id3->artist?id3->artist:"<no artist>");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
lcd_puts(0, 0, "Album");
|
lcd_puts(0, 0, "[Album]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
||||||
id3->album?id3->album:"<no album>");
|
id3->album?id3->album:"<no album>");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
lcd_puts(0, 0, "Length");
|
lcd_puts(0, 0, "[Length]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%d:%02d",
|
snprintf(scroll_text,sizeof(scroll_text), "%d:%02d",
|
||||||
id3->length / 60000,
|
id3->length / 60000,
|
||||||
id3->length % 60000 / 1000 );
|
id3->length % 60000 / 1000 );
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
lcd_puts(0, 0, "Bitrate");
|
lcd_puts(0, 0, "[Bitrate]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
|
snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
|
||||||
id3->bitrate);
|
id3->bitrate);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
lcd_puts(0, 0, "Frequency");
|
lcd_puts(0, 0, "[Frequency]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%d kHz",
|
snprintf(scroll_text,sizeof(scroll_text), "%d kHz",
|
||||||
id3->frequency);
|
id3->frequency);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
lcd_puts(0, 0, "Path");
|
lcd_puts(0, 0, "[Path]");
|
||||||
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
snprintf(scroll_text,sizeof(scroll_text), "%s",
|
||||||
id3->path);
|
id3->path);
|
||||||
break;
|
break;
|
||||||
|
@ -594,6 +735,7 @@ int player_id3_show(void)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CUSTOM_WPS
|
||||||
static void display_file_time(unsigned int elapsed, unsigned int length)
|
static void display_file_time(unsigned int elapsed, unsigned int length)
|
||||||
{
|
{
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
@ -633,6 +775,7 @@ static void display_file_time(unsigned int elapsed, unsigned int length)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void display_volume_level(int vol_level)
|
void display_volume_level(int vol_level)
|
||||||
{
|
{
|
||||||
|
@ -717,7 +860,6 @@ int wps_show(void)
|
||||||
bool pending_mute = true; /* Mute will go ON next time */
|
bool pending_mute = true; /* Mute will go ON next time */
|
||||||
int old_release_mask;
|
int old_release_mask;
|
||||||
int button;
|
int button;
|
||||||
int ff_rewind_count = 0;
|
|
||||||
unsigned int ff_rewind_step = 0; /* current rewind step size */
|
unsigned int ff_rewind_step = 0; /* current rewind step size */
|
||||||
unsigned int ff_rewind_max_step = 0; /* max rewind step size */
|
unsigned int ff_rewind_max_step = 0; /* max rewind step size */
|
||||||
long ff_rewind_accel_tick = 0; /* next time to bump ff/rewind step size */
|
long ff_rewind_accel_tick = 0; /* next time to bump ff/rewind step size */
|
||||||
|
@ -745,7 +887,7 @@ int wps_show(void)
|
||||||
if(mpeg_is_playing())
|
if(mpeg_is_playing())
|
||||||
{
|
{
|
||||||
id3 = mpeg_current_track();
|
id3 = mpeg_current_track();
|
||||||
// draw_screen(id3);
|
draw_screen(id3);
|
||||||
restore = true;
|
restore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,13 +1005,13 @@ int wps_show(void)
|
||||||
ff_rewind_count -= ff_rewind_step;
|
ff_rewind_count -= ff_rewind_step;
|
||||||
if (global_settings.ff_rewind_accel != 0 &&
|
if (global_settings.ff_rewind_accel != 0 &&
|
||||||
current_tick >= ff_rewind_accel_tick)
|
current_tick >= ff_rewind_accel_tick)
|
||||||
{
|
{
|
||||||
ff_rewind_step *= 2;
|
ff_rewind_step *= 2;
|
||||||
if (ff_rewind_step > ff_rewind_max_step)
|
if (ff_rewind_step > ff_rewind_max_step)
|
||||||
ff_rewind_step = ff_rewind_max_step;
|
ff_rewind_step = ff_rewind_max_step;
|
||||||
ff_rewind_accel_tick = current_tick +
|
ff_rewind_accel_tick = current_tick +
|
||||||
global_settings.ff_rewind_accel*HZ;
|
global_settings.ff_rewind_accel*HZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -899,8 +1041,12 @@ int wps_show(void)
|
||||||
if ((int)(id3->elapsed + ff_rewind_count) < 0)
|
if ((int)(id3->elapsed + ff_rewind_count) < 0)
|
||||||
ff_rewind_count = -id3->elapsed;
|
ff_rewind_count = -id3->elapsed;
|
||||||
|
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
refresh_wps(false);
|
||||||
|
#else
|
||||||
display_file_time(id3->elapsed + ff_rewind_count,
|
display_file_time(id3->elapsed + ff_rewind_count,
|
||||||
id3->length);
|
id3->length);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -909,16 +1055,16 @@ int wps_show(void)
|
||||||
{
|
{
|
||||||
if (ff_rewind)
|
if (ff_rewind)
|
||||||
{
|
{
|
||||||
ff_rewind_count += ff_rewind_step;
|
ff_rewind_count += ff_rewind_step;
|
||||||
if (global_settings.ff_rewind_accel != 0 &&
|
if (global_settings.ff_rewind_accel != 0 &&
|
||||||
current_tick >= ff_rewind_accel_tick)
|
current_tick >= ff_rewind_accel_tick)
|
||||||
{
|
{
|
||||||
ff_rewind_step *= 2;
|
ff_rewind_step *= 2;
|
||||||
if (ff_rewind_step > ff_rewind_max_step)
|
if (ff_rewind_step > ff_rewind_max_step)
|
||||||
ff_rewind_step = ff_rewind_max_step;
|
ff_rewind_step = ff_rewind_max_step;
|
||||||
ff_rewind_accel_tick = current_tick +
|
ff_rewind_accel_tick = current_tick +
|
||||||
global_settings.ff_rewind_accel*HZ;
|
global_settings.ff_rewind_accel*HZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -948,8 +1094,12 @@ int wps_show(void)
|
||||||
if ((id3->elapsed + ff_rewind_count) > id3->length)
|
if ((id3->elapsed + ff_rewind_count) > id3->length)
|
||||||
ff_rewind_count = id3->length - id3->elapsed;
|
ff_rewind_count = id3->length - id3->elapsed;
|
||||||
|
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
refresh_wps(false);
|
||||||
|
#else
|
||||||
display_file_time(id3->elapsed + ff_rewind_count,
|
display_file_time(id3->elapsed + ff_rewind_count,
|
||||||
id3->length);
|
id3->length);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1276,7 +1426,11 @@ int wps_show(void)
|
||||||
restore = true;
|
restore = true;
|
||||||
|
|
||||||
if (id3)
|
if (id3)
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
refresh_wps(false);
|
||||||
|
#else
|
||||||
display_file_time(id3->elapsed, id3->length);
|
display_file_time(id3->elapsed, id3->length);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* save resume data */
|
/* save resume data */
|
||||||
if ( id3 &&
|
if ( id3 &&
|
||||||
|
@ -1300,7 +1454,11 @@ int wps_show(void)
|
||||||
restore = false;
|
restore = false;
|
||||||
draw_screen(id3);
|
draw_screen(id3);
|
||||||
if (mpeg_is_playing() && id3)
|
if (mpeg_is_playing() && id3)
|
||||||
|
#ifdef CUSTOM_WPS
|
||||||
|
refresh_wps(false);
|
||||||
|
#else
|
||||||
display_file_time(id3->elapsed, id3->length);
|
display_file_time(id3->elapsed, id3->length);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
|
||||||
/* #define CUSTOM_WPS */
|
|
||||||
|
|
||||||
extern bool keys_locked;
|
extern bool keys_locked;
|
||||||
|
|
||||||
int wps_show(void);
|
int wps_show(void);
|
||||||
|
@ -30,6 +28,7 @@ int wps_show(void);
|
||||||
#ifdef CUSTOM_WPS
|
#ifdef CUSTOM_WPS
|
||||||
bool load_custom_wps(void);
|
bool load_custom_wps(void);
|
||||||
bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string);
|
bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string);
|
||||||
|
bool refresh_wps(bool refresh_scroll);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue