diff options
-rw-r--r-- | apps/wps.c | 119 | ||||
-rw-r--r-- | apps/wps.h | 1 |
2 files changed, 66 insertions, 54 deletions
diff --git a/apps/wps.c b/apps/wps.c index bd23a28557..43ac28e838 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -38,12 +38,8 @@ | |||
38 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 | 38 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 |
39 | #define PLAY_DISPLAY_TRACK_TITLE 2 | 39 | #define PLAY_DISPLAY_TRACK_TITLE 2 |
40 | 40 | ||
41 | /* demonstrates showing different formats from playtune */ | 41 | static void draw_screen(struct mp3entry* id3) |
42 | void wps_show(void) | ||
43 | { | 42 | { |
44 | struct mp3entry* id3 = mpeg_current_track(); | ||
45 | static bool playing = true; | ||
46 | |||
47 | lcd_clear_display(); | 43 | lcd_clear_display(); |
48 | switch ( global_settings.wps_display ) { | 44 | switch ( global_settings.wps_display ) { |
49 | case PLAY_DISPLAY_TRACK_TITLE: | 45 | case PLAY_DISPLAY_TRACK_TITLE: |
@@ -84,76 +80,93 @@ void wps_show(void) | |||
84 | case PLAY_DISPLAY_DEFAULT: | 80 | case PLAY_DISPLAY_DEFAULT: |
85 | { | 81 | { |
86 | #ifdef HAVE_LCD_BITMAP | 82 | #ifdef HAVE_LCD_BITMAP |
87 | char buffer[256]; | 83 | char buffer[64]; |
84 | int l = 0; | ||
88 | 85 | ||
89 | lcd_puts(0, 0, "[id3 info]"); | 86 | lcd_puts(0, l++, id3->title?id3->title:""); |
90 | lcd_puts(0, LINE_Y, id3->title?id3->title:""); | 87 | lcd_puts(0, l++, id3->album?id3->album:""); |
91 | lcd_puts(0, LINE_Y+1, id3->album?id3->album:""); | 88 | lcd_puts(0, l++, id3->artist?id3->artist:""); |
92 | lcd_puts(0, LINE_Y+2, id3->artist?id3->artist:""); | ||
93 | 89 | ||
94 | snprintf(buffer,sizeof(buffer), "%d ms", id3->length); | 90 | snprintf(buffer,sizeof(buffer), "%d ms", id3->length); |
95 | lcd_puts(0, LINE_Y+3, buffer); | 91 | lcd_puts(0, l++, buffer); |
96 | 92 | ||
97 | snprintf(buffer,sizeof(buffer), "%d kbits", id3->bitrate); | 93 | snprintf(buffer,sizeof(buffer), "%d kbits", id3->bitrate); |
98 | 94 | ||
99 | lcd_puts(0, LINE_Y+4, buffer); | 95 | lcd_puts(0, l++, buffer); |
100 | 96 | ||
101 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); | 97 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); |
102 | lcd_puts(0, LINE_Y+5, buffer); | 98 | lcd_puts(0, l++, buffer); |
103 | #else | 99 | #else |
104 | 100 | ||
105 | lcd_puts(0, 0, id3->artist?id3->artist:"<no artist>"); | 101 | lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>"); |
106 | lcd_puts(0, 1, id3->title?id3->title:"<no title>"); | 102 | lcd_puts(0, l++, id3->title?id3->title:"<no title>"); |
107 | #endif | 103 | #endif |
108 | break; | 104 | break; |
109 | } | 105 | } |
110 | } | 106 | } |
111 | lcd_update(); | 107 | lcd_update(); |
112 | while ( 1 ) { | 108 | } |
113 | switch ( button_get(true) ) { | ||
114 | case BUTTON_ON: | ||
115 | return; | ||
116 | 109 | ||
117 | #ifdef HAVE_RECORDER_KEYPAD | 110 | /* demonstrates showing different formats from playtune */ |
118 | case BUTTON_PLAY: | 111 | void wps_show(void) |
119 | #else | 112 | { |
120 | case BUTTON_UP: | 113 | static bool playing = true; |
121 | #endif | 114 | struct mp3entry* id3 = mpeg_current_track(); |
122 | if ( playing ) | 115 | int lastlength=0, lastsize=0, lastrate=0; |
123 | mpeg_pause(); | ||
124 | else | ||
125 | mpeg_resume(); | ||
126 | 116 | ||
127 | playing = !playing; | 117 | while ( 1 ) { |
128 | break; | 118 | int i; |
119 | |||
120 | if ( ( id3->length != lastlength ) || | ||
121 | ( id3->filesize != lastsize ) || | ||
122 | ( id3->bitrate != lastrate ) ) { | ||
123 | draw_screen(id3); | ||
124 | lastlength = id3->length; | ||
125 | lastsize = id3->filesize; | ||
126 | lastrate = id3->bitrate; | ||
129 | } | 127 | } |
130 | } | ||
131 | } | ||
132 | 128 | ||
133 | /* experimental idea still being sorted out, but want it in the the code tree still so that important playlist info is not forgotten. */ | 129 | for ( i=0;i<20;i++ ) { |
134 | #if 0 | 130 | switch ( button_get(false) ) { |
135 | void wps_show_playlist(char* current, playlist_info_t *list) | 131 | case BUTTON_ON: |
136 | { | 132 | return; |
137 | char ch = '/'; | ||
138 | char* szLast = strrchr(current, ch); | ||
139 | char buf[16]; | ||
140 | |||
141 | buf[15] = 0; | ||
142 | |||
143 | snprintf(buf, sizeof(buf), "[%d/%d]", list->index, list->amount); | ||
144 | |||
145 | lcd_clear_display(); | ||
146 | 133 | ||
147 | #ifdef HAVE_LCD_BITMAP | 134 | #ifdef HAVE_RECORDER_KEYPAD |
148 | lcd_puts(0, 0, "[Playlist Mode]"); | 135 | case BUTTON_PLAY: |
149 | lcd_puts_scroll(0,LINE_Y, (++szLast)); | ||
150 | lcd_puts(0, LINE_Y+1, buf); | ||
151 | #else | 136 | #else |
152 | lcd_puts_scroll(0,0, (++szLast)); | 137 | case BUTTON_UP: |
153 | lcd_puts(0,1,buf); | ||
154 | #endif | 138 | #endif |
139 | if ( playing ) | ||
140 | mpeg_pause(); | ||
141 | else | ||
142 | mpeg_resume(); | ||
155 | 143 | ||
144 | playing = !playing; | ||
145 | break; | ||
156 | 146 | ||
157 | lcd_update(); | 147 | #ifdef HAVE_RECORDER_KEYPAD |
158 | } | 148 | case BUTTON_UP: |
149 | #else | ||
150 | case BUTTON_RIGHT: | ||
151 | #endif | ||
152 | global_settings.volume += 2; | ||
153 | if(global_settings.volume > 100) | ||
154 | global_settings.volume = 100; | ||
155 | mpeg_volume(global_settings.volume); | ||
156 | break; | ||
157 | |||
158 | #ifdef HAVE_RECORDER_KEYPAD | ||
159 | case BUTTON_DOWN: | ||
160 | #else | ||
161 | case BUTTON_LEFT: | ||
159 | #endif | 162 | #endif |
163 | global_settings.volume -= 2; | ||
164 | if(global_settings.volume < 0) | ||
165 | global_settings.volume = 0; | ||
166 | mpeg_volume(global_settings.volume); | ||
167 | break; | ||
168 | } | ||
169 | sleep(HZ/20); | ||
170 | } | ||
171 | } | ||
172 | } | ||
diff --git a/apps/wps.h b/apps/wps.h index 4963ffee4f..5a7d81693b 100644 --- a/apps/wps.h +++ b/apps/wps.h | |||
@@ -22,6 +22,5 @@ | |||
22 | #include "playlist.h" | 22 | #include "playlist.h" |
23 | 23 | ||
24 | void wps_show(void); | 24 | void wps_show(void); |
25 | //void wps_show_playlist(char* current, playlist_info_t *list); | ||
26 | 25 | ||
27 | #endif | 26 | #endif |