From ebcf06d237121475a897b828a4b6a29a9cd649d2 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Sat, 18 Aug 2007 23:03:03 +0000 Subject: [PATCH] Make peakmeter release setting work in units per tick (was units per read), add the unit and make it voiced. Make old leftover in lang file deprecated git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14390 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/option_select.c | 1 + apps/lang/english.lang | 25 ++++++++++++++++++------- apps/recorder/peakmeter.c | 15 ++++++++++++--- apps/settings_list.c | 2 +- apps/talk.c | 2 ++ apps/talk.h | 1 + 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index ddd0f7f9b7..7b6322ff91 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -42,6 +42,7 @@ static const char *unit_strings[] = [UNIT_PER_SEC] = "per sec", [UNIT_HERTZ] = "Hz", [UNIT_MB] = "MB", [UNIT_KBIT] = "kb/s", + [UNIT_PM_TICK] = "units/10ms", }; char *option_get_valuestring(struct settings_list *setting, diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 53c673a388..47acda9c62 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3566,19 +3566,16 @@ id: LANG_PM_UNITS_PER_READ - desc: in the peak meter menu + desc: DEPRECATED user: - *: "Units Per Read" - masd: none + *: "" - *: "Units Per Read" - masd: none + *: "" - *: "Units Per Read" - masd: none + *: "" @@ -11043,3 +11040,17 @@ *: "Only when viewing all types" + + id: VOICE_PM_UNITS_PER_TICK + desc: spoken only, peak meter release unit + user: + + *: "" + + + *: "" + + + *: "units per tick" + + diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index f06b19ab2d..097c98f29d 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -880,6 +880,7 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales, int left = 0, right = 0; int meterwidth = width - 3; int i; + static long peak_release_tick = 0; #ifdef PM_DEBUG static long pm_tick = 0; @@ -934,9 +935,17 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales, } /* apply release */ - left = MAX(left , scales->last_left - pm_peak_release); - right = MAX(right, scales->last_right - pm_peak_release); - + if(current_tick != peak_release_tick) + { + peak_release_tick = current_tick; + left = MAX(left , scales->last_left - pm_peak_release); + right = MAX(right, scales->last_right - pm_peak_release); + } + else + { + left = MAX(left , scales->last_left); + right = MAX(right, scales->last_right); + } /* reset max values after timeout */ if (TIME_AFTER(current_tick, scales->pm_peak_timeout_l)){ scales->pm_peak_left = 0; diff --git a/apps/settings_list.c b/apps/settings_list.c index 5341c80e90..cfac08835c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -708,7 +708,7 @@ const struct settings_list settings[] = { TALK_ID(10, UNIT_SEC), TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), TALK_ID(30, UNIT_SEC), TALK_ID(60, UNIT_SEC)), INT_SETTING(0, peak_meter_release, LANG_PM_RELEASE, 8, "peak meter release", - UNIT_INT, 1, 0x7e, 1, NULL, NULL,NULL), + UNIT_PM_TICK, 1, 0x7e, 1, NULL, NULL,NULL), OFFON_SETTING(0,peak_meter_dbfs,LANG_PM_DBFS,true,"peak meter dbfs",NULL), {F_T_INT,&global_settings.peak_meter_min,LANG_PM_MIN,INT(60),"peak meter min",NULL,UNUSED}, {F_T_INT,&global_settings.peak_meter_max,LANG_PM_MAX,INT(0),"peak meter max",NULL,UNUSED}, diff --git a/apps/talk.c b/apps/talk.c index ef8c22225c..9e73f71084 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -782,6 +782,8 @@ int talk_value(long n, int unit, bool enqueue) = LANG_MEGABYTE, [UNIT_KBIT] = VOICE_KBIT_PER_SEC, + [UNIT_PM_TICK] + = VOICE_PM_UNITS_PER_TICK, }; #if CONFIG_CODEC != SWCODEC diff --git a/apps/talk.h b/apps/talk.h index 5374ae9b20..b016acba59 100644 --- a/apps/talk.h +++ b/apps/talk.h @@ -43,6 +43,7 @@ enum { UNIT_HERTZ, /* hertz */ UNIT_MB, /* Megabytes */ UNIT_KBIT, /* kilobits per sec */ + UNIT_PM_TICK, /* peak meter units per tick */ UNIT_LAST /* END MARKER */ };