summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-25 15:04:08 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-25 15:04:08 +0000
commit37bbaf7e8d1ecdfa3de9639077d3f3148730af1f (patch)
tree7dcd8f9bbef6eb7b256e263d2bd3b52580ff2432 /apps
parent1d1c9597c461ac71dbf0945179c8c01aab38c869 (diff)
downloadrockbox-37bbaf7e8d1ecdfa3de9639077d3f3148730af1f.zip
rockbox-37bbaf7e8d1ecdfa3de9639077d3f3148730af1f.tar.gz
rockbox-37bbaf7e8d1ecdfa3de9639077d3f3148730af1f.tar.bz2
rockbox-37bbaf7e8d1ecdfa3de9639077d3f3148730af1f.tar.xz
Check id3 data every second
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1188 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/wps.c119
-rw-r--r--apps/wps.h1
2 files changed, 66 insertions, 54 deletions
diff --git a/apps/wps.c b/apps/wps.c
index bd23a28..43ac28e 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -38,12 +38,8 @@
#define PLAY_DISPLAY_FILENAME_SCROLL 1
#define PLAY_DISPLAY_TRACK_TITLE 2
-/* demonstrates showing different formats from playtune */
-void wps_show(void)
+static void draw_screen(struct mp3entry* id3)
{
- struct mp3entry* id3 = mpeg_current_track();
- static bool playing = true;
-
lcd_clear_display();
switch ( global_settings.wps_display ) {
case PLAY_DISPLAY_TRACK_TITLE:
@@ -84,76 +80,93 @@ void wps_show(void)
case PLAY_DISPLAY_DEFAULT:
{
#ifdef HAVE_LCD_BITMAP
- char buffer[256];
+ char buffer[64];
+ int l = 0;
- lcd_puts(0, 0, "[id3 info]");
- lcd_puts(0, LINE_Y, id3->title?id3->title:"");
- lcd_puts(0, LINE_Y+1, id3->album?id3->album:"");
- lcd_puts(0, LINE_Y+2, id3->artist?id3->artist:"");
+ lcd_puts(0, l++, id3->title?id3->title:"");
+ lcd_puts(0, l++, id3->album?id3->album:"");
+ lcd_puts(0, l++, id3->artist?id3->artist:"");
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);
- lcd_puts(0, LINE_Y+4, buffer);
+ lcd_puts(0, l++, buffer);
snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency);
- lcd_puts(0, LINE_Y+5, buffer);
+ lcd_puts(0, l++, buffer);
#else
- lcd_puts(0, 0, id3->artist?id3->artist:"<no artist>");
- lcd_puts(0, 1, id3->title?id3->title:"<no title>");
+ lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>");
+ lcd_puts(0, l++, id3->title?id3->title:"<no title>");
#endif
break;
}
}
lcd_update();
- while ( 1 ) {
- switch ( button_get(true) ) {
- case BUTTON_ON:
- return;
+}
-#ifdef HAVE_RECORDER_KEYPAD
- case BUTTON_PLAY:
-#else
- case BUTTON_UP:
-#endif
- if ( playing )
- mpeg_pause();
- else
- mpeg_resume();
+/* 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;
- playing = !playing;
- break;
+ while ( 1 ) {
+ int i;
+
+ if ( ( id3->length != lastlength ) ||
+ ( id3->filesize != lastsize ) ||
+ ( id3->bitrate != lastrate ) ) {
+ draw_screen(id3);
+ lastlength = id3->length;
+ lastsize = id3->filesize;
+ lastrate = id3->bitrate;
}
- }
-}
-/* experimental idea still being sorted out, but want it in the the code tree still so that important playlist info is not forgotten. */
-#if 0
-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();
+ for ( i=0;i<20;i++ ) {
+ switch ( button_get(false) ) {
+ case BUTTON_ON:
+ return;
-#ifdef HAVE_LCD_BITMAP
- lcd_puts(0, 0, "[Playlist Mode]");
- lcd_puts_scroll(0,LINE_Y, (++szLast));
- lcd_puts(0, LINE_Y+1, buf);
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_PLAY:
#else
- lcd_puts_scroll(0,0, (++szLast));
- lcd_puts(0,1,buf);
+ case BUTTON_UP:
#endif
+ if ( playing )
+ mpeg_pause();
+ else
+ mpeg_resume();
+ playing = !playing;
+ break;
- lcd_update();
-}
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_UP:
+#else
+ case BUTTON_RIGHT:
+#endif
+ global_settings.volume += 2;
+ if(global_settings.volume > 100)
+ global_settings.volume = 100;
+ mpeg_volume(global_settings.volume);
+ break;
+
+#ifdef HAVE_RECORDER_KEYPAD
+ 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);
+ }
+ }
+}
diff --git a/apps/wps.h b/apps/wps.h
index 4963ffe..5a7d816 100644
--- a/apps/wps.h
+++ b/apps/wps.h
@@ -22,6 +22,5 @@
#include "playlist.h"
void wps_show(void);
-//void wps_show_playlist(char* current, playlist_info_t *list);
#endif