forked from len0rd/rockbox
Check id3 data every second
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1188 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1d1c9597c4
commit
37bbaf7e8d
2 changed files with 67 additions and 55 deletions
97
apps/wps.c
97
apps/wps.c
|
|
@ -38,12 +38,8 @@
|
||||||
#define PLAY_DISPLAY_FILENAME_SCROLL 1
|
#define PLAY_DISPLAY_FILENAME_SCROLL 1
|
||||||
#define PLAY_DISPLAY_TRACK_TITLE 2
|
#define PLAY_DISPLAY_TRACK_TITLE 2
|
||||||
|
|
||||||
/* demonstrates showing different formats from playtune */
|
static void draw_screen(struct mp3entry* id3)
|
||||||
void wps_show(void)
|
|
||||||
{
|
{
|
||||||
struct mp3entry* id3 = mpeg_current_track();
|
|
||||||
static bool playing = true;
|
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
switch ( global_settings.wps_display ) {
|
switch ( global_settings.wps_display ) {
|
||||||
case PLAY_DISPLAY_TRACK_TITLE:
|
case PLAY_DISPLAY_TRACK_TITLE:
|
||||||
|
|
@ -84,33 +80,54 @@ void wps_show(void)
|
||||||
case PLAY_DISPLAY_DEFAULT:
|
case PLAY_DISPLAY_DEFAULT:
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
char buffer[256];
|
char buffer[64];
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
lcd_puts(0, 0, "[id3 info]");
|
lcd_puts(0, l++, id3->title?id3->title:"");
|
||||||
lcd_puts(0, LINE_Y, id3->title?id3->title:"");
|
lcd_puts(0, l++, id3->album?id3->album:"");
|
||||||
lcd_puts(0, LINE_Y+1, id3->album?id3->album:"");
|
lcd_puts(0, l++, id3->artist?id3->artist:"");
|
||||||
lcd_puts(0, LINE_Y+2, id3->artist?id3->artist:"");
|
|
||||||
|
|
||||||
snprintf(buffer,sizeof(buffer), "%d ms", id3->length);
|
snprintf(buffer,sizeof(buffer), "%d ms", id3->length);
|
||||||
lcd_puts(0, LINE_Y+3, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
|
|
||||||
snprintf(buffer,sizeof(buffer), "%d kbits", id3->bitrate);
|
snprintf(buffer,sizeof(buffer), "%d kbits", id3->bitrate);
|
||||||
|
|
||||||
lcd_puts(0, LINE_Y+4, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
|
|
||||||
snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency);
|
snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency);
|
||||||
lcd_puts(0, LINE_Y+5, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
lcd_puts(0, 0, id3->artist?id3->artist:"<no artist>");
|
lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>");
|
||||||
lcd_puts(0, 1, id3->title?id3->title:"<no title>");
|
lcd_puts(0, l++, id3->title?id3->title:"<no title>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* demonstrates showing different formats from playtune */
|
||||||
|
void wps_show(void)
|
||||||
|
{
|
||||||
|
static bool playing = true;
|
||||||
|
struct mp3entry* id3 = mpeg_current_track();
|
||||||
|
int lastlength=0, lastsize=0, lastrate=0;
|
||||||
|
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
switch ( button_get(true) ) {
|
int i;
|
||||||
|
|
||||||
|
if ( ( id3->length != lastlength ) ||
|
||||||
|
( id3->filesize != lastsize ) ||
|
||||||
|
( id3->bitrate != lastrate ) ) {
|
||||||
|
draw_screen(id3);
|
||||||
|
lastlength = id3->length;
|
||||||
|
lastsize = id3->filesize;
|
||||||
|
lastrate = id3->bitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i=0;i<20;i++ ) {
|
||||||
|
switch ( button_get(false) ) {
|
||||||
case BUTTON_ON:
|
case BUTTON_ON:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -126,34 +143,30 @@ void wps_show(void)
|
||||||
|
|
||||||
playing = !playing;
|
playing = !playing;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* experimental idea still being sorted out, but want it in the the code tree still so that important playlist info is not forgotten. */
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
#if 0
|
case BUTTON_UP:
|
||||||
void wps_show_playlist(char* current, playlist_info_t *list)
|
|
||||||
{
|
|
||||||
char ch = '/';
|
|
||||||
char* szLast = strrchr(current, ch);
|
|
||||||
char buf[16];
|
|
||||||
|
|
||||||
buf[15] = 0;
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "[%d/%d]", list->index, list->amount);
|
|
||||||
|
|
||||||
lcd_clear_display();
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
lcd_puts(0, 0, "[Playlist Mode]");
|
|
||||||
lcd_puts_scroll(0,LINE_Y, (++szLast));
|
|
||||||
lcd_puts(0, LINE_Y+1, buf);
|
|
||||||
#else
|
#else
|
||||||
lcd_puts_scroll(0,0, (++szLast));
|
case BUTTON_RIGHT:
|
||||||
lcd_puts(0,1,buf);
|
|
||||||
#endif
|
#endif
|
||||||
|
global_settings.volume += 2;
|
||||||
|
if(global_settings.volume > 100)
|
||||||
|
global_settings.volume = 100;
|
||||||
|
mpeg_volume(global_settings.volume);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
lcd_update();
|
case BUTTON_DOWN:
|
||||||
|
#else
|
||||||
|
case BUTTON_LEFT:
|
||||||
|
#endif
|
||||||
|
global_settings.volume -= 2;
|
||||||
|
if(global_settings.volume < 0)
|
||||||
|
global_settings.volume = 0;
|
||||||
|
mpeg_volume(global_settings.volume);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sleep(HZ/20);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,5 @@
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
|
||||||
void wps_show(void);
|
void wps_show(void);
|
||||||
//void wps_show_playlist(char* current, playlist_info_t *list);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue