diff options
author | William Wilgus <me.theuser@yahoo.com> | 2018-12-17 22:27:55 -0600 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2018-12-22 12:27:21 -0600 |
commit | a06d9c85f7475d650cc451fb0f537623c0206f5a (patch) | |
tree | 952a0e7265e836328873a5e2f6eb0ca8ec3cc06a | |
parent | b3356e3aff34a4ab94778e7f6a8db43f9135296c (diff) | |
download | rockbox-a06d9c85f7475d650cc451fb0f537623c0206f5a.tar.gz 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
-rw-r--r-- | apps/gui/option_select.c | 41 | ||||
-rw-r--r-- | apps/lang/english.lang | 22 | ||||
-rw-r--r-- | apps/misc.c | 237 | ||||
-rw-r--r-- | apps/misc.h | 46 | ||||
-rw-r--r-- | apps/playback.c | 18 | ||||
-rw-r--r-- | apps/recorder/peakmeter.c | 52 | ||||
-rw-r--r-- | apps/recorder/peakmeter.h | 2 | ||||
-rw-r--r-- | apps/recorder/recording.c | 32 | ||||
-rw-r--r-- | apps/screens.c | 6 | ||||
-rw-r--r-- | apps/settings.h | 6 | ||||
-rw-r--r-- | apps/settings_list.c | 396 | ||||
-rw-r--r-- | apps/settings_list.h | 1 | ||||
-rw-r--r-- | apps/talk.c | 71 | ||||
-rw-r--r-- | apps/talk.h | 3 | ||||
-rw-r--r-- | firmware/backlight.c | 18 | ||||
-rw-r--r-- | firmware/export/audio.h | 2 | ||||
-rw-r--r-- | firmware/export/backlight.h | 2 |
17 files changed, 619 insertions, 336 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index f99e833a1e..9cdd79cce6 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -48,18 +48,15 @@ int option_value_as_int(const struct settings_list *setting) | |||
48 | temp = *(int*)setting->setting; | 48 | temp = *(int*)setting->setting; |
49 | return temp; | 49 | return temp; |
50 | } | 50 | } |
51 | static const char *unit_strings[] = | 51 | |
52 | { | 52 | /* return an auto ranged time string, unit_idx specifies lowest or |
53 | [UNIT_INT] = "", [UNIT_MS] = "ms", | 53 | base index of the passed value -- flag F_TIME_SETTING calls this */ |
54 | [UNIT_SEC] = "s", [UNIT_MIN] = "min", | 54 | static const char *option_get_timestring(char *buf, int buf_len, |
55 | [UNIT_HOUR]= "hr", [UNIT_KHZ] = "kHz", | 55 | int val, int unit_idx) |
56 | [UNIT_DB] = "dB", [UNIT_PERCENT] = "%", | 56 | { |
57 | [UNIT_MAH] = "mAh", [UNIT_PIXEL] = "px", | 57 | return format_time_auto(buf, buf_len, val, unit_idx | UNIT_TRIM_ZERO, false); |
58 | [UNIT_PER_SEC] = "per sec", | 58 | } |
59 | [UNIT_HERTZ] = "Hz", | 59 | |
60 | [UNIT_MB] = "MB", [UNIT_KBIT] = "kb/s", | ||
61 | [UNIT_PM_TICK] = "units/10ms", | ||
62 | }; | ||
63 | /* these two vars are needed so arbitrary values can be added to the | 60 | /* these two vars are needed so arbitrary values can be added to the |
64 | TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ | 61 | TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ |
65 | static int table_setting_oldval = 0, table_setting_array_position = 0; | 62 | static int table_setting_oldval = 0, table_setting_array_position = 0; |
@@ -87,22 +84,28 @@ const char *option_get_valuestring(const struct settings_list *setting, | |||
87 | { | 84 | { |
88 | const struct int_setting *int_info = setting->int_setting; | 85 | const struct int_setting *int_info = setting->int_setting; |
89 | const struct table_setting *tbl_info = setting->table_setting; | 86 | const struct table_setting *tbl_info = setting->table_setting; |
90 | const char *unit; | 87 | int info_unit; |
88 | const char *str_unit; | ||
91 | const char* (*formatter)(char*, size_t, int, const char*); | 89 | const char* (*formatter)(char*, size_t, int, const char*); |
92 | if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) | 90 | if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) |
93 | { | 91 | { |
94 | formatter = int_info->formatter; | 92 | formatter = int_info->formatter; |
95 | unit = unit_strings[int_info->unit]; | 93 | info_unit = int_info->unit; |
96 | } | 94 | } |
97 | else | 95 | else |
98 | { | 96 | { |
99 | formatter = tbl_info->formatter; | 97 | formatter = tbl_info->formatter; |
100 | unit = unit_strings[tbl_info->unit]; | 98 | info_unit = tbl_info->unit; |
101 | } | 99 | } |
100 | |||
101 | if ((setting->flags & F_TIME_SETTING) == F_TIME_SETTING) | ||
102 | str = option_get_timestring(buffer, buf_len, (long)temp_var, info_unit); | ||
103 | |||
104 | str_unit = unit_strings_core[info_unit]; | ||
102 | if (formatter) | 105 | if (formatter) |
103 | str = formatter(buffer, buf_len, (int)temp_var, unit); | 106 | str = formatter(buffer, buf_len, (int)temp_var, str_unit); |
104 | else | 107 | else if ((setting->flags & F_TIME_SETTING) != F_TIME_SETTING) |
105 | snprintf(buffer, buf_len, "%d %s", (int)temp_var, unit?unit:""); | 108 | snprintf(buffer, buf_len, "%d %s", (int)temp_var, str_unit?str_unit:""); |
106 | } | 109 | } |
107 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) | 110 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) |
108 | { | 111 | { |
@@ -167,6 +170,8 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu | |||
167 | } | 170 | } |
168 | if (get_talk_id) | 171 | if (get_talk_id) |
169 | talk_id(get_talk_id(value, unit), enqueue); | 172 | talk_id(get_talk_id(value, unit), enqueue); |
173 | else if ((setting->flags & F_TIME_SETTING) == F_TIME_SETTING) | ||
174 | talk_time_intervals(value, unit, enqueue); | ||
170 | else | 175 | else |
171 | talk_value(value, unit, enqueue); | 176 | talk_value(value, unit, enqueue); |
172 | } | 177 | } |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 0a3c34b416..a2a23d0627 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -2697,19 +2697,19 @@ | |||
2697 | </phrase> | 2697 | </phrase> |
2698 | <phrase> | 2698 | <phrase> |
2699 | id: LANG_NEVER | 2699 | id: LANG_NEVER |
2700 | desc: in lcd settings | 2700 | desc: deprecated |
2701 | user: core | 2701 | user: core |
2702 | <source> | 2702 | <source> |
2703 | *: none | 2703 | *: none |
2704 | lcd_sleep: "Never" | 2704 | lcd_sleep: "" |
2705 | </source> | 2705 | </source> |
2706 | <dest> | 2706 | <dest> |
2707 | *: none | 2707 | *: none |
2708 | lcd_sleep: "Never" | 2708 | lcd_sleep: "" |
2709 | </dest> | 2709 | </dest> |
2710 | <voice> | 2710 | <voice> |
2711 | *: none | 2711 | *: none |
2712 | lcd_sleep: "Never" | 2712 | lcd_sleep: "" |
2713 | </voice> | 2713 | </voice> |
2714 | </phrase> | 2714 | </phrase> |
2715 | <phrase> | 2715 | <phrase> |
@@ -13787,3 +13787,17 @@ | |||
13787 | *: "No viewers found" | 13787 | *: "No viewers found" |
13788 | </voice> | 13788 | </voice> |
13789 | </phrase> | 13789 | </phrase> |
13790 | <phrase> | ||
13791 | id: LANG__NEVER | ||
13792 | desc: in lcd settings | ||
13793 | user: core | ||
13794 | <source> | ||
13795 | *: "Never" | ||
13796 | </source> | ||
13797 | <dest> | ||
13798 | *: "Never" | ||
13799 | </dest> | ||
13800 | <voice> | ||
13801 | *: "Never" | ||
13802 | </voice> | ||
13803 | </phrase> | ||
diff --git a/apps/misc.c b/apps/misc.c index b43d347d91..9b8fa3e81c 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "misc.h" | 28 | #include "misc.h" |
29 | #include "system.h" | 29 | #include "system.h" |
30 | #include "lcd.h" | 30 | #include "lcd.h" |
31 | #include "language.h" /* is_lang_rtl() */ | ||
32 | |||
31 | #ifdef HAVE_DIRCACHE | 33 | #ifdef HAVE_DIRCACHE |
32 | #include "dircache.h" | 34 | #include "dircache.h" |
33 | #endif | 35 | #endif |
@@ -117,6 +119,20 @@ const unsigned char * const byte_units[] = | |||
117 | 119 | ||
118 | const unsigned char * const * const kibyte_units = &byte_units[1]; | 120 | const unsigned char * const * const kibyte_units = &byte_units[1]; |
119 | 121 | ||
122 | /* units used with format_time_auto, option_select.c->option_get_valuestring() */ | ||
123 | const unsigned char * const unit_strings_core[] = | ||
124 | { | ||
125 | [UNIT_INT] = "", [UNIT_MS] = "ms", | ||
126 | [UNIT_SEC] = "s", [UNIT_MIN] = "min", | ||
127 | [UNIT_HOUR]= "hr", [UNIT_KHZ] = "kHz", | ||
128 | [UNIT_DB] = "dB", [UNIT_PERCENT] = "%", | ||
129 | [UNIT_MAH] = "mAh", [UNIT_PIXEL] = "px", | ||
130 | [UNIT_PER_SEC] = "per sec", | ||
131 | [UNIT_HERTZ] = "Hz", | ||
132 | [UNIT_MB] = "MB", [UNIT_KBIT] = "kb/s", | ||
133 | [UNIT_PM_TICK] = "units/10ms", | ||
134 | }; | ||
135 | |||
120 | /* Format a large-range value for output, using the appropriate unit so that | 136 | /* Format a large-range value for output, using the appropriate unit so that |
121 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 137 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
122 | * units) if possible, and 3 significant digits are shown. If a buffer is | 138 | * units) if possible, and 3 significant digits are shown. If a buffer is |
@@ -1096,6 +1112,216 @@ char* skip_whitespace(char* const str) | |||
1096 | return s; | 1112 | return s; |
1097 | } | 1113 | } |
1098 | 1114 | ||
1115 | /* time_split_units() | ||
1116 | split time values depending on base unit | ||
1117 | unit_idx: UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_MS | ||
1118 | abs_value: absolute time value | ||
1119 | units_in: array of unsigned ints with UNIT_IDX_TIME_COUNT fields | ||
1120 | */ | ||
1121 | unsigned int time_split_units(int unit_idx, unsigned long abs_val, | ||
1122 | unsigned long (*units_in)[UNIT_IDX_TIME_COUNT]) | ||
1123 | { | ||
1124 | unsigned int base_idx = UNIT_IDX_HR; | ||
1125 | unsigned long hours; | ||
1126 | unsigned long minutes = 0; | ||
1127 | unsigned long seconds = 0; | ||
1128 | unsigned long millisec = 0; | ||
1129 | |||
1130 | switch (unit_idx & UNIT_IDX_MASK) /*Mask off upper bits*/ | ||
1131 | { | ||
1132 | case UNIT_MS: | ||
1133 | base_idx = UNIT_IDX_MS; | ||
1134 | millisec = abs_val; | ||
1135 | abs_val = abs_val / 1000U; | ||
1136 | millisec = millisec - (1000U * abs_val); | ||
1137 | /* fallthrough and calculate the rest of the units */ | ||
1138 | case UNIT_SEC: | ||
1139 | if (base_idx == UNIT_IDX_HR) | ||
1140 | base_idx = UNIT_IDX_SEC; | ||
1141 | seconds = abs_val; | ||
1142 | abs_val = abs_val / 60U; | ||
1143 | seconds = seconds - (60U * abs_val); | ||
1144 | /* fallthrough and calculate the rest of the units */ | ||
1145 | case UNIT_MIN: | ||
1146 | if (base_idx == UNIT_IDX_HR) | ||
1147 | base_idx = UNIT_IDX_MIN; | ||
1148 | minutes = abs_val; | ||
1149 | abs_val = abs_val / 60U; | ||
1150 | minutes = minutes -(60U * abs_val); | ||
1151 | /* fallthrough and calculate the rest of the units */ | ||
1152 | case UNIT_HOUR: | ||
1153 | default: | ||
1154 | hours = abs_val; | ||
1155 | break; | ||
1156 | } | ||
1157 | |||
1158 | (*units_in)[UNIT_IDX_HR] = hours; | ||
1159 | (*units_in)[UNIT_IDX_MIN] = minutes; | ||
1160 | (*units_in)[UNIT_IDX_SEC] = seconds; | ||
1161 | (*units_in)[UNIT_IDX_MS] = millisec; | ||
1162 | |||
1163 | return base_idx; | ||
1164 | } | ||
1165 | |||
1166 | /* format_time_auto - return an auto ranged time string; | ||
1167 | buffer: needs to be at least 25 characters for full range | ||
1168 | |||
1169 | unit_idx: specifies lowest or base index of the value | ||
1170 | add | UNIT_LOCK_ to keep place holder of units that would normally be | ||
1171 | discarded.. For instance, UNIT_LOCK_HR would keep the hours place, ex: string | ||
1172 | 00:10:10 (0 HRS 10 MINS 10 SECONDS) normally it would return as 10:10 | ||
1173 | add | UNIT_TRIM_ZERO to supress leading zero on the largest unit | ||
1174 | |||
1175 | value: should be passed in the same form as unit_idx | ||
1176 | |||
1177 | supress_unit: may be set to true and in this case the | ||
1178 | hr, min, sec, ms identifiers will be left off the resulting string but | ||
1179 | since right to left languages are handled it is advisable to leave units | ||
1180 | as an indication of the text direction | ||
1181 | */ | ||
1182 | |||
1183 | const char *format_time_auto(char *buffer, int buf_len, long value, | ||
1184 | int unit_idx, bool supress_unit) | ||
1185 | { | ||
1186 | const char * const sign = &"-"[value < 0 ? 0 : 1]; | ||
1187 | bool is_rtl = lang_is_rtl(); | ||
1188 | char timebuf[25]; /* -2147483648:00:00.00\0 */ | ||
1189 | int len, left_offset; | ||
1190 | unsigned char base_idx, max_idx; | ||
1191 | |||
1192 | unsigned long units_in[UNIT_IDX_TIME_COUNT]; | ||
1193 | unsigned char fwidth[UNIT_IDX_TIME_COUNT] = | ||
1194 | { | ||
1195 | [UNIT_IDX_HR] = 0, /* hr is variable length */ | ||
1196 | [UNIT_IDX_MIN] = 2, | ||
1197 | [UNIT_IDX_SEC] = 2, | ||
1198 | [UNIT_IDX_MS] = 3, | ||
1199 | }; /* {0,2,2,3}; Field Widths */ | ||
1200 | unsigned char offsets[UNIT_IDX_TIME_COUNT] = | ||
1201 | { | ||
1202 | [UNIT_IDX_HR] = 10,/* ?:59:59.999 Std offsets */ | ||
1203 | [UNIT_IDX_MIN] = 7, /*0?:+1:+4.+7 need calculated */ | ||
1204 | [UNIT_IDX_SEC] = 4,/* 999.59:59:0 RTL offsets */ | ||
1205 | [UNIT_IDX_MS] = 0,/* 0 .4 :7 :10 won't change */ | ||
1206 | }; /* {10,7,4,0}; Offsets */ | ||
1207 | const uint16_t unitlock[UNIT_IDX_TIME_COUNT] = | ||
1208 | { | ||
1209 | [UNIT_IDX_HR] = UNIT_LOCK_HR, | ||
1210 | [UNIT_IDX_MIN] = UNIT_LOCK_MIN, | ||
1211 | [UNIT_IDX_SEC] = UNIT_LOCK_SEC, | ||
1212 | [UNIT_IDX_MS] = 0, | ||
1213 | }; /* unitlock */ | ||
1214 | const uint16_t units[UNIT_IDX_TIME_COUNT] = | ||
1215 | { | ||
1216 | [UNIT_IDX_HR] = UNIT_HOUR, | ||
1217 | [UNIT_IDX_MIN] = UNIT_MIN, | ||
1218 | [UNIT_IDX_SEC] = UNIT_SEC, | ||
1219 | [UNIT_IDX_MS] = UNIT_MS, | ||
1220 | }; /* units */ | ||
1221 | |||
1222 | #if 0 /* unused */ | ||
1223 | if (idx_pos != NULL) | ||
1224 | { | ||
1225 | (*idx_pos)[0] = MIN((*idx_pos)[0], UNIT_IDX_TIME_COUNT - 1); | ||
1226 | unit_idx |= unitlock[(*idx_pos)[0]]; | ||
1227 | } | ||
1228 | #endif | ||
1229 | |||
1230 | base_idx = time_split_units(unit_idx, labs(value), &units_in); | ||
1231 | |||
1232 | if (units_in[UNIT_IDX_HR] || (unit_idx & unitlock[UNIT_IDX_HR])) | ||
1233 | max_idx = UNIT_IDX_HR; | ||
1234 | else if (units_in[UNIT_IDX_MIN] || (unit_idx & unitlock[UNIT_IDX_MIN])) | ||
1235 | max_idx = UNIT_IDX_MIN; | ||
1236 | else if (units_in[UNIT_IDX_SEC] || (unit_idx & unitlock[UNIT_IDX_SEC])) | ||
1237 | max_idx = UNIT_IDX_SEC; | ||
1238 | else if (units_in[UNIT_IDX_MS]) | ||
1239 | max_idx = UNIT_IDX_MS; | ||
1240 | else /* value is 0 */ | ||
1241 | max_idx = base_idx; | ||
1242 | |||
1243 | if (!is_rtl) | ||
1244 | { | ||
1245 | len = snprintf(timebuf, sizeof(timebuf), | ||
1246 | "%02lu:%02lu:%02lu.%03lu", | ||
1247 | units_in[UNIT_IDX_HR], | ||
1248 | units_in[UNIT_IDX_MIN], | ||
1249 | units_in[UNIT_IDX_SEC], | ||
1250 | units_in[UNIT_IDX_MS]); | ||
1251 | |||
1252 | fwidth[UNIT_IDX_HR] = len - offsets[UNIT_IDX_HR]; | ||
1253 | |||
1254 | /* calculate offsets of the other fields based on length of previous */ | ||
1255 | offsets[UNIT_IDX_MS] = fwidth[UNIT_IDX_HR] + offsets[UNIT_IDX_MIN]; | ||
1256 | offsets[UNIT_IDX_SEC] = fwidth[UNIT_IDX_HR] + offsets[UNIT_IDX_SEC]; | ||
1257 | offsets[UNIT_IDX_MIN] = fwidth[UNIT_IDX_HR] + 1; | ||
1258 | offsets[UNIT_IDX_HR] = 0; | ||
1259 | |||
1260 | timebuf[offsets[base_idx] + fwidth[base_idx]] = '\0'; | ||
1261 | |||
1262 | left_offset = -(offsets[max_idx]); | ||
1263 | left_offset += strlcpy(buffer, sign, buf_len); | ||
1264 | |||
1265 | /* trim leading zero on the max_idx */ | ||
1266 | if ((unit_idx & UNIT_TRIM_ZERO) == UNIT_TRIM_ZERO && | ||
1267 | timebuf[offsets[max_idx]] == '0' && fwidth[max_idx] > 1) | ||
1268 | { | ||
1269 | offsets[max_idx]++; | ||
1270 | } | ||
1271 | |||
1272 | strlcat(buffer, &timebuf[offsets[max_idx]], buf_len); | ||
1273 | |||
1274 | if (!supress_unit) | ||
1275 | { | ||
1276 | strlcat(buffer, " ", buf_len); | ||
1277 | strlcat(buffer, unit_strings_core[units[max_idx]], buf_len); | ||
1278 | } | ||
1279 | } | ||
1280 | else /*RTL Languages*/ | ||
1281 | { | ||
1282 | len = snprintf(timebuf, sizeof(timebuf), | ||
1283 | "%03lu.%02lu:%02lu:%02lu", | ||
1284 | units_in[UNIT_IDX_MS], | ||
1285 | units_in[UNIT_IDX_SEC], | ||
1286 | units_in[UNIT_IDX_MIN], | ||
1287 | units_in[UNIT_IDX_HR]); | ||
1288 | |||
1289 | fwidth[UNIT_IDX_HR] = len - offsets[UNIT_IDX_HR]; | ||
1290 | |||
1291 | left_offset = -(offsets[base_idx]); | ||
1292 | |||
1293 | /* trim leading zero on the max_idx */ | ||
1294 | if ((unit_idx & UNIT_TRIM_ZERO) == UNIT_TRIM_ZERO && | ||
1295 | timebuf[offsets[max_idx]] == '0' && fwidth[max_idx] > 1) | ||
1296 | { | ||
1297 | timebuf[offsets[max_idx]] = timebuf[offsets[max_idx]+1]; | ||
1298 | fwidth[max_idx]--; | ||
1299 | } | ||
1300 | |||
1301 | timebuf[offsets[max_idx] + fwidth[max_idx]] = '\0'; | ||
1302 | |||
1303 | if (!supress_unit) | ||
1304 | { | ||
1305 | strlcpy(buffer, unit_strings_core[units[max_idx]], buf_len); | ||
1306 | left_offset += strlcat(buffer, " ", buf_len); | ||
1307 | strlcat(buffer, &timebuf[offsets[base_idx]], buf_len); | ||
1308 | } | ||
1309 | else | ||
1310 | strlcpy(buffer, &timebuf[offsets[base_idx]], buf_len); | ||
1311 | |||
1312 | strlcat(buffer, sign, buf_len); | ||
1313 | } | ||
1314 | #if 0 /* unused */ | ||
1315 | if (idx_pos != NULL) | ||
1316 | { | ||
1317 | (*idx_pos)[1]= fwidth[*(idx_pos)[0]]; | ||
1318 | (*idx_pos)[0]= left_offset + offsets[(*idx_pos)[0]]; | ||
1319 | } | ||
1320 | #endif | ||
1321 | |||
1322 | return buffer; | ||
1323 | } | ||
1324 | |||
1099 | /* Format time into buf. | 1325 | /* Format time into buf. |
1100 | * | 1326 | * |
1101 | * buf - buffer to format to. | 1327 | * buf - buffer to format to. |
@@ -1104,13 +1330,12 @@ char* skip_whitespace(char* const str) | |||
1104 | */ | 1330 | */ |
1105 | void format_time(char* buf, int buf_size, long t) | 1331 | void format_time(char* buf, int buf_size, long t) |
1106 | { | 1332 | { |
1107 | unsigned long time = labs(t / 1000); | 1333 | unsigned long units_in[UNIT_IDX_TIME_COUNT] = {0}; |
1108 | unsigned long hours = time / 3600; | 1334 | time_split_units(UNIT_MS, labs(t), &units_in); |
1109 | unsigned long minutes = time / 60 - hours * 60; | 1335 | int hashours = units_in[UNIT_IDX_HR] > 0; |
1110 | unsigned long seconds = time % 60; | ||
1111 | int hashours = hours > 0; | ||
1112 | snprintf(buf, buf_size, "%.*s%.0lu%.*s%.*lu:%.2lu", | 1336 | snprintf(buf, buf_size, "%.*s%.0lu%.*s%.*lu:%.2lu", |
1113 | t < 0, "-", hours, hashours, ":", hashours+1, minutes, seconds); | 1337 | t < 0, "-", units_in[UNIT_IDX_HR], hashours, ":", |
1338 | hashours+1, units_in[UNIT_IDX_MIN], units_in[UNIT_IDX_SEC]); | ||
1114 | } | 1339 | } |
1115 | 1340 | ||
1116 | /** | 1341 | /** |
diff --git a/apps/misc.h b/apps/misc.h index 6821c6debf..25e9d17b9c 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | extern const unsigned char * const byte_units[]; | 29 | extern const unsigned char * const byte_units[]; |
30 | extern const unsigned char * const * const kibyte_units; | 30 | extern const unsigned char * const * const kibyte_units; |
31 | 31 | extern const unsigned char * const unit_strings_core[]; | |
32 | /* Format a large-range value for output, using the appropriate unit so that | 32 | /* Format a large-range value for output, using the appropriate unit so that |
33 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 33 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
34 | * units) if possible, and 3 significant digits are shown. If a buffer is | 34 | * units) if possible, and 3 significant digits are shown. If a buffer is |
@@ -41,6 +41,50 @@ char *output_dyn_value(char *buf, | |||
41 | unsigned int unit_count, | 41 | unsigned int unit_count, |
42 | bool binary_scale); | 42 | bool binary_scale); |
43 | 43 | ||
44 | |||
45 | /* format_time_auto */ | ||
46 | enum e_fmt_time_auto_idx | ||
47 | { | ||
48 | UNIT_IDX_HR = 0, | ||
49 | UNIT_IDX_MIN, | ||
50 | UNIT_IDX_SEC, | ||
51 | UNIT_IDX_MS, | ||
52 | UNIT_IDX_TIME_COUNT, | ||
53 | }; | ||
54 | #define UNIT_IDX_MASK 0x01FFU /*Return only Unit_IDX*/ | ||
55 | #define UNIT_TRIM_ZERO 0x0200U /*Don't show leading zero on max_idx*/ | ||
56 | #define UNIT_LOCK_HR 0x0400U /*Don't Auto Range below this field*/ | ||
57 | #define UNIT_LOCK_MIN 0x0800U /*Don't Auto Range below this field*/ | ||
58 | #define UNIT_LOCK_SEC 0x1000U /*Don't Auto Range below this field*/ | ||
59 | |||
60 | /* time_split_units() | ||
61 | split time values depending on base unit | ||
62 | unit_idx: UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_MS | ||
63 | abs_value: absolute time value | ||
64 | units_in: array of unsigned ints with IDX_TIME_COUNT fields | ||
65 | */ | ||
66 | unsigned int time_split_units(int unit_idx, unsigned long abs_val, | ||
67 | unsigned long (*units_in)[UNIT_IDX_TIME_COUNT]); | ||
68 | |||
69 | /* format_time_auto - return an auto ranged time string; | ||
70 | buffer: needs to be at least 25 characters for full range | ||
71 | |||
72 | unit_idx: specifies lowest or base index of the value | ||
73 | add | UNIT_LOCK_ to keep place holder of units that would normally be | ||
74 | discarded.. For instance, UNIT_LOCK_HR would keep the hours place, ex: string | ||
75 | 00:10:10 (0 HRS 10 MINS 10 SECONDS) normally it would return as 10:10 | ||
76 | add | UNIT_TRIM_ZERO to supress leading zero on the largest unit | ||
77 | |||
78 | value: should be passed in the same form as unit_idx | ||
79 | |||
80 | supress_unit: may be set to true and in this case the | ||
81 | hr, min, sec, ms identifiers will be left off the resulting string but | ||
82 | since right to left languages are handled it is advisable to leave units | ||
83 | as an indication of the text direction | ||
84 | */ | ||
85 | const char *format_time_auto(char *buffer, int buf_len, long value, | ||
86 | int unit_idx, bool supress_unit); | ||
87 | |||
44 | /* Format time into buf. | 88 | /* Format time into buf. |
45 | * | 89 | * |
46 | * buf - buffer to format to. | 90 | * buf - buffer to format to. |
diff --git a/apps/playback.c b/apps/playback.c index 8e18a479b9..7bb78c98a7 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -3769,20 +3769,12 @@ void audio_set_cuesheet(bool enable) | |||
3769 | } | 3769 | } |
3770 | 3770 | ||
3771 | #ifdef HAVE_DISK_STORAGE | 3771 | #ifdef HAVE_DISK_STORAGE |
3772 | /* Set the audio antiskip buffer margin by index */ | 3772 | /* Set the audio antiskip buffer margin in SECONDS */ |
3773 | void audio_set_buffer_margin(int setting) | 3773 | void audio_set_buffer_margin(int seconds) |
3774 | { | 3774 | { |
3775 | static const unsigned short lookup[] = | 3775 | logf("buffer margin: %u", (unsigned) seconds); |
3776 | { 5, 15, 30, 60, 120, 180, 300, 600 }; | 3776 | LOGFQUEUE("audio > audio Q_AUDIO_UPDATE_WATERMARK: %u",(unsigned) seconds); |
3777 | 3777 | audio_queue_post(Q_AUDIO_UPDATE_WATERMARK, (unsigned) seconds); /*SECONDS*/ | |
3778 | if ((unsigned)setting >= ARRAYLEN(lookup)) | ||
3779 | setting = 0; | ||
3780 | |||
3781 | logf("buffer margin: %u", (unsigned)lookup[setting]); | ||
3782 | |||
3783 | LOGFQUEUE("audio > audio Q_AUDIO_UPDATE_WATERMARK: %u", | ||
3784 | (unsigned)lookup[setting]); | ||
3785 | audio_queue_post(Q_AUDIO_UPDATE_WATERMARK, lookup[setting]); | ||
3786 | } | 3778 | } |
3787 | #endif /* HAVE_DISK_STORAGE */ | 3779 | #endif /* HAVE_DISK_STORAGE */ |
3788 | 3780 | ||
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 */ | |||
97 | static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */ | 97 | static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */ |
98 | static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */ | 98 | static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */ |
99 | /* Timing behaviour */ | 99 | /* Timing behaviour */ |
100 | static int pm_peak_hold = 1; /* peak hold timeout index */ | 100 | static int pm_peak_hold = HZ / 5; /* peak hold timeout ticks */ |
101 | static int pm_peak_release = 8; /* peak release in units per read */ | 101 | static int pm_peak_release = 8; /* peak release in units per read */ |
102 | static int pm_clip_hold = 16; /* clip hold timeout index */ | 102 | static int pm_clip_hold = HZ * 60; /* clip hold timeout ticks */ |
103 | static bool pm_clip_eternal = false; /* true if clip timeout is disabled */ | 103 | static bool pm_clip_eternal = false; /* true if clip timeout is disabled */ |
104 | 104 | ||
105 | #ifdef HAVE_RECORDING | 105 | #ifdef HAVE_RECORDING |
106 | static unsigned short trig_strt_threshold; | 106 | static unsigned short trig_strt_threshold; |
@@ -172,22 +172,6 @@ static int history_pos = 0; | |||
172 | static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales, | 172 | static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales, |
173 | int x, int y, int width, int height); | 173 | int x, int y, int width, int height); |
174 | 174 | ||
175 | /* time out values for max */ | ||
176 | static const short peak_time_out[] = { | ||
177 | 0 * HZ, HZ / 5, 30, HZ / 2, HZ, 2 * HZ, | ||
178 | 3 * HZ, 4 * HZ, 5 * HZ, 6 * HZ, 7 * HZ, 8 * HZ, | ||
179 | 9 * HZ, 10 * HZ, 15 * HZ, 20 * HZ, 30 * HZ, 60 * HZ | ||
180 | }; | ||
181 | |||
182 | /* time out values for clip */ | ||
183 | static const long clip_time_out[] = { | ||
184 | 0 * HZ, 1 * HZ, 2 * HZ, 3 * HZ, 4 * HZ, 5 * HZ, | ||
185 | 6 * HZ, 7 * HZ, 8 * HZ, 9 * HZ, 10 * HZ, 15 * HZ, | ||
186 | 20 * HZ, 25 * HZ, 30 * HZ, 45 * HZ, 60 * HZ, 90 * HZ, | ||
187 | 120 * HZ, 180 * HZ, 300 * HZ, 600L * HZ, 1200L * HZ, | ||
188 | 2700L * HZ, 5400L * HZ | ||
189 | }; | ||
190 | |||
191 | /* precalculated peak values that represent magical | 175 | /* precalculated peak values that represent magical |
192 | dBfs values. Used to draw the scale */ | 176 | dBfs values. Used to draw the scale */ |
193 | static const short db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = { | 177 | 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) | |||
522 | * Initialize the peak meter with all relevant values concerning times. | 506 | * Initialize the peak meter with all relevant values concerning times. |
523 | * @param int release - Set the maximum amount of pixels the meter is allowed | 507 | * @param int release - Set the maximum amount of pixels the meter is allowed |
524 | * to decrease with each redraw | 508 | * to decrease with each redraw |
525 | * @param int hold - Select the time preset for the time the peak indicator | 509 | * @param int hold_ms - Select the time in ms for the time the peak indicator |
526 | * is reset after a peak occurred. The preset values are | 510 | * is reset after a peak occurred. |
527 | * stored in peak_time_out. | 511 | * @param int clip_hold_sec - Select the time in seconds for the time the peak |
528 | * @param int clip_hold - Select the time preset for the time the peak | 512 | * indicator is reset after a peak occurred. |
529 | * indicator is reset after a peak occurred. The preset | ||
530 | * values are stored in clip_time_out. | ||
531 | */ | 513 | */ |
532 | void peak_meter_init_times(int release, int hold, int clip_hold) | 514 | void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec) |
533 | { | 515 | { |
534 | pm_peak_hold = hold; | 516 | pm_peak_hold = hold_ms/(1000UL/HZ); /* convert ms to ticks */ |
535 | pm_peak_release = release; | 517 | pm_peak_release = release; |
536 | pm_clip_hold = clip_hold; | 518 | pm_clip_hold = HZ * clip_hold_sec; |
537 | } | 519 | } |
538 | 520 | ||
539 | #ifdef HAVE_RECORDING | 521 | #ifdef HAVE_RECORDING |
@@ -657,8 +639,7 @@ void peak_meter_peek(void) | |||
657 | (left == MAX_PEAK - 1)) { | 639 | (left == MAX_PEAK - 1)) { |
658 | #endif | 640 | #endif |
659 | pm_clip_left = true; | 641 | pm_clip_left = true; |
660 | pm_clip_timeout_l = | 642 | pm_clip_timeout_l = current_tick + pm_clip_hold; |
661 | current_tick + clip_time_out[pm_clip_hold]; | ||
662 | } | 643 | } |
663 | 644 | ||
664 | #if CONFIG_CODEC == SWCODEC | 645 | #if CONFIG_CODEC == SWCODEC |
@@ -668,8 +649,7 @@ void peak_meter_peek(void) | |||
668 | (right == MAX_PEAK - 1)) { | 649 | (right == MAX_PEAK - 1)) { |
669 | #endif | 650 | #endif |
670 | pm_clip_right = true; | 651 | pm_clip_right = true; |
671 | pm_clip_timeout_r = | 652 | pm_clip_timeout_r = current_tick + pm_clip_hold; |
672 | current_tick + clip_time_out[pm_clip_hold]; | ||
673 | } | 653 | } |
674 | 654 | ||
675 | #ifdef HAVE_RECORDING | 655 | #ifdef HAVE_RECORDING |
@@ -1099,14 +1079,12 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
1099 | /* check for new max values */ | 1079 | /* check for new max values */ |
1100 | if (left > scales->pm_peak_left) { | 1080 | if (left > scales->pm_peak_left) { |
1101 | scales->pm_peak_left = left - 1; | 1081 | scales->pm_peak_left = left - 1; |
1102 | scales->pm_peak_timeout_l = | 1082 | scales->pm_peak_timeout_l = current_tick + pm_peak_hold; |
1103 | current_tick + peak_time_out[pm_peak_hold]; | ||
1104 | } | 1083 | } |
1105 | 1084 | ||
1106 | if (right > scales->pm_peak_right) { | 1085 | if (right > scales->pm_peak_right) { |
1107 | scales->pm_peak_right = right - 1; | 1086 | scales->pm_peak_right = right - 1; |
1108 | scales->pm_peak_timeout_r = | 1087 | scales->pm_peak_timeout_r = current_tick + pm_peak_hold; |
1109 | current_tick + peak_time_out[pm_peak_hold]; | ||
1110 | } | 1088 | } |
1111 | } | 1089 | } |
1112 | 1090 | ||
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[], | |||
44 | extern void peak_meter_set_clip_hold(int time); | 44 | extern void peak_meter_set_clip_hold(int time); |
45 | extern void peak_meter_peek(void); | 45 | extern void peak_meter_peek(void); |
46 | extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); | 46 | extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); |
47 | extern void peak_meter_init_times(int release, int hold, int clip_hold); | 47 | extern void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec); |
48 | #ifdef HAVE_AGC | 48 | #ifdef HAVE_AGC |
49 | extern void peak_meter_get_peakhold(int *peak_left, int *peak_right); | 49 | extern void peak_meter_get_peakhold(int *peak_left, int *peak_right); |
50 | #endif | 50 | #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 @@ | |||
78 | #include "appevents.h" | 78 | #include "appevents.h" |
79 | 79 | ||
80 | #ifdef HAVE_RECORDING | 80 | #ifdef HAVE_RECORDING |
81 | /* This array holds the record timer interval lengths, in minutes */ | ||
82 | static const unsigned short rec_timer_minutes[] = | ||
83 | { | ||
84 | 0, /* 0 means OFF */ | ||
85 | 5, /* 00:05 */ | ||
86 | 10, /* 00:10 */ | ||
87 | 15, /* 00:15 */ | ||
88 | 30, /* 00:30 */ | ||
89 | 60, /* 01:00 */ | ||
90 | 74, /* 01:14 */ | ||
91 | 80, /* 01:20 */ | ||
92 | 2*60, /* 02:00 */ | ||
93 | 4*60, /* 04:00 */ | ||
94 | 6*60, /* 06:00 */ | ||
95 | 8*60, /* 08:00 */ | ||
96 | 10*60, /* 10:00 */ | ||
97 | 12*60, /* 12:00 */ | ||
98 | 18*60, /* 18:00 */ | ||
99 | 24*60 /* 24:00 */ | ||
100 | }; | ||
101 | |||
102 | static unsigned int rec_timesplit_seconds(void) | ||
103 | { | ||
104 | unsigned long tm_min = rec_timer_minutes[global_settings.rec_timesplit]; | ||
105 | unsigned long tm_sec = tm_min * 60; | ||
106 | return tm_sec; | ||
107 | } | ||
108 | |||
109 | /* This array holds the record size interval lengths, in mebibytes */ | 81 | /* This array holds the record size interval lengths, in mebibytes */ |
110 | static const unsigned short rec_size_mbytes[] = | 82 | static const unsigned short rec_size_mbytes[] = |
111 | { | 83 | { |
@@ -1003,8 +975,8 @@ bool recording_screen(bool no_source) | |||
1003 | int audio_stat = 0; /* status of the audio system */ | 975 | int audio_stat = 0; /* status of the audio system */ |
1004 | int last_audio_stat = -1; /* previous status so we can act on changes */ | 976 | int last_audio_stat = -1; /* previous status so we can act on changes */ |
1005 | struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; /* the viewports */ | 977 | struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; /* the viewports */ |
1006 | const long split_seconds = rec_timesplit_seconds(); | 978 | const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit; |
1007 | const long split_bytes = rec_sizesplit_bytes(); | 979 | const unsigned long split_bytes = rec_sizesplit_bytes(); |
1008 | 980 | ||
1009 | #if CONFIG_CODEC == SWCODEC | 981 | #if CONFIG_CODEC == SWCODEC |
1010 | int warning_counter = 0; | 982 | int warning_counter = 0; |
diff --git a/apps/screens.c b/apps/screens.c index 608f055de0..db83a9837d 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -978,7 +978,7 @@ static const char* runtime_get_data(int selected_item, void* data, | |||
978 | char* buffer, size_t buffer_len) | 978 | char* buffer, size_t buffer_len) |
979 | { | 979 | { |
980 | (void)data; | 980 | (void)data; |
981 | int t; | 981 | long t; |
982 | switch (selected_item) | 982 | switch (selected_item) |
983 | { | 983 | { |
984 | case 0: return str(LANG_RUNNING_TIME); | 984 | case 0: return str(LANG_RUNNING_TIME); |
@@ -989,8 +989,8 @@ static const char* runtime_get_data(int selected_item, void* data, | |||
989 | return ""; | 989 | return ""; |
990 | } | 990 | } |
991 | 991 | ||
992 | snprintf(buffer, buffer_len, "%dh %dm %ds", | 992 | format_time_auto(buffer, buffer_len, t, UNIT_SEC, false); |
993 | t / 3600, (t % 3600) / 60, t % 60); | 993 | |
994 | return buffer; | 994 | return buffer; |
995 | } | 995 | } |
996 | 996 | ||
diff --git a/apps/settings.h b/apps/settings.h index db16e717e6..d0257b51e6 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -396,11 +396,7 @@ struct user_settings | |||
396 | bool rec_editable; /* true means that the bit reservoir is off */ | 396 | bool rec_editable; /* true means that the bit reservoir is off */ |
397 | 397 | ||
398 | /* note: timesplit setting is not saved */ | 398 | /* note: timesplit setting is not saved */ |
399 | int rec_timesplit; /* 0 = off, | 399 | int rec_timesplit; /* IN MINUTES 0 = off */ |
400 | 1 = 00:05, 2 = 00:10, 3 = 00:15, 4 = 00:30 | ||
401 | 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00 | ||
402 | 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00, | ||
403 | 13= 24:00 */ | ||
404 | int rec_sizesplit; /* 0 = off, | 400 | int rec_sizesplit; /* 0 = off, |
405 | 1 = 5MB, 2 = 10MB, 3 = 15MB, 4 = 32MB | 401 | 1 = 5MB, 2 = 10MB, 3 = 15MB, 4 = 32MB |
406 | 5 = 64MB, 6 = 75MB, 7 = 100MB, 8 = 128MB | 402 | 5 = 64MB, 6 = 75MB, 7 = 100MB, 8 = 128MB |
diff --git a/apps/settings_list.c b/apps/settings_list.c index d4ad6f64dc..a5a1c53dc0 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -187,6 +187,13 @@ | |||
187 | {cb, formatter, get_talk_id, unit, count, \ | 187 | {cb, formatter, get_talk_id, unit, count, \ |
188 | (const int[]){__VA_ARGS__}}}}} | 188 | (const int[]){__VA_ARGS__}}}}} |
189 | 189 | ||
190 | #define TABLE_SETTING_LIST(flags, var, lang_id, default, name, cfg_vals, \ | ||
191 | unit, formatter, get_talk_id, cb, count, list) \ | ||
192 | {flags|F_TABLE_SETTING|F_T_INT, &global_settings.var, \ | ||
193 | lang_id, INT(default), name, cfg_vals, \ | ||
194 | {.table_setting = (struct table_setting[]) { \ | ||
195 | {cb, formatter, get_talk_id, unit, count, list}}}} | ||
196 | |||
190 | #define CUSTOM_SETTING(flags, var, lang_id, default, name, \ | 197 | #define CUSTOM_SETTING(flags, var, lang_id, default, name, \ |
191 | load_from_cfg, write_to_cfg, \ | 198 | load_from_cfg, write_to_cfg, \ |
192 | is_change, set_default) \ | 199 | is_change, set_default) \ |
@@ -200,9 +207,18 @@ | |||
200 | TEXT_SETTING(F_THEMESETTING,var,name,"-", NULL, NULL) | 207 | TEXT_SETTING(F_THEMESETTING,var,name,"-", NULL, NULL) |
201 | 208 | ||
202 | /* some sets of values which are used more than once, to save memory */ | 209 | /* some sets of values which are used more than once, to save memory */ |
210 | static const char off[] = "off"; | ||
203 | static const char off_on[] = "off,on"; | 211 | static const char off_on[] = "off,on"; |
204 | static const char off_on_ask[] = "off,on,ask"; | 212 | static const char off_on_ask[] = "off,on,ask"; |
205 | static const char off_number_spell[] = "off,number,spell"; | 213 | static const char off_number_spell[] = "off,number,spell"; |
214 | static const int timeout_sec_common[] = {-1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30, | ||
215 | 45,60,90,120,180,240,300,600,900,1200, | ||
216 | 1500,1800,2700,3600,4500,5400,6300,7200}; | ||
217 | static const int time_recording_trigger[] = {0,1,2,5,10,15,20,25,30,60,120,300,600}; | ||
218 | #if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) | ||
219 | static const int backlight_fade[] = {0,100,200,300,500,1000,2000,3000,5000,10000}; | ||
220 | #endif | ||
221 | |||
206 | #ifdef HAVE_LCD_BITMAP | 222 | #ifdef HAVE_LCD_BITMAP |
207 | static const char graphic_numeric[] = "graphic,numeric"; | 223 | static const char graphic_numeric[] = "graphic,numeric"; |
208 | #endif | 224 | #endif |
@@ -330,6 +346,14 @@ static const char graphic_numeric[] = "graphic,numeric"; | |||
330 | #define DEFAULT_TAGCACHE_SCAN_PATHS "/" | 346 | #define DEFAULT_TAGCACHE_SCAN_PATHS "/" |
331 | #endif | 347 | #endif |
332 | 348 | ||
349 | #ifdef HAVE_BACKLIGHT | ||
350 | #ifdef SIMULATOR | ||
351 | #define DEFAULT_BACKLIGHT_TIMEOUT 0 | ||
352 | #else | ||
353 | #define DEFAULT_BACKLIGHT_TIMEOUT 15 | ||
354 | #endif | ||
355 | #endif /* HAVE_BACKLIGHT */ | ||
356 | |||
333 | #if LCD_DEPTH > 1 | 357 | #if LCD_DEPTH > 1 |
334 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, | 358 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, |
335 | int val, const char *unit) | 359 | int val, const char *unit) |
@@ -373,61 +397,89 @@ static int32_t getlang_unit_0_is_off(int value, int unit) | |||
373 | return TALK_ID(value,unit); | 397 | return TALK_ID(value,unit); |
374 | } | 398 | } |
375 | 399 | ||
376 | static const char* formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size, | 400 | static const char* formatter_time_unit_0_is_off(char *buffer, size_t buffer_size, |
377 | int val, const char *unit) | 401 | int val, const char *unit) |
402 | { | ||
403 | (void) buffer_size; | ||
404 | (void) unit; | ||
405 | if (val == 0) | ||
406 | return str(LANG_OFF); | ||
407 | return buffer; | ||
408 | } | ||
409 | |||
410 | static int32_t getlang_time_unit_0_is_off(int value, int unit) | ||
411 | { | ||
412 | if (value == 0) | ||
413 | return LANG_OFF; | ||
414 | else | ||
415 | return talk_time_intervals(value, unit, false); | ||
416 | } | ||
417 | |||
418 | #if defined(HAVE_BACKLIGHT) || defined(HAVE_LCD_SLEEP_SETTING) | ||
419 | static const char* formatter_time_unit_0_is_always(char *buffer, size_t buffer_size, | ||
420 | int val, const char *unit) | ||
421 | { | ||
422 | (void) buffer_size; | ||
423 | (void) unit; | ||
424 | if (val == -1) | ||
425 | return str(LANG__NEVER); | ||
426 | else if (val == 0) | ||
427 | return str(LANG_ALWAYS); | ||
428 | return buffer; | ||
429 | } | ||
430 | |||
431 | static int32_t getlang_time_unit_0_is_always(int value, int unit) | ||
432 | { | ||
433 | if (value == -1) | ||
434 | return LANG__NEVER; | ||
435 | else if (value == 0) | ||
436 | return LANG_ALWAYS; | ||
437 | else | ||
438 | return talk_time_intervals(value, unit, false); | ||
439 | } | ||
440 | #endif /* HAVE_BACKLIGHT || HAVE_LCD_SLEEP_SETTING */ | ||
441 | |||
442 | static const char* formatter_time_unit_0_is_skip_track(char *buffer, | ||
443 | size_t buffer_size, int val, const char *unit) | ||
378 | { | 444 | { |
379 | (void)unit; | 445 | (void)unit; |
446 | (void)buffer_size; | ||
380 | if (val == -1) | 447 | if (val == -1) |
381 | return str(LANG_SKIP_OUTRO); | 448 | return str(LANG_SKIP_OUTRO); |
382 | else if (val == 0) | 449 | else if (val == 0) |
383 | return str(LANG_SKIP_TRACK); | 450 | return str(LANG_SKIP_TRACK); |
384 | else if (val % 60 == 0) | ||
385 | snprintf(buffer, buffer_size, "%d min", val/60); | ||
386 | else | ||
387 | snprintf(buffer, buffer_size, "%d s", val); | ||
388 | return buffer; | 451 | return buffer; |
389 | } | 452 | } |
390 | 453 | ||
391 | static int32_t getlang_unit_0_is_skip_track(int value, int unit) | 454 | static int32_t getlang_time_unit_0_is_skip_track(int value, int unit) |
392 | { | 455 | { |
393 | (void)unit; | 456 | (void)unit; |
394 | if (value == -1) | 457 | if (value == -1) |
395 | return LANG_SKIP_OUTRO; | 458 | return LANG_SKIP_OUTRO; |
396 | else if (value == 0) | 459 | else if (value == 0) |
397 | return LANG_SKIP_TRACK; | 460 | return LANG_SKIP_TRACK; |
398 | else if (value % 60 == 0) | ||
399 | return TALK_ID(value/60, UNIT_MIN); | ||
400 | else | 461 | else |
401 | return TALK_ID(value, UNIT_SEC); | 462 | return talk_time_intervals(value, unit, false); |
402 | } | 463 | } |
403 | 464 | ||
404 | #ifdef HAVE_BACKLIGHT | 465 | #ifdef HAVE_LCD_BITMAP |
405 | #ifdef SIMULATOR | 466 | static const char* formatter_time_unit_0_is_eternal(char *buffer, |
406 | #define DEFAULT_BACKLIGHT_TIMEOUT 0 | 467 | size_t buffer_size, int val, const char *unit) |
407 | #else | ||
408 | #define DEFAULT_BACKLIGHT_TIMEOUT 15 | ||
409 | #endif | ||
410 | static const char* backlight_formatter(char *buffer, size_t buffer_size, | ||
411 | int val, const char *unit) | ||
412 | { | 468 | { |
413 | if (val == -1) | 469 | (void) buffer_size; |
414 | return str(LANG_OFF); | 470 | (void) unit; |
415 | else if (val == 0) | 471 | if (val == 0) |
416 | return str(LANG_ON); | 472 | return str(LANG_PM_ETERNAL); |
417 | else | ||
418 | snprintf(buffer, buffer_size, "%d %s", val, unit); | ||
419 | return buffer; | 473 | return buffer; |
420 | } | 474 | } |
421 | static int32_t backlight_getlang(int value, int unit) | 475 | static int32_t getlang_time_unit_0_is_eternal(int value, int unit) |
422 | { | 476 | { |
423 | if (value == -1) | 477 | if (value == 0) |
424 | return LANG_OFF; | 478 | return LANG_PM_ETERNAL; |
425 | else if (value == 0) | ||
426 | return LANG_ON; | ||
427 | else | 479 | else |
428 | return TALK_ID(value, unit); | 480 | return talk_time_intervals(value, unit, false); |
429 | } | 481 | } |
430 | #endif | 482 | #endif /* HAVE_LCD_BITMAP */ |
431 | 483 | ||
432 | #ifndef HAVE_WHEEL_ACCELERATION | 484 | #ifndef HAVE_WHEEL_ACCELERATION |
433 | static const char* scanaccel_formatter(char *buffer, size_t buffer_size, | 485 | static const char* scanaccel_formatter(char *buffer, size_t buffer_size, |
@@ -437,7 +489,7 @@ static const char* scanaccel_formatter(char *buffer, size_t buffer_size, | |||
437 | if (val == 0) | 489 | if (val == 0) |
438 | return str(LANG_OFF); | 490 | return str(LANG_OFF); |
439 | else | 491 | else |
440 | snprintf(buffer, buffer_size, "Speed up every %ds", val); | 492 | snprintf(buffer, buffer_size, "Speed up every %d s", val); |
441 | return buffer; | 493 | return buffer; |
442 | } | 494 | } |
443 | #endif | 495 | #endif |
@@ -798,8 +850,9 @@ const struct settings_list settings[] = { | |||
798 | /* 3-d enhancement effect */ | 850 | /* 3-d enhancement effect */ |
799 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 851 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
800 | SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS), | 852 | SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS), |
853 | /* requires index, uses table defined by driver */ | ||
801 | STRINGCHOICE_SETTING(F_SOUNDSETTING,avc,LANG_AUTOVOL,0,"auto volume", | 854 | STRINGCHOICE_SETTING(F_SOUNDSETTING,avc,LANG_AUTOVOL,0,"auto volume", |
802 | "off,20ms,2,4,8,", sound_set_avc, 5, | 855 | "off,20 ms,2 s,4 s,8 s,", sound_set_avc, 5, |
803 | LANG_OFF,TALK_ID(20, UNIT_MS),TALK_ID(2, UNIT_SEC), | 856 | LANG_OFF,TALK_ID(20, UNIT_MS),TALK_ID(2, UNIT_SEC), |
804 | TALK_ID(4, UNIT_SEC),TALK_ID(8, UNIT_SEC)), | 857 | TALK_ID(4, UNIT_SEC),TALK_ID(8, UNIT_SEC)), |
805 | OFFON_SETTING(F_SOUNDSETTING, superbass, LANG_SUPERBASS, false, "superbass", | 858 | OFFON_SETTING(F_SOUNDSETTING, superbass, LANG_SUPERBASS, false, "superbass", |
@@ -864,18 +917,19 @@ const struct settings_list settings[] = { | |||
864 | MAX_CONTRAST_SETTING, 1, NULL, NULL }}}}, | 917 | MAX_CONTRAST_SETTING, 1, NULL, NULL }}}}, |
865 | #endif | 918 | #endif |
866 | #ifdef HAVE_BACKLIGHT | 919 | #ifdef HAVE_BACKLIGHT |
867 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT, | 920 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, |
868 | DEFAULT_BACKLIGHT_TIMEOUT, | 921 | backlight_timeout, LANG_BACKLIGHT, |
869 | "backlight timeout", off_on, UNIT_SEC, backlight_formatter, | 922 | DEFAULT_BACKLIGHT_TIMEOUT, "backlight timeout", |
870 | backlight_getlang, backlight_set_timeout, 20, | 923 | off_on, UNIT_SEC, formatter_time_unit_0_is_always, |
871 | -1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,120), | 924 | getlang_time_unit_0_is_always, backlight_set_timeout, |
925 | 23, timeout_sec_common), | ||
872 | #if CONFIG_CHARGING | 926 | #if CONFIG_CHARGING |
873 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout_plugged, | 927 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, |
874 | LANG_BACKLIGHT_ON_WHEN_CHARGING, 10, | 928 | backlight_timeout_plugged, LANG_BACKLIGHT_ON_WHEN_CHARGING, |
875 | "backlight timeout plugged", off_on, UNIT_SEC, | 929 | DEFAULT_BACKLIGHT_TIMEOUT, "backlight timeout plugged", |
876 | backlight_formatter, backlight_getlang, | 930 | off_on, UNIT_SEC, formatter_time_unit_0_is_always, |
877 | backlight_set_timeout_plugged, 20, | 931 | getlang_time_unit_0_is_always, backlight_set_timeout_plugged, |
878 | -1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,120), | 932 | 23, timeout_sec_common), |
879 | #endif | 933 | #endif |
880 | #endif /* HAVE_BACKLIGHT */ | 934 | #endif /* HAVE_BACKLIGHT */ |
881 | #ifdef HAVE_LCD_BITMAP | 935 | #ifdef HAVE_LCD_BITMAP |
@@ -951,10 +1005,10 @@ const struct settings_list settings[] = { | |||
951 | #endif /* HAVE_LCD_BITMAP */ | 1005 | #endif /* HAVE_LCD_BITMAP */ |
952 | OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL), | 1006 | OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL), |
953 | /* system */ | 1007 | /* system */ |
954 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, poweroff, LANG_POWEROFF_IDLE, 10, | 1008 | INT_SETTING(F_TIME_SETTING, poweroff, LANG_POWEROFF_IDLE, 10, |
955 | "idle poweroff", "off", UNIT_MIN, formatter_unit_0_is_off, | 1009 | "idle poweroff", UNIT_MIN, 0,60,1, |
956 | getlang_unit_0_is_off, set_poweroff_timeout, 15, | 1010 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, |
957 | 0,1,2,3,4,5,6,7,8,9,10,15,30,45,60), | 1011 | set_poweroff_timeout), |
958 | SYSTEM_SETTING(NVRAM(4), runtime, 0), | 1012 | SYSTEM_SETTING(NVRAM(4), runtime, 0), |
959 | SYSTEM_SETTING(NVRAM(4), topruntime, 0), | 1013 | SYSTEM_SETTING(NVRAM(4), topruntime, 0), |
960 | INT_SETTING(F_BANFROMQS, max_files_in_playlist, | 1014 | INT_SETTING(F_BANFROMQS, max_files_in_playlist, |
@@ -1039,18 +1093,17 @@ const struct settings_list settings[] = { | |||
1039 | lcd_remote_set_invert_display), | 1093 | lcd_remote_set_invert_display), |
1040 | OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY, | 1094 | OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY, |
1041 | false,"remote flip display", NULL), | 1095 | false,"remote flip display", NULL), |
1042 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, remote_backlight_timeout, | 1096 | TABLE_SETTING_LIST(F_ALLOW_ARBITRARY_VALS, remote_backlight_timeout, |
1043 | LANG_BACKLIGHT, 5, "remote backlight timeout", off_on, | 1097 | LANG_BACKLIGHT, 5, |
1044 | UNIT_SEC, backlight_formatter, backlight_getlang, | 1098 | "remote backlight timeout", off_on, UNIT_SEC, |
1045 | remote_backlight_set_timeout, 20, | 1099 | formatter_time_unit_0_is_always, getlang_time_unit_0_is_always, |
1046 | -1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,120), | 1100 | remote_backlight_set_timeout, 23, timeout_sec_common), |
1047 | #if CONFIG_CHARGING | 1101 | #if CONFIG_CHARGING |
1048 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, remote_backlight_timeout_plugged, | 1102 | TABLE_SETTING_LIST(F_ALLOW_ARBITRARY_VALS, remote_backlight_timeout_plugged, |
1049 | LANG_BACKLIGHT_ON_WHEN_CHARGING, 10, | 1103 | LANG_BACKLIGHT_ON_WHEN_CHARGING, 10, |
1050 | "remote backlight timeout plugged", off_on, UNIT_SEC, | 1104 | "remote backlight timeout plugged", off_on, UNIT_SEC, |
1051 | backlight_formatter, backlight_getlang, | 1105 | formatter_time_unit_0_is_always, getlang_time_unit_0_is_always, |
1052 | remote_backlight_set_timeout_plugged, 20, | 1106 | remote_backlight_set_timeout_plugged, 23, timeout_sec_common), |
1053 | -1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,120), | ||
1054 | #endif | 1107 | #endif |
1055 | #ifdef HAVE_REMOTE_LCD_TICKING | 1108 | #ifdef HAVE_REMOTE_LCD_TICKING |
1056 | OFFON_SETTING(0, remote_reduce_ticking, LANG_REDUCE_TICKING, | 1109 | OFFON_SETTING(0, remote_reduce_ticking, LANG_REDUCE_TICKING, |
@@ -1103,15 +1156,15 @@ const struct settings_list settings[] = { | |||
1103 | #endif | 1156 | #endif |
1104 | /* backlight fading */ | 1157 | /* backlight fading */ |
1105 | #if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) | 1158 | #if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) |
1106 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_fade_in, | 1159 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, backlight_fade_in, |
1107 | LANG_BACKLIGHT_FADE_IN, 300, "backlight fade in", "off", | 1160 | LANG_BACKLIGHT_FADE_IN, 300, "backlight fade in", "off", |
1108 | UNIT_MS, formatter_unit_0_is_off, getlang_unit_0_is_off, | 1161 | UNIT_MS, formatter_time_unit_0_is_off, getlang_unit_0_is_off, |
1109 | backlight_set_fade_in, 7, 0,100,200,300,500,1000,2000), | 1162 | backlight_set_fade_in, 7, backlight_fade), |
1110 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_fade_out, | 1163 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, backlight_fade_out, |
1111 | LANG_BACKLIGHT_FADE_OUT, 2000, "backlight fade out", "off", | 1164 | LANG_BACKLIGHT_FADE_OUT, 2000, "backlight fade out", "off", |
1112 | UNIT_MS, formatter_unit_0_is_off, getlang_unit_0_is_off, | 1165 | UNIT_MS, formatter_time_unit_0_is_off, |
1113 | backlight_set_fade_out, 10, | 1166 | getlang_time_unit_0_is_off, |
1114 | 0,100,200,300,500,1000,2000,3000,5000,10000), | 1167 | backlight_set_fade_out, 10, backlight_fade), |
1115 | #elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING) | 1168 | #elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING) |
1116 | OFFON_SETTING(0, backlight_fade_in, LANG_BACKLIGHT_FADE_IN, | 1169 | OFFON_SETTING(0, backlight_fade_in, LANG_BACKLIGHT_FADE_IN, |
1117 | true, "backlight fade in", backlight_set_fade_in), | 1170 | true, "backlight fade in", backlight_set_fade_in), |
@@ -1121,9 +1174,10 @@ const struct settings_list settings[] = { | |||
1121 | #endif /* HAVE_BACKLIGHT */ | 1174 | #endif /* HAVE_BACKLIGHT */ |
1122 | INT_SETTING(F_PADTITLE, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed", | 1175 | INT_SETTING(F_PADTITLE, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed", |
1123 | UNIT_INT, 0, 17, 1, NULL, NULL, lcd_scroll_speed), | 1176 | UNIT_INT, 0, 17, 1, NULL, NULL, lcd_scroll_speed), |
1124 | INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000, | 1177 | INT_SETTING(F_TIME_SETTING | F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, |
1125 | "scroll delay", UNIT_MS, 0, 2500, 100, NULL, | 1178 | 1000, "scroll delay", UNIT_MS, 0, 3000, 100, |
1126 | NULL, lcd_scroll_delay), | 1179 | formatter_time_unit_0_is_off, |
1180 | getlang_time_unit_0_is_off, lcd_scroll_delay), | ||
1127 | INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", | 1181 | INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", |
1128 | UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_bidir_scroll), | 1182 | UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_bidir_scroll), |
1129 | #ifdef HAVE_REMOTE_LCD | 1183 | #ifdef HAVE_REMOTE_LCD |
@@ -1133,8 +1187,9 @@ const struct settings_list settings[] = { | |||
1133 | INT_SETTING(0, remote_scroll_step, LANG_SCROLL_STEP, 6, | 1187 | INT_SETTING(0, remote_scroll_step, LANG_SCROLL_STEP, 6, |
1134 | "remote scroll step", UNIT_PIXEL, 1, LCD_REMOTE_WIDTH, 1, NULL, | 1188 | "remote scroll step", UNIT_PIXEL, 1, LCD_REMOTE_WIDTH, 1, NULL, |
1135 | NULL, lcd_remote_scroll_step), | 1189 | NULL, lcd_remote_scroll_step), |
1136 | INT_SETTING(0, remote_scroll_delay, LANG_SCROLL_DELAY, 1000, | 1190 | INT_SETTING(F_TIME_SETTING, remote_scroll_delay, LANG_SCROLL_DELAY, 1000, |
1137 | "remote scroll delay", UNIT_MS, 0, 2500, 100, NULL, NULL, | 1191 | "remote scroll delay", UNIT_MS, 0, 3000, 100, |
1192 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, | ||
1138 | lcd_remote_scroll_delay), | 1193 | lcd_remote_scroll_delay), |
1139 | INT_SETTING(0, remote_bidir_limit, LANG_BIDIR_SCROLL, 50, | 1194 | INT_SETTING(0, remote_bidir_limit, LANG_BIDIR_SCROLL, 50, |
1140 | "remote bidir limit", UNIT_PERCENT, 0, 200, 25, NULL, NULL, | 1195 | "remote bidir limit", UNIT_PERCENT, 0, 200, 25, NULL, NULL, |
@@ -1172,27 +1227,25 @@ const struct settings_list settings[] = { | |||
1172 | OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), | 1227 | OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), |
1173 | OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL), | 1228 | OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL), |
1174 | OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), | 1229 | OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), |
1175 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step, | 1230 | INT_SETTING(F_TIME_SETTING, ff_rewind_min_step, LANG_FFRW_STEP, 1, |
1176 | LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC, | 1231 | "scan min step", UNIT_SEC, 1, 60, 1, NULL, NULL, NULL), |
1177 | NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60), | ||
1178 | CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2, | 1232 | CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2, |
1179 | "seek acceleration", "very fast,fast,normal,slow,very slow", NULL, 5, | 1233 | "seek acceleration", "very fast,fast,normal,slow,very slow", NULL, 5, |
1180 | ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL), | 1234 | ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL), |
1181 | ID2P(LANG_SLOW) , ID2P(LANG_VERY_SLOW)), | 1235 | ID2P(LANG_SLOW) , ID2P(LANG_VERY_SLOW)), |
1182 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_DISK_STORAGE) | 1236 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_DISK_STORAGE) |
1183 | STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip", | 1237 | TABLE_SETTING(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, buffer_margin, |
1184 | "5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8, | 1238 | LANG_MP3BUFFER_MARGIN, 5, "antiskip", NULL, UNIT_SEC, |
1185 | TALK_ID(5, UNIT_SEC), TALK_ID(15, UNIT_SEC), | 1239 | NULL, NULL, |
1186 | TALK_ID(30, UNIT_SEC), TALK_ID(1, UNIT_MIN), | 1240 | NULL,8, 5,15,30,60,120,180,300,600), |
1187 | TALK_ID(2, UNIT_MIN), TALK_ID(3, UNIT_MIN), | ||
1188 | TALK_ID(5, UNIT_MIN), TALK_ID(10, UNIT_MIN)), | ||
1189 | #elif defined(HAVE_DISK_STORAGE) | 1241 | #elif defined(HAVE_DISK_STORAGE) |
1190 | INT_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0, "antiskip", | 1242 | INT_SETTING(F_TIME_SETTING, buffer_margin, LANG_MP3BUFFER_MARGIN, 0, |
1191 | UNIT_SEC, 0, 7, 1, NULL, NULL, audio_set_buffer_margin), | 1243 | "antiskip", UNIT_SEC, 0, 7, 1, formatter_time_unit_0_is_off, |
1244 | getlang_time_unit_0_is_off, audio_set_buffer_margin), | ||
1192 | #endif | 1245 | #endif |
1193 | /* disk */ | 1246 | /* disk */ |
1194 | #ifdef HAVE_DISK_STORAGE | 1247 | #ifdef HAVE_DISK_STORAGE |
1195 | INT_SETTING(0, disk_spindown, LANG_SPINDOWN, 5, "disk spindown", | 1248 | INT_SETTING(F_TIME_SETTING, disk_spindown, LANG_SPINDOWN, 5, "disk spindown", |
1196 | UNIT_SEC, 3, 254, 1, NULL, NULL, storage_spindown), | 1249 | UNIT_SEC, 3, 254, 1, NULL, NULL, storage_spindown), |
1197 | #endif /* HAVE_DISK_STORAGE */ | 1250 | #endif /* HAVE_DISK_STORAGE */ |
1198 | /* browser */ | 1251 | /* browser */ |
@@ -1252,35 +1305,16 @@ const struct settings_list settings[] = { | |||
1252 | ID2P(LANG_BOOKMARK_SETTINGS_ONE_PER_TRACK)), | 1305 | ID2P(LANG_BOOKMARK_SETTINGS_ONE_PER_TRACK)), |
1253 | #ifdef HAVE_LCD_BITMAP | 1306 | #ifdef HAVE_LCD_BITMAP |
1254 | /* peak meter */ | 1307 | /* peak meter */ |
1255 | STRINGCHOICE_SETTING(0, peak_meter_clip_hold, LANG_PM_CLIP_HOLD, 16, | 1308 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, peak_meter_clip_hold, |
1256 | "peak meter clip hold", | 1309 | LANG_PM_CLIP_HOLD, 60, "peak meter clip hold", "eternal", |
1257 | "on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,2min" | 1310 | UNIT_SEC, formatter_time_unit_0_is_eternal, |
1258 | ",3min,5min,10min,20min,45min,90min", | 1311 | getlang_time_unit_0_is_eternal, peak_meter_set_clip_hold, |
1259 | peak_meter_set_clip_hold, 25, LANG_PM_ETERNAL, | 1312 | 31, &timeout_sec_common[1]), /* skip -1 entry */ |
1260 | TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC), | 1313 | TABLE_SETTING(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, peak_meter_hold, |
1261 | TALK_ID(3, UNIT_SEC), TALK_ID(4, UNIT_SEC), | 1314 | LANG_PM_PEAK_HOLD, 500, "peak meter hold", off, UNIT_MS, |
1262 | TALK_ID(5, UNIT_SEC), TALK_ID(6, UNIT_SEC), | 1315 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off,NULL, |
1263 | TALK_ID(7, UNIT_SEC), TALK_ID(8, UNIT_SEC), | 1316 | 18, 0,200,300,500,1000,2000,3000,4000,5000,6000,7000,8000, |
1264 | TALK_ID(9, UNIT_SEC), TALK_ID(10, UNIT_SEC), | 1317 | 9000,10000,15000,20000,30000,60000), |
1265 | TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), | ||
1266 | TALK_ID(25, UNIT_SEC), TALK_ID(30, UNIT_SEC), | ||
1267 | TALK_ID(45, UNIT_SEC), TALK_ID(60, UNIT_SEC), | ||
1268 | TALK_ID(90, UNIT_SEC), TALK_ID(2, UNIT_MIN), | ||
1269 | TALK_ID(3, UNIT_MIN), TALK_ID(5, UNIT_MIN), | ||
1270 | TALK_ID(10, UNIT_MIN), TALK_ID(20, UNIT_MIN), | ||
1271 | TALK_ID(45, UNIT_MIN), TALK_ID(90, UNIT_MIN)), | ||
1272 | STRINGCHOICE_SETTING(0, peak_meter_hold, LANG_PM_PEAK_HOLD, 3, | ||
1273 | "peak meter hold", | ||
1274 | "off,200ms,300ms,500ms,1,2,3,4,5,6,7,8,9,10,15,20,30,1min", | ||
1275 | NULL, 18, LANG_OFF, TALK_ID(200, UNIT_MS), | ||
1276 | TALK_ID(300, UNIT_MS), TALK_ID(500, UNIT_MS), | ||
1277 | TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC), | ||
1278 | TALK_ID(3, UNIT_SEC), TALK_ID(4, UNIT_SEC), | ||
1279 | TALK_ID(5, UNIT_SEC), TALK_ID(6, UNIT_SEC), | ||
1280 | TALK_ID(7, UNIT_SEC), TALK_ID(8, UNIT_SEC), | ||
1281 | TALK_ID(9, UNIT_SEC), TALK_ID(10, UNIT_SEC), | ||
1282 | TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), | ||
1283 | TALK_ID(30, UNIT_SEC), TALK_ID(60, UNIT_SEC)), | ||
1284 | INT_SETTING(0, peak_meter_release, LANG_PM_RELEASE, 8, "peak meter release", | 1318 | INT_SETTING(0, peak_meter_release, LANG_PM_RELEASE, 8, "peak meter release", |
1285 | UNIT_PM_TICK, 1, 0x7e, 1, NULL, NULL,NULL), | 1319 | UNIT_PM_TICK, 1, 0x7e, 1, NULL, NULL,NULL), |
1286 | OFFON_SETTING(0,peak_meter_dbfs,LANG_PM_DBFS,true,"peak meter dbfs",NULL), | 1320 | OFFON_SETTING(0,peak_meter_dbfs,LANG_PM_DBFS,true,"peak meter dbfs",NULL), |
@@ -1328,20 +1362,12 @@ const struct settings_list settings[] = { | |||
1328 | "Announce Battery Level", NULL), | 1362 | "Announce Battery Level", NULL), |
1329 | 1363 | ||
1330 | #ifdef HAVE_RECORDING | 1364 | #ifdef HAVE_RECORDING |
1331 | /* recording */ | 1365 | /* recording */ |
1332 | STRINGCHOICE_SETTING(F_RECSETTING, rec_timesplit, LANG_SPLIT_TIME, 0, | 1366 | TABLE_SETTING(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS | F_RECSETTING, |
1333 | "rec timesplit", | 1367 | rec_timesplit, |
1334 | "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00," | 1368 | LANG_SPLIT_TIME, 0, "rec timesplit", off, UNIT_MIN, |
1335 | "04:00,06:00,08:00,10:00,12:00,18:00,24:00", | 1369 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off,NULL, |
1336 | NULL, 16, LANG_OFF, | 1370 | 16, 0,5,10,15,30,60,74,80,120,240,360,480,600,720,1080,1440), |
1337 | TALK_ID(5, UNIT_MIN), TALK_ID(10, UNIT_MIN), | ||
1338 | TALK_ID(15, UNIT_MIN), TALK_ID(30, UNIT_MIN), | ||
1339 | TALK_ID(60, UNIT_MIN), TALK_ID(74, UNIT_MIN), | ||
1340 | TALK_ID(80, UNIT_MIN), TALK_ID(2, UNIT_HOUR), | ||
1341 | TALK_ID(4, UNIT_HOUR), TALK_ID(6, UNIT_HOUR), | ||
1342 | TALK_ID(8, UNIT_HOUR), TALK_ID(10, UNIT_HOUR), | ||
1343 | TALK_ID(12, UNIT_HOUR), TALK_ID(18, UNIT_HOUR), | ||
1344 | TALK_ID(20, UNIT_HOUR), TALK_ID(24, UNIT_HOUR)), | ||
1345 | STRINGCHOICE_SETTING(F_RECSETTING, rec_sizesplit, LANG_SPLIT_SIZE, 0, | 1371 | STRINGCHOICE_SETTING(F_RECSETTING, rec_sizesplit, LANG_SPLIT_SIZE, 0, |
1346 | "rec sizesplit", | 1372 | "rec sizesplit", |
1347 | "off,5MB,10MB,15MB,32MB,64MB,75MB,100MB,128MB," | 1373 | "off,5MB,10MB,15MB,32MB,64MB,75MB,100MB,128MB," |
@@ -1374,9 +1400,10 @@ const struct settings_list settings[] = { | |||
1374 | HAVE_SPDIF_REC_(",spdif") | 1400 | HAVE_SPDIF_REC_(",spdif") |
1375 | HAVE_FMRADIO_REC_(",fmradio")[1], | 1401 | HAVE_FMRADIO_REC_(",fmradio")[1], |
1376 | UNUSED}, | 1402 | UNUSED}, |
1377 | INT_SETTING(F_RECSETTING, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME, 0, | 1403 | INT_SETTING(F_TIME_SETTING | F_RECSETTING, rec_prerecord_time, |
1404 | LANG_RECORD_PRERECORD_TIME, 0, | ||
1378 | "prerecording time", UNIT_SEC, 0, 30, 1, | 1405 | "prerecording time", UNIT_SEC, 0, 30, 1, |
1379 | formatter_unit_0_is_off, getlang_unit_0_is_off, NULL), | 1406 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, NULL), |
1380 | 1407 | ||
1381 | TEXT_SETTING(F_RECSETTING, rec_directory, "rec path", | 1408 | TEXT_SETTING(F_RECSETTING, rec_directory, "rec path", |
1382 | REC_BASE_DIR, NULL, NULL), | 1409 | REC_BASE_DIR, NULL, NULL), |
@@ -1444,21 +1471,15 @@ const struct settings_list settings[] = { | |||
1444 | "trigger stop threshold dB", UNIT_DB, -89, 0, 1, NULL, NULL, NULL), | 1471 | "trigger stop threshold dB", UNIT_DB, -89, 0, 1, NULL, NULL, NULL), |
1445 | INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10, | 1472 | INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10, |
1446 | "trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL), | 1473 | "trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL), |
1447 | TABLE_SETTING(F_RECSETTING, rec_start_duration, LANG_MIN_DURATION, 0, | 1474 | TABLE_SETTING_LIST(F_TIME_SETTING | F_RECSETTING, rec_start_duration, |
1448 | "trigger start duration", | 1475 | LANG_MIN_DURATION, 0, "trigger start duration", |
1449 | "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", | 1476 | off, UNIT_SEC, NULL, NULL, NULL, 13, time_recording_trigger), |
1450 | UNIT_SEC, NULL, NULL, NULL, 13, | 1477 | TABLE_SETTING_LIST(F_TIME_SETTING | F_RECSETTING, rec_stop_postrec, |
1451 | 0,1,2,5,10,15,20,25,30,60,120,300,600), | 1478 | LANG_MIN_DURATION, 0, "trigger stop duration", |
1452 | TABLE_SETTING(F_RECSETTING, rec_stop_postrec, LANG_MIN_DURATION, 0, | 1479 | off, UNIT_SEC, NULL, NULL, NULL, 13, time_recording_trigger), |
1453 | "trigger stop duration", | 1480 | TABLE_SETTING_LIST(F_TIME_SETTING | F_RECSETTING, rec_stop_gap, |
1454 | "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", | 1481 | LANG_RECORD_STOP_GAP, 1, "trigger min gap", |
1455 | UNIT_SEC, NULL, NULL, NULL, 13, | 1482 | off, UNIT_SEC, NULL, NULL, NULL, 13, time_recording_trigger), |
1456 | 0,1,2,5,10,15,20,25,30,60,120,300,600), | ||
1457 | TABLE_SETTING(F_RECSETTING, rec_stop_gap, LANG_RECORD_STOP_GAP, 1, | ||
1458 | "trigger min gap", | ||
1459 | "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", | ||
1460 | UNIT_SEC, NULL, NULL, NULL, 13, | ||
1461 | 0,1,2,5,10,15,20,25,30,60,120,300,600), | ||
1462 | CHOICE_SETTING(F_RECSETTING, rec_trigger_mode, LANG_RECORD_TRIGGER, TRIG_MODE_OFF, | 1483 | CHOICE_SETTING(F_RECSETTING, rec_trigger_mode, LANG_RECORD_TRIGGER, TRIG_MODE_OFF, |
1463 | "trigger mode","off,once,repeat", NULL ,3, | 1484 | "trigger mode","off,once,repeat", NULL ,3, |
1464 | ID2P(LANG_OFF), ID2P(LANG_RECORD_TRIG_NOREARM), ID2P(LANG_REPEAT)), | 1485 | ID2P(LANG_OFF), ID2P(LANG_RECORD_TRIG_NOREARM), ID2P(LANG_REPEAT)), |
@@ -1469,9 +1490,10 @@ const struct settings_list settings[] = { | |||
1469 | 1490 | ||
1470 | #ifdef HAVE_HISTOGRAM | 1491 | #ifdef HAVE_HISTOGRAM |
1471 | /* TO DO: additional restictions of following REP items? */ | 1492 | /* TO DO: additional restictions of following REP items? */ |
1472 | TABLE_SETTING(F_RECSETTING, histogram_interval, LANG_HISTOGRAM_INTERVAL, 0, | 1493 | INT_SETTING(F_TIME_SETTING | F_RECSETTING, histogram_interval, |
1473 | "histogram interval","0s,1s,2s,4s", | 1494 | LANG_HISTOGRAM_INTERVAL, 0, |
1474 | UNIT_SEC, NULL, NULL, NULL, 4, 0,1,2,4), | 1495 | "histogram interval", UNIT_SEC, 0,4,1, |
1496 | NULL, NULL, NULL), | ||
1475 | #endif /* HAVE_HISTOGRAM */ | 1497 | #endif /* HAVE_HISTOGRAM */ |
1476 | 1498 | ||
1477 | #ifdef HAVE_SPDIF_POWER | 1499 | #ifdef HAVE_SPDIF_POWER |
@@ -1532,20 +1554,18 @@ const struct settings_list settings[] = { | |||
1532 | NULL, 6, ID2P(LANG_OFF), ID2P(LANG_AUTOTRACKSKIP), | 1554 | NULL, 6, ID2P(LANG_OFF), ID2P(LANG_AUTOTRACKSKIP), |
1533 | ID2P(LANG_MANTRACKSKIP), ID2P(LANG_SHUFFLE), | 1555 | ID2P(LANG_MANTRACKSKIP), ID2P(LANG_SHUFFLE), |
1534 | ID2P(LANG_SHUFFLE_TRACKSKIP), ID2P(LANG_ALWAYS)), | 1556 | ID2P(LANG_SHUFFLE_TRACKSKIP), ID2P(LANG_ALWAYS)), |
1535 | INT_SETTING(F_SOUNDSETTING, crossfade_fade_in_delay, | 1557 | INT_SETTING(F_TIME_SETTING | F_SOUNDSETTING, crossfade_fade_in_delay, |
1536 | LANG_CROSSFADE_FADE_IN_DELAY, 0, | 1558 | LANG_CROSSFADE_FADE_IN_DELAY, 0, |
1537 | "crossfade fade in delay", UNIT_SEC, 0, 7, 1, NULL, NULL, NULL), | 1559 | "crossfade fade in delay", UNIT_SEC, 0, 7, 1, NULL, NULL, NULL), |
1538 | INT_SETTING(F_SOUNDSETTING, crossfade_fade_out_delay, | 1560 | INT_SETTING(F_TIME_SETTING | F_SOUNDSETTING, crossfade_fade_out_delay, |
1539 | LANG_CROSSFADE_FADE_OUT_DELAY, 0, | 1561 | LANG_CROSSFADE_FADE_OUT_DELAY, 0, |
1540 | "crossfade fade out delay", UNIT_SEC, 0, 7, 1, NULL, NULL,NULL), | 1562 | "crossfade fade out delay", UNIT_SEC, 0, 7, 1, NULL, NULL,NULL), |
1541 | INT_SETTING(F_SOUNDSETTING, crossfade_fade_in_duration, | 1563 | INT_SETTING(F_TIME_SETTING | F_SOUNDSETTING, crossfade_fade_in_duration, |
1542 | LANG_CROSSFADE_FADE_IN_DURATION, 2, | 1564 | LANG_CROSSFADE_FADE_IN_DURATION, 2, |
1543 | "crossfade fade in duration", UNIT_SEC, 0, 15, 1, NULL, NULL, | 1565 | "crossfade fade in duration", UNIT_SEC, 0, 15, 1, NULL, NULL, NULL), |
1544 | NULL), | 1566 | INT_SETTING(F_TIME_SETTING | F_SOUNDSETTING, crossfade_fade_out_duration, |
1545 | INT_SETTING(F_SOUNDSETTING, crossfade_fade_out_duration, | ||
1546 | LANG_CROSSFADE_FADE_OUT_DURATION, 2, | 1567 | LANG_CROSSFADE_FADE_OUT_DURATION, 2, |
1547 | "crossfade fade out duration", UNIT_SEC, 0, 15, 1, NULL, NULL, | 1568 | "crossfade fade out duration", UNIT_SEC, 0, 15, 1, NULL, NULL, NULL), |
1548 | NULL), | ||
1549 | CHOICE_SETTING(F_SOUNDSETTING, crossfade_fade_out_mixmode, | 1569 | CHOICE_SETTING(F_SOUNDSETTING, crossfade_fade_out_mixmode, |
1550 | LANG_CROSSFADE_FADE_OUT_MODE, 0, | 1570 | LANG_CROSSFADE_FADE_OUT_MODE, 0, |
1551 | "crossfade fade out mode", "crossfade,mix", NULL, 2, | 1571 | "crossfade fade out mode", "crossfade,mix", NULL, 2, |
@@ -1697,9 +1717,10 @@ const struct settings_list settings[] = { | |||
1697 | OFFON_SETTING(F_SOUNDSETTING, dithering_enabled, LANG_DITHERING, false, | 1717 | OFFON_SETTING(F_SOUNDSETTING, dithering_enabled, LANG_DITHERING, false, |
1698 | "dithering enabled", dsp_dither_enable), | 1718 | "dithering enabled", dsp_dither_enable), |
1699 | /* surround */ | 1719 | /* surround */ |
1700 | TABLE_SETTING(F_SOUNDSETTING, surround_enabled, | 1720 | TABLE_SETTING(F_TIME_SETTING | F_SOUNDSETTING, surround_enabled, |
1701 | LANG_SURROUND, 0, "surround enabled", "off", | 1721 | LANG_SURROUND, 0, "surround enabled", off, |
1702 | UNIT_MS, formatter_unit_0_is_off, getlang_unit_0_is_off, | 1722 | UNIT_MS, formatter_time_unit_0_is_off, |
1723 | getlang_time_unit_0_is_off, | ||
1703 | dsp_surround_enable, 6, | 1724 | dsp_surround_enable, 6, |
1704 | 0,5,8,10,15,30), | 1725 | 0,5,8,10,15,30), |
1705 | INT_SETTING_NOWRAP(F_SOUNDSETTING, surround_balance, | 1726 | INT_SETTING_NOWRAP(F_SOUNDSETTING, surround_balance, |
@@ -1760,11 +1781,13 @@ const struct settings_list settings[] = { | |||
1760 | LANG_COMPRESSOR_KNEE, 1, "compressor knee", | 1781 | LANG_COMPRESSOR_KNEE, 1, "compressor knee", |
1761 | "hard knee,soft knee", compressor_set, 2, | 1782 | "hard knee,soft knee", compressor_set, 2, |
1762 | ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), | 1783 | ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), |
1763 | INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.attack_time, | 1784 | INT_SETTING_NOWRAP(F_TIME_SETTING | F_SOUNDSETTING, |
1785 | compressor_settings.attack_time, | ||
1764 | LANG_COMPRESSOR_ATTACK, 5, | 1786 | LANG_COMPRESSOR_ATTACK, 5, |
1765 | "compressor attack time", UNIT_MS, 0, 30, | 1787 | "compressor attack time", UNIT_MS, 0, 30, |
1766 | 5, NULL, NULL, compressor_set), | 1788 | 5, NULL, NULL, compressor_set), |
1767 | INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time, | 1789 | INT_SETTING_NOWRAP(F_TIME_SETTING | F_SOUNDSETTING, |
1790 | compressor_settings.release_time, | ||
1768 | LANG_COMPRESSOR_RELEASE, 500, | 1791 | LANG_COMPRESSOR_RELEASE, 500, |
1769 | "compressor release time", UNIT_MS, 100, 1000, | 1792 | "compressor release time", UNIT_MS, 100, 1000, |
1770 | 100, NULL, NULL, compressor_set), | 1793 | 100, NULL, NULL, compressor_set), |
@@ -1831,16 +1854,12 @@ const struct settings_list settings[] = { | |||
1831 | #endif | 1854 | #endif |
1832 | 1855 | ||
1833 | #ifdef HAVE_LCD_SLEEP_SETTING | 1856 | #ifdef HAVE_LCD_SLEEP_SETTING |
1834 | STRINGCHOICE_SETTING(0, lcd_sleep_after_backlight_off, | 1857 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, |
1835 | LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF, 3, | 1858 | lcd_sleep_after_backlight_off, LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF, |
1836 | "lcd sleep after backlight off", | 1859 | 5, "lcd sleep after backlight off", |
1837 | "always,never,5,10,15,20,30,45,60,90", | 1860 | off_on, UNIT_SEC, formatter_time_unit_0_is_always, |
1838 | lcd_set_sleep_after_backlight_off, 10, | 1861 | getlang_time_unit_0_is_always, lcd_set_sleep_after_backlight_off, |
1839 | LANG_ALWAYS, LANG_NEVER, TALK_ID(5, UNIT_SEC), | 1862 | 23, timeout_sec_common), |
1840 | TALK_ID(10, UNIT_SEC), TALK_ID(15, UNIT_SEC), | ||
1841 | TALK_ID(20, UNIT_SEC), TALK_ID(30, UNIT_SEC), | ||
1842 | TALK_ID(45, UNIT_SEC),TALK_ID(60, UNIT_SEC), | ||
1843 | TALK_ID(90, UNIT_SEC)), | ||
1844 | #endif /* HAVE_LCD_SLEEP_SETTING */ | 1863 | #endif /* HAVE_LCD_SLEEP_SETTING */ |
1845 | #endif /* HAVE_BACKLIGHT */ | 1864 | #endif /* HAVE_BACKLIGHT */ |
1846 | 1865 | ||
@@ -1863,7 +1882,7 @@ const struct settings_list settings[] = { | |||
1863 | {F_T_INT,&global_settings.rec_agc_maxgain_line,-1,INT(96), | 1882 | {F_T_INT,&global_settings.rec_agc_maxgain_line,-1,INT(96), |
1864 | "agc maximum line gain",NULL,UNUSED}, | 1883 | "agc maximum line gain",NULL,UNUSED}, |
1865 | {F_T_INT,&global_settings.rec_agc_cliptime,LANG_RECORDING_AGC_CLIPTIME, | 1884 | {F_T_INT,&global_settings.rec_agc_cliptime,LANG_RECORDING_AGC_CLIPTIME, |
1866 | INT(1),"agc cliptime","0.2s,0.4s,0.6s,0.8,1s",UNUSED}, | 1885 | INT(1),"agc cliptime","0.2 s,0.4 s,0.6 s,0.8 s,1 s",UNUSED}, |
1867 | #endif | 1886 | #endif |
1868 | 1887 | ||
1869 | #ifdef HAVE_REMOTE_LCD | 1888 | #ifdef HAVE_REMOTE_LCD |
@@ -1884,9 +1903,9 @@ const struct settings_list settings[] = { | |||
1884 | LANG_HEADPHONE_UNPLUG_DISABLE_AUTORESUME, false, | 1903 | LANG_HEADPHONE_UNPLUG_DISABLE_AUTORESUME, false, |
1885 | "disable autoresume if phones not present",NULL), | 1904 | "disable autoresume if phones not present",NULL), |
1886 | #endif | 1905 | #endif |
1887 | INT_SETTING(0, pause_rewind, LANG_PAUSE_REWIND, 0, | 1906 | INT_SETTING(F_TIME_SETTING, pause_rewind, LANG_PAUSE_REWIND, 0, |
1888 | "rewind duration on pause", UNIT_SEC, 0, 15, 1, NULL, NULL, | 1907 | "rewind duration on pause", UNIT_SEC, 0, 15, 1, |
1889 | NULL), | 1908 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, NULL), |
1890 | #if CONFIG_TUNER | 1909 | #if CONFIG_TUNER |
1891 | CHOICE_SETTING(0, fm_region, LANG_FM_REGION, 0, | 1910 | CHOICE_SETTING(0, fm_region, LANG_FM_REGION, 0, |
1892 | "fm_region", "eu,us,jp,kr,it,wo", set_radio_region, 6, | 1911 | "fm_region", "eu,us,jp,kr,it,wo", set_radio_region, 6, |
@@ -1945,12 +1964,12 @@ const struct settings_list settings[] = { | |||
1945 | #endif | 1964 | #endif |
1946 | OFFON_SETTING(F_BANFROMQS,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", | 1965 | OFFON_SETTING(F_BANFROMQS,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", |
1947 | NULL), | 1966 | NULL), |
1948 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length, | 1967 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, skip_length, |
1949 | LANG_SKIP_LENGTH, 0, "skip length", | 1968 | LANG_SKIP_LENGTH, 0, "skip length", |
1950 | "outro,track,1s,2s,3s,5s,7s,10s,15s,20s,30s,45s,1min,90s,2min,3min,5min,10min,15min", | 1969 | "outro,track", |
1951 | UNIT_SEC, formatter_unit_0_is_skip_track, | 1970 | UNIT_SEC, formatter_time_unit_0_is_skip_track, |
1952 | getlang_unit_0_is_skip_track, NULL, | 1971 | getlang_time_unit_0_is_skip_track, NULL, |
1953 | 19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900), | 1972 | 25, timeout_sec_common), |
1954 | CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, | 1973 | CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, |
1955 | "start in screen", "previous,root,files," | 1974 | "start in screen", "previous,root,files," |
1956 | #ifdef HAVE_TAGCACHE | 1975 | #ifdef HAVE_TAGCACHE |
@@ -2025,11 +2044,12 @@ const struct settings_list settings[] = { | |||
2025 | THEME_DIR "/", ".colours"), | 2044 | THEME_DIR "/", ".colours"), |
2026 | #endif | 2045 | #endif |
2027 | #ifdef HAVE_BUTTON_LIGHT | 2046 | #ifdef HAVE_BUTTON_LIGHT |
2028 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, buttonlight_timeout, | 2047 | TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, |
2029 | LANG_BUTTONLIGHT_TIMEOUT, 5, "button light timeout", off_on, | 2048 | buttonlight_timeout, LANG_BUTTONLIGHT_TIMEOUT, |
2030 | UNIT_SEC, backlight_formatter, backlight_getlang, | 2049 | DEFAULT_BACKLIGHT_TIMEOUT, "button light timeout", |
2031 | buttonlight_set_timeout, 20, | 2050 | off_on, UNIT_SEC, formatter_time_unit_0_is_always, |
2032 | -1,0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,120), | 2051 | getlang_time_unit_0_is_always, buttonlight_set_timeout, |
2052 | 23, timeout_sec_common), | ||
2033 | #endif | 2053 | #endif |
2034 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | 2054 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
2035 | INT_SETTING(F_NO_WRAP, buttonlight_brightness, LANG_BUTTONLIGHT_BRIGHTNESS, | 2055 | INT_SETTING(F_NO_WRAP, buttonlight_brightness, LANG_BUTTONLIGHT_BRIGHTNESS, |
@@ -2039,9 +2059,9 @@ const struct settings_list settings[] = { | |||
2039 | buttonlight_set_brightness), | 2059 | buttonlight_set_brightness), |
2040 | #endif | 2060 | #endif |
2041 | #ifndef HAVE_WHEEL_ACCELERATION | 2061 | #ifndef HAVE_WHEEL_ACCELERATION |
2042 | INT_SETTING(0, list_accel_start_delay, LANG_LISTACCEL_START_DELAY, | 2062 | INT_SETTING(F_TIME_SETTING, list_accel_start_delay, LANG_LISTACCEL_START_DELAY, |
2043 | 2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1, | 2063 | 2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1, |
2044 | formatter_unit_0_is_off, getlang_unit_0_is_off, NULL), | 2064 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, NULL), |
2045 | INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED, | 2065 | INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED, |
2046 | 3, "list_accel_wait", UNIT_SEC, 1, 10, 1, | 2066 | 3, "list_accel_wait", UNIT_SEC, 1, 10, 1, |
2047 | scanaccel_formatter, getlang_unit_0_is_off, NULL), | 2067 | scanaccel_formatter, getlang_unit_0_is_off, NULL), |
@@ -2068,9 +2088,9 @@ const struct settings_list settings[] = { | |||
2068 | #endif /* CONFIG_CODEC == SWCODEC */ | 2088 | #endif /* CONFIG_CODEC == SWCODEC */ |
2069 | TEXT_SETTING(0, playlist_catalog_dir, "playlist catalog directory", | 2089 | TEXT_SETTING(0, playlist_catalog_dir, "playlist catalog directory", |
2070 | PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL), | 2090 | PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL), |
2071 | INT_SETTING(0, sleeptimer_duration, LANG_SLEEP_TIMER_DURATION, 30, | 2091 | INT_SETTING(F_TIME_SETTING, sleeptimer_duration, LANG_SLEEP_TIMER_DURATION, |
2072 | "sleeptimer duration", | 2092 | 30, "sleeptimer duration", UNIT_MIN, 5, 300, 5, |
2073 | UNIT_MIN, 5, 300, 5, NULL, NULL, NULL), | 2093 | NULL, NULL, NULL), |
2074 | OFFON_SETTING(0, sleeptimer_on_startup, LANG_SLEEP_TIMER_ON_POWER_UP, false, | 2094 | OFFON_SETTING(0, sleeptimer_on_startup, LANG_SLEEP_TIMER_ON_POWER_UP, false, |
2075 | "sleeptimer on startup", NULL), | 2095 | "sleeptimer on startup", NULL), |
2076 | OFFON_SETTING(0, keypress_restarts_sleeptimer, LANG_KEYPRESS_RESTARTS_SLEEP_TIMER, false, | 2096 | OFFON_SETTING(0, keypress_restarts_sleeptimer, LANG_KEYPRESS_RESTARTS_SLEEP_TIMER, false, |
@@ -2211,9 +2231,9 @@ const struct settings_list settings[] = { | |||
2211 | #endif | 2231 | #endif |
2212 | 2232 | ||
2213 | #if CONFIG_CODEC == SWCODEC | 2233 | #if CONFIG_CODEC == SWCODEC |
2214 | INT_SETTING(0, resume_rewind, LANG_RESUME_REWIND, 0, | 2234 | INT_SETTING(F_TIME_SETTING, resume_rewind, LANG_RESUME_REWIND, 0, |
2215 | "resume rewind", UNIT_SEC, 0, 60, 5, | 2235 | "resume rewind", UNIT_SEC, 0, 60, 5, |
2216 | NULL, NULL, NULL), | 2236 | formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, NULL), |
2217 | #endif | 2237 | #endif |
2218 | CUSTOM_SETTING(0, root_menu_customized, | 2238 | CUSTOM_SETTING(0, root_menu_customized, |
2219 | LANG_ROCKBOX_TITLE, /* lang string here is never actually used */ | 2239 | LANG_ROCKBOX_TITLE, /* lang string here is never actually used */ |
diff --git a/apps/settings_list.h b/apps/settings_list.h index 967d581c06..7f0ae6484f 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h | |||
@@ -135,6 +135,7 @@ struct custom_setting { | |||
135 | void (*set_default)(void* setting, void* defaultval); | 135 | void (*set_default)(void* setting, void* defaultval); |
136 | }; | 136 | }; |
137 | 137 | ||
138 | #define F_TIME_SETTING 0x10000 /* int,table format hh:mm:ss.mss auto ranged */ | ||
138 | #define F_THEMESETTING 0x0800000 | 139 | #define F_THEMESETTING 0x0800000 |
139 | #define F_RECSETTING 0x1000000 | 140 | #define F_RECSETTING 0x1000000 |
140 | #define F_EQSETTING 0x2000000 | 141 | #define F_EQSETTING 0x2000000 |
diff --git a/apps/talk.c b/apps/talk.c index 8a2a809c37..de564c0ff0 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "plugin.h" /* plugin_get_buffer() */ | 47 | #include "plugin.h" /* plugin_get_buffer() */ |
48 | #include "debug.h" | 48 | #include "debug.h" |
49 | #include "panic.h" | 49 | #include "panic.h" |
50 | #include "misc.h" /* time_split_units() */ | ||
50 | 51 | ||
51 | /* Memory layout varies between targets because the | 52 | /* Memory layout varies between targets because the |
52 | Archos (MASCODEC) devices cannot mix voice and audio playback | 53 | Archos (MASCODEC) devices cannot mix voice and audio playback |
@@ -1307,22 +1308,7 @@ static int talk_year(long year, bool enqueue) | |||
1307 | say hours,minutes,seconds. */ | 1308 | say hours,minutes,seconds. */ |
1308 | static int talk_time_unit(long secs, bool enqueue) | 1309 | static int talk_time_unit(long secs, bool enqueue) |
1309 | { | 1310 | { |
1310 | int hours, mins; | 1311 | return talk_time_intervals(secs, UNIT_SEC, enqueue); |
1311 | if (!enqueue) | ||
1312 | talk_shutup(); | ||
1313 | if((hours = secs/3600)) { | ||
1314 | secs %= 3600; | ||
1315 | talk_value(hours, UNIT_HOUR, true); | ||
1316 | } | ||
1317 | if((mins = secs/60)) { | ||
1318 | secs %= 60; | ||
1319 | talk_value(mins, UNIT_MIN, true); | ||
1320 | } | ||
1321 | if((secs) || (!hours && !mins)) | ||
1322 | talk_value(secs, UNIT_SEC, true); | ||
1323 | else if(!hours && secs) | ||
1324 | talk_number(secs, true); | ||
1325 | return 0; | ||
1326 | } | 1312 | } |
1327 | 1313 | ||
1328 | void talk_fractional(char *tbuf, int value, int unit) | 1314 | void talk_fractional(char *tbuf, int value, int unit) |
@@ -1443,6 +1429,59 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) | |||
1443 | return 0; | 1429 | return 0; |
1444 | } | 1430 | } |
1445 | 1431 | ||
1432 | /* Say time duration/interval. Input is time unit specifies base unit, | ||
1433 | say hours,minutes,seconds, milliseconds. or any combination thereof */ | ||
1434 | int talk_time_intervals(long time, int unit_idx, bool enqueue) | ||
1435 | { | ||
1436 | unsigned long units_in[UNIT_IDX_TIME_COUNT]; | ||
1437 | |||
1438 | if (talk_temp_disable_count > 0) | ||
1439 | return -1; /* talking has been disabled */ | ||
1440 | if (!check_audio_status()) | ||
1441 | return -1; | ||
1442 | |||
1443 | if (talk_handle <= 0 || index_handle <= 0) /* reload needed? */ | ||
1444 | { | ||
1445 | int fd = open_voicefile(); | ||
1446 | if (fd < 0 || !load_voicefile_index(fd)) | ||
1447 | return -1; | ||
1448 | load_voicefile_data(fd); | ||
1449 | close(fd); | ||
1450 | } | ||
1451 | |||
1452 | if (!enqueue) | ||
1453 | talk_shutup(); /* cut off all the pending stuff */ | ||
1454 | |||
1455 | time_split_units(unit_idx, labs(time), &units_in); | ||
1456 | |||
1457 | if (time < 0) | ||
1458 | talk_id(VOICE_MINUS, true); | ||
1459 | |||
1460 | if (time == 0) | ||
1461 | talk_value(0, unit_idx, true); | ||
1462 | else | ||
1463 | { | ||
1464 | if (units_in[UNIT_IDX_HR] != 0) | ||
1465 | { | ||
1466 | talk_value(units_in[UNIT_IDX_HR], UNIT_HOUR, true); | ||
1467 | } | ||
1468 | if (units_in[UNIT_IDX_MIN] != 0) | ||
1469 | { | ||
1470 | talk_value(units_in[UNIT_IDX_MIN], UNIT_MIN, true); | ||
1471 | } | ||
1472 | if (units_in[UNIT_IDX_SEC] != 0) | ||
1473 | { | ||
1474 | talk_value(units_in[UNIT_IDX_SEC], UNIT_SEC, true); | ||
1475 | } | ||
1476 | if (units_in[UNIT_IDX_MS] != 0) | ||
1477 | { | ||
1478 | talk_value(units_in[UNIT_IDX_MS], UNIT_MS, true); | ||
1479 | } | ||
1480 | } | ||
1481 | |||
1482 | return -1; | ||
1483 | } | ||
1484 | |||
1446 | /* spell a string */ | 1485 | /* spell a string */ |
1447 | int talk_spell(const char* spell, bool enqueue) | 1486 | int talk_spell(const char* spell, bool enqueue) |
1448 | { | 1487 | { |
diff --git a/apps/talk.h b/apps/talk.h index c77c32e06f..3070efc61a 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -131,6 +131,9 @@ void talk_time(const struct tm *tm, bool enqueue); | |||
131 | void talk_date(const struct tm *tm, bool enqueue); | 131 | void talk_date(const struct tm *tm, bool enqueue); |
132 | #endif /* CONFIG_RTC */ | 132 | #endif /* CONFIG_RTC */ |
133 | 133 | ||
134 | /* speaks hr, min, sec, ms; unit_idx is lowest or base unit of the time value */ | ||
135 | int talk_time_intervals(long time, int unit_idx, bool enqueue); | ||
136 | |||
134 | /* This (otherwise invalid) ID signals the end of the array. */ | 137 | /* This (otherwise invalid) ID signals the end of the array. */ |
135 | #define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY | 138 | #define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY |
136 | 139 | ||
diff --git a/firmware/backlight.c b/firmware/backlight.c index 25c295197f..3acc89c27c 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -191,10 +191,6 @@ static int remote_backlight_on_button_hold = 0; | |||
191 | 191 | ||
192 | #ifdef HAVE_LCD_SLEEP | 192 | #ifdef HAVE_LCD_SLEEP |
193 | #ifdef HAVE_LCD_SLEEP_SETTING | 193 | #ifdef HAVE_LCD_SLEEP_SETTING |
194 | const signed char lcd_sleep_timeout_value[10] = | ||
195 | { | ||
196 | -1, 0, 5, 10, 15, 20, 30, 45, 60, 90 | ||
197 | }; | ||
198 | static int lcd_sleep_timeout = 10*HZ; | 194 | static int lcd_sleep_timeout = 10*HZ; |
199 | #else | 195 | #else |
200 | /* Target defines needed value */ | 196 | /* Target defines needed value */ |
@@ -885,23 +881,21 @@ void backlight_set_on_button_hold(int index) | |||
885 | #endif /* HAS_BUTTON_HOLD */ | 881 | #endif /* HAS_BUTTON_HOLD */ |
886 | 882 | ||
887 | #ifdef HAVE_LCD_SLEEP_SETTING | 883 | #ifdef HAVE_LCD_SLEEP_SETTING |
888 | void lcd_set_sleep_after_backlight_off(int index) | 884 | void lcd_set_sleep_after_backlight_off(int timeout_seconds) |
889 | { | 885 | { |
890 | if ((unsigned)index >= sizeof(lcd_sleep_timeout_value)) | 886 | lcd_sleep_timeout = HZ * timeout_seconds; |
891 | /* if given a weird value, use default */ | ||
892 | index = 3; | ||
893 | |||
894 | lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index]; | ||
895 | 887 | ||
896 | if (is_backlight_on(true)) | 888 | if (is_backlight_on(true)) |
897 | /* Timer will be set when bl turns off or bl set to on. */ | 889 | /* Timer will be set when bl turns off or bl set to on. */ |
898 | return; | 890 | return; |
899 | 891 | ||
900 | /* Backlight is Off */ | 892 | /* Backlight is Off */ |
901 | if (lcd_sleep_timeout < 0) | 893 | if (lcd_sleep_timeout < 0) |
894 | lcd_sleep_timer = 0; /* Never */ | ||
895 | else if (lcd_sleep_timeout == 0) | ||
902 | lcd_sleep_timer = 1; /* Always - sleep next tick */ | 896 | lcd_sleep_timer = 1; /* Always - sleep next tick */ |
903 | else | 897 | else |
904 | lcd_sleep_timer = lcd_sleep_timeout; /* Never, other */ | 898 | lcd_sleep_timer = lcd_sleep_timeout; /* other */ |
905 | } | 899 | } |
906 | #endif /* HAVE_LCD_SLEEP_SETTING */ | 900 | #endif /* HAVE_LCD_SLEEP_SETTING */ |
907 | 901 | ||
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 5710f9f653..5ed9c706a4 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -69,7 +69,7 @@ struct mp3entry* audio_current_track(void); | |||
69 | struct mp3entry* audio_next_track(void); | 69 | struct mp3entry* audio_next_track(void); |
70 | bool audio_peek_track(struct mp3entry* id3, int offset); | 70 | bool audio_peek_track(struct mp3entry* id3, int offset); |
71 | #ifdef HAVE_DISK_STORAGE | 71 | #ifdef HAVE_DISK_STORAGE |
72 | void audio_set_buffer_margin(int setting); | 72 | void audio_set_buffer_margin(int seconds); |
73 | #endif | 73 | #endif |
74 | void audio_error_clear(void); | 74 | void audio_error_clear(void); |
75 | int audio_get_file_pos(void); | 75 | int audio_get_file_pos(void); |
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index 19e5f9b91b..a1c65a3b4e 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h | |||
@@ -57,7 +57,7 @@ void backlight_set_on_button_hold(int index); | |||
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #if defined(HAVE_LCD_SLEEP) && defined(HAVE_LCD_SLEEP_SETTING) | 59 | #if defined(HAVE_LCD_SLEEP) && defined(HAVE_LCD_SLEEP_SETTING) |
60 | void lcd_set_sleep_after_backlight_off(int index); | 60 | void lcd_set_sleep_after_backlight_off(int timeout_seconds); |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #else /* !HAVE_BACKLIGHT */ | 63 | #else /* !HAVE_BACKLIGHT */ |