1
0
Fork 0
forked from len0rd/rockbox

Psyco Dedman's player progress-bar fix

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2082 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-08-30 13:08:37 +00:00
parent 62613fc376
commit 99b69bf7d9
3 changed files with 24 additions and 17 deletions

View file

@ -27,6 +27,7 @@
#include "playlist.h" #include "playlist.h"
#include "kernel.h" #include "kernel.h"
#include "status.h" #include "status.h"
#include "wps-display.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "icons.h" #include "icons.h"
@ -387,7 +388,7 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_scroll)
#endif #endif
#ifdef PLAYER_PROGRESS #ifdef PLAYER_PROGRESS
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
draw_player_progress(10,1); draw_player_progress(10,1,id3);
#endif #endif
#endif #endif
return true; return true;
@ -537,7 +538,7 @@ void wps_display(struct mp3entry* id3)
} }
#ifdef PLAYER_PROGRESS #ifdef PLAYER_PROGRESS
static int bin2int(char *input, int size) /*static int bin2int(char *input, int size)
{ {
int result=0; int result=0;
while(size--) { while(size--) {
@ -546,25 +547,29 @@ static int bin2int(char *input, int size)
} }
return result; return result;
} }
*/
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
static void draw_player_progress(int x, int y) void draw_player_progress(int x, int y, struct mp3entry* id3)
{ {
char player_progressbar[8]; char player_progressbar[7];
char binline[35]; char binline[36];
char charline[5];
int songpos = 0; int songpos = 0;
int i; int i,j;
memset(binline, 0, sizeof binline); memset(binline, 0, sizeof binline);
memset(charline, 0, sizeof charline); memset(player_progressbar, 0, sizeof player_progressbar);
songpos = (id3->elapsed * 35) / id3->length; songpos = (id3->elapsed * 36) / id3->length;
for (i=0; i <= songpos; i++) for (i=0; i < songpos; i++)
binline[i] = 1; binline[i] = 1;
for (i=0; i<=6; i++) for (i=0; i<=6; i++) {
player_progressbar[i] = bin2int(binline+(i*5),4); for (j=0;j<5;j++) {
player_progressbar[i] <<= 1;
player_progressbar[i] += binline[i*5+j];
}
/* player_progressbar[i] = bin2int(binline+(i*5),4); */
}
lcd_define_pattern(8,player_progressbar,7); lcd_define_pattern(8,player_progressbar,7);
lcd_puts(x,y,"\x01"); lcd_puts(x,y,"\x01");

View file

@ -25,4 +25,10 @@
bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_scroll); bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_scroll);
void wps_display(struct mp3entry* id3); void wps_display(struct mp3entry* id3);
#ifdef PLAYER_PROGRESS
#ifdef HAVE_LCD_CHARCELLS
void draw_player_progress(int x, int y, struct mp3entry* id3);
#endif
#endif
#endif #endif

View file

@ -29,8 +29,4 @@ 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); bool refresh_wps(bool refresh_scroll);
#ifdef PLAYER_PROGRESS
void draw_player_progress(int x, int y);
#endif
#endif #endif