summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-12-17 22:27:55 -0600
committerWilliam Wilgus <me.theuser@yahoo.com>2018-12-22 12:27:21 -0600
commita06d9c85f7475d650cc451fb0f537623c0206f5a (patch)
tree952a0e7265e836328873a5e2f6eb0ca8ec3cc06a /apps/recorder
parentb3356e3aff34a4ab94778e7f6a8db43f9135296c (diff)
downloadrockbox-a06d9c85f7475d650cc451fb0f537623c0206f5a.tar.gz
rockbox-a06d9c85f7475d650cc451fb0f537623c0206f5a.tar.bz2
rockbox-a06d9c85f7475d650cc451fb0f537623c0206f5a.zip
Auto-Ranging Time Formatting For Menus (hh:mm:ss:mss)
Unifies time formatting in settings_list.c allows time format to display as HH:MM:SS.MSS or any consecutive combination thereof (hh:mm:ss, mm:ss, mm:ss.mss, ss.mss, hh, mm, ss ,mss) works in INT and TABLE settings with the addition of flag 'F_TIME_SETTING' Time is auto-ranged dependent on value Adds talk_time_intervals to allow time values to be spoken similar to display format: x Hours, x Minutes, x Seconds, x Milliseconds Table lookups merged or removed from recording, clip meter and lcd timeout -String_Choice replaced with TABLE_SETTING or INT_SETTING for these functions as well, cleaned-up cfg_vals that get saved to cfgfile RTL Languages ARE supported Negative values ARE supported Backlight on/off are now Always and Never to share formatter with LCD Timeout Added flag to allow ranged units to be locked to a minimum index Added flag to allow leading zero to be supressed from the largest unit merged talk_time_unit() and talk_time_intervals() optimized time_split() optimized format_time_auto() Backlight time-out list same as original Change-Id: I59027c62d3f2956bd16fdcc1a48b2ac32c084abd
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/peakmeter.c52
-rw-r--r--apps/recorder/peakmeter.h2
-rw-r--r--apps/recorder/recording.c32
3 files changed, 18 insertions, 68 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 48a695b933..5ff2f21215 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -97,10 +97,10 @@ static unsigned short pm_db_min = 0; /* minimum of range in 1/100 dB */
static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */
static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */
/* Timing behaviour */
-static int pm_peak_hold = 1; /* peak hold timeout index */
-static int pm_peak_release = 8; /* peak release in units per read */
-static int pm_clip_hold = 16; /* clip hold timeout index */
-static bool pm_clip_eternal = false; /* true if clip timeout is disabled */
+static int pm_peak_hold = HZ / 5; /* peak hold timeout ticks */
+static int pm_peak_release = 8; /* peak release in units per read */
+static int pm_clip_hold = HZ * 60; /* clip hold timeout ticks */
+static bool pm_clip_eternal = false; /* true if clip timeout is disabled */
#ifdef HAVE_RECORDING
static unsigned short trig_strt_threshold;
@@ -172,22 +172,6 @@ static int history_pos = 0;
static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales,
int x, int y, int width, int height);
-/* time out values for max */
-static const short peak_time_out[] = {
- 0 * HZ, HZ / 5, 30, HZ / 2, HZ, 2 * HZ,
- 3 * HZ, 4 * HZ, 5 * HZ, 6 * HZ, 7 * HZ, 8 * HZ,
- 9 * HZ, 10 * HZ, 15 * HZ, 20 * HZ, 30 * HZ, 60 * HZ
-};
-
-/* time out values for clip */
-static const long clip_time_out[] = {
- 0 * HZ, 1 * HZ, 2 * HZ, 3 * HZ, 4 * HZ, 5 * HZ,
- 6 * HZ, 7 * HZ, 8 * HZ, 9 * HZ, 10 * HZ, 15 * HZ,
- 20 * HZ, 25 * HZ, 30 * HZ, 45 * HZ, 60 * HZ, 90 * HZ,
- 120 * HZ, 180 * HZ, 300 * HZ, 600L * HZ, 1200L * HZ,
- 2700L * HZ, 5400L * HZ
-};
-
/* precalculated peak values that represent magical
dBfs values. Used to draw the scale */
static const short db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = {
@@ -522,18 +506,16 @@ void peak_meter_init_range( bool dbfs, int range_min, int range_max)
* Initialize the peak meter with all relevant values concerning times.
* @param int release - Set the maximum amount of pixels the meter is allowed
* to decrease with each redraw
- * @param int hold - Select the time preset for the time the peak indicator
- * is reset after a peak occurred. The preset values are
- * stored in peak_time_out.
- * @param int clip_hold - Select the time preset for the time the peak
- * indicator is reset after a peak occurred. The preset
- * values are stored in clip_time_out.
+ * @param int hold_ms - Select the time in ms for the time the peak indicator
+ * is reset after a peak occurred.
+ * @param int clip_hold_sec - Select the time in seconds for the time the peak
+ * indicator is reset after a peak occurred.
*/
-void peak_meter_init_times(int release, int hold, int clip_hold)
+void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec)
{
- pm_peak_hold = hold;
+ pm_peak_hold = hold_ms/(1000UL/HZ); /* convert ms to ticks */
pm_peak_release = release;
- pm_clip_hold = clip_hold;
+ pm_clip_hold = HZ * clip_hold_sec;
}
#ifdef HAVE_RECORDING
@@ -657,8 +639,7 @@ void peak_meter_peek(void)
(left == MAX_PEAK - 1)) {
#endif
pm_clip_left = true;
- pm_clip_timeout_l =
- current_tick + clip_time_out[pm_clip_hold];
+ pm_clip_timeout_l = current_tick + pm_clip_hold;
}
#if CONFIG_CODEC == SWCODEC
@@ -668,8 +649,7 @@ void peak_meter_peek(void)
(right == MAX_PEAK - 1)) {
#endif
pm_clip_right = true;
- pm_clip_timeout_r =
- current_tick + clip_time_out[pm_clip_hold];
+ pm_clip_timeout_r = current_tick + pm_clip_hold;
}
#ifdef HAVE_RECORDING
@@ -1099,14 +1079,12 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales,
/* check for new max values */
if (left > scales->pm_peak_left) {
scales->pm_peak_left = left - 1;
- scales->pm_peak_timeout_l =
- current_tick + peak_time_out[pm_peak_hold];
+ scales->pm_peak_timeout_l = current_tick + pm_peak_hold;
}
if (right > scales->pm_peak_right) {
scales->pm_peak_right = right - 1;
- scales->pm_peak_timeout_r =
- current_tick + peak_time_out[pm_peak_hold];
+ scales->pm_peak_timeout_r = current_tick + pm_peak_hold;
}
}
diff --git a/apps/recorder/peakmeter.h b/apps/recorder/peakmeter.h
index 267ca20442..fc6c2183af 100644
--- a/apps/recorder/peakmeter.h
+++ b/apps/recorder/peakmeter.h
@@ -44,7 +44,7 @@ extern int peak_meter_draw_get_btn(int action_context, int x[], int y[],
extern void peak_meter_set_clip_hold(int time);
extern void peak_meter_peek(void);
extern void peak_meter_init_range( bool dbfs, int range_min, int range_max);
-extern void peak_meter_init_times(int release, int hold, int clip_hold);
+extern void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec);
#ifdef HAVE_AGC
extern void peak_meter_get_peakhold(int *peak_left, int *peak_right);
#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index d47773071f..0098fea007 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -78,34 +78,6 @@
#include "appevents.h"
#ifdef HAVE_RECORDING
-/* This array holds the record timer interval lengths, in minutes */
-static const unsigned short rec_timer_minutes[] =
-{
- 0, /* 0 means OFF */
- 5, /* 00:05 */
- 10, /* 00:10 */
- 15, /* 00:15 */
- 30, /* 00:30 */
- 60, /* 01:00 */
- 74, /* 01:14 */
- 80, /* 01:20 */
- 2*60, /* 02:00 */
- 4*60, /* 04:00 */
- 6*60, /* 06:00 */
- 8*60, /* 08:00 */
- 10*60, /* 10:00 */
- 12*60, /* 12:00 */
- 18*60, /* 18:00 */
- 24*60 /* 24:00 */
-};
-
-static unsigned int rec_timesplit_seconds(void)
-{
- unsigned long tm_min = rec_timer_minutes[global_settings.rec_timesplit];
- unsigned long tm_sec = tm_min * 60;
- return tm_sec;
-}
-
/* This array holds the record size interval lengths, in mebibytes */
static const unsigned short rec_size_mbytes[] =
{
@@ -1003,8 +975,8 @@ bool recording_screen(bool no_source)
int audio_stat = 0; /* status of the audio system */
int last_audio_stat = -1; /* previous status so we can act on changes */
struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; /* the viewports */
- const long split_seconds = rec_timesplit_seconds();
- const long split_bytes = rec_sizesplit_bytes();
+ const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit;
+ const unsigned long split_bytes = rec_sizesplit_bytes();
#if CONFIG_CODEC == SWCODEC
int warning_counter = 0;