diff options
author | Markus Braun <markus.braun@krawel.de> | 2002-08-09 11:57:31 +0000 |
---|---|---|
committer | Markus Braun <markus.braun@krawel.de> | 2002-08-09 11:57:31 +0000 |
commit | 9bf86f75fac571e79e9fd85632704e43fb026ae1 (patch) | |
tree | 2e9fa73be15037323f22ef288d8a0159bd8de1bc /apps/recorder/icons.c | |
parent | ded1ef158a077c8dd75aeb84b428759082bda68b (diff) | |
download | rockbox-9bf86f75fac571e79e9fd85632704e43fb026ae1.tar.gz rockbox-9bf86f75fac571e79e9fd85632704e43fb026ae1.zip |
Volume is shown numerical after a change
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1642 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/icons.c')
-rw-r--r-- | apps/recorder/icons.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 89d7186224..78d07dbd1a 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include <lcd.h> | 19 | #include <lcd.h> |
20 | #include "kernel.h" | ||
20 | 21 | ||
21 | #include "icons.h" | 22 | #include "icons.h" |
22 | #ifndef SIMULATOR | 23 | #ifndef SIMULATOR |
@@ -208,6 +209,9 @@ void statusbar_icon_volume(int percent) | |||
208 | int i,j; | 209 | int i,j; |
209 | int volume; | 210 | int volume; |
210 | int step=0; | 211 | int step=0; |
212 | char buffer[4]; | ||
213 | static long switch_tick; | ||
214 | static int last_volume; | ||
211 | 215 | ||
212 | volume=percent; | 216 | volume=percent; |
213 | if(volume<0) | 217 | if(volume<0) |
@@ -218,12 +222,22 @@ void statusbar_icon_volume(int percent) | |||
218 | if(volume==0) | 222 | if(volume==0) |
219 | lcd_bitmap(bitmap_icon_7x8[Icon_Mute], ICON_VOLUME_X_POS+ICON_VOLUME_WIDTH/2-4, STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false); | 223 | lcd_bitmap(bitmap_icon_7x8[Icon_Mute], ICON_VOLUME_X_POS+ICON_VOLUME_WIDTH/2-4, STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false); |
220 | else { | 224 | else { |
221 | volume=volume*14/100; | 225 | if(last_volume!=volume) { |
222 | for(i=0;i<volume;i++) { | 226 | switch_tick=current_tick+HZ; |
223 | if(i%2 == 0) | 227 | last_volume=volume; |
224 | step++; | 228 | } |
225 | for(j=1;j<=step;j++) | 229 | if(TIME_BEFORE(current_tick,switch_tick)) { /* display volume lever numerical */ |
226 | DRAW_PIXEL((ICON_VOLUME_X_POS+i),(STATUSBAR_Y_POS+7-j)); | 230 | snprintf(buffer, sizeof(buffer), "%2d", percent); |
231 | lcd_putsxy(ICON_VOLUME_X_POS+ICON_VOLUME_WIDTH/2-6, STATUSBAR_Y_POS, buffer, 0); | ||
232 | } | ||
233 | else { /* display volume bar */ | ||
234 | volume=volume*14/100; | ||
235 | for(i=0;i<volume;i++) { | ||
236 | if(i%2 == 0) | ||
237 | step++; | ||
238 | for(j=1;j<=step;j++) | ||
239 | DRAW_PIXEL((ICON_VOLUME_X_POS+i),(STATUSBAR_Y_POS+7-j)); | ||
240 | } | ||
227 | } | 241 | } |
228 | } | 242 | } |
229 | } | 243 | } |