From 99a0598c284471342fcda1fdcba90d4b666bfbb3 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 29 Aug 2005 20:07:17 +0000 Subject: Major peakmeter rework: * Changed set/get functions for dbfs mode to bool type. * Removed performance setting, leaving (slightly adapted) high performance mode only. * Refresh rate is always 20 Hz now. * Readout doesn't do an extra (hidden) peek, should allow for slightly better clip detection. * Brought back high performance peakmeter for recording. Peakmeter stops hogging the CPU when the disk is spinning; this is enough to avoid the performance problem when saving data. * Optimisations, code cleanup and code policeing. * (iriver) Reduced CPU load of peakmeter by not calculating excessive overlaps. ** Bumped config block version, so save your settings before upgrading. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7415 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps.c | 51 +++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) (limited to 'apps/wps.c') diff --git a/apps/wps.c b/apps/wps.c index bf0283015f..784289ada4 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -391,46 +391,29 @@ long wps_show(void) #ifdef HAVE_LCD_BITMAP /* when the peak meter is enabled we want to have a few extra updates to make it look smooth. On the - other hand we don't want to waste energy if it + other hand we don't want to waste energy if it isn't displayed */ if (peak_meter_enabled) { - int i; - - /* In high performance mode we read out the mas as - often as we can. There is no sleep for cpu */ - if (global_settings.peak_meter_performance) { - long next_refresh = current_tick; - long next_big_refresh = current_tick + HZ / 5; - button = BUTTON_NONE; - while (!TIME_AFTER(current_tick, next_big_refresh)) { - button = button_get(false); - if (button != BUTTON_NONE) { - break; - } - peak_meter_peek(); - sleep(1); - - if (TIME_AFTER(current_tick, next_refresh)) { - wps_refresh(id3, nid3, 0, WPS_REFRESH_PEAK_METER); - next_refresh = current_tick + HZ / peak_meter_fps; - } + long next_refresh = current_tick; + long next_big_refresh = current_tick + HZ / 5; + button = BUTTON_NONE; + while (TIME_BEFORE(current_tick, next_big_refresh)) { + button = button_get(false); + if (button != BUTTON_NONE) { + break; } - } - - /* In energy saver mode the cpu may sleep a - little bit while waiting for buttons */ - else { - for (i = 0; i < 4; i++) { - button = button_get_w_tmo(HZ / peak_meter_fps); - if (button != 0) { - break; - } + peak_meter_peek(); + sleep(0); /* Sleep until end of current tick. */ + + if (TIME_AFTER(current_tick, next_refresh)) { wps_refresh(id3, nid3, 0, WPS_REFRESH_PEAK_METER); + next_refresh += HZ / PEAK_METER_FPS; } } - } - - /* The peak meter is disabled + + } + + /* The peak meter is disabled -> no additional screen updates needed */ else { button = button_get_w_tmo(HZ/5); -- cgit v1.2.3