diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-03 22:16:08 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-03 22:16:08 +0000 |
commit | be90f74e89978224a169c793d4e688867dc38b41 (patch) | |
tree | dce0af0eb60cd29e421b55a213a3fbfdb993031f /apps | |
parent | 5c80a838e4f6217970998df9d2bef44a9dddc795 (diff) | |
download | rockbox-be90f74e89978224a169c793d4e688867dc38b41.tar.gz rockbox-be90f74e89978224a169c793d4e688867dc38b41.zip |
Histogram display on recording screen. Based on the work of Jvo Studer in FS #5021 but reduced and reworked since the recording screen code changed quite a bit since his patch. For now enabled on iriver h1x0 and h3x0 only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25007 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/features.txt | 4 | ||||
-rw-r--r-- | apps/lang/english.lang | 35 | ||||
-rw-r--r-- | apps/menus/recording_menu.c | 25 | ||||
-rw-r--r-- | apps/recorder/peakmeter.c | 36 | ||||
-rw-r--r-- | apps/recorder/recording.c | 238 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_list.c | 7 |
7 files changed, 282 insertions, 66 deletions
diff --git a/apps/features.txt b/apps/features.txt index f94a74cd19..242d2d4386 100644 --- a/apps/features.txt +++ b/apps/features.txt | |||
@@ -148,6 +148,10 @@ recording_mic | |||
148 | #endif | 148 | #endif |
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
152 | recording_histogram | ||
153 | #endif | ||
154 | |||
151 | #if defined(HAVE_REMOTE_LCD) | 155 | #if defined(HAVE_REMOTE_LCD) |
152 | remote | 156 | remote |
153 | remote_lcd_invert | 157 | remote_lcd_invert |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index ecbd41505d..45c82fe378 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -13349,3 +13349,38 @@ | |||
13349 | remote: "Remote Screen" | 13349 | remote: "Remote Screen" |
13350 | </voice> | 13350 | </voice> |
13351 | </phrase> | 13351 | </phrase> |
13352 | <phrase> | ||
13353 | id: LANG_RECORDING_HISTOGRAM_MODE | ||
13354 | desc: in record settings menu | ||
13355 | user: core | ||
13356 | <source> | ||
13357 | *: none | ||
13358 | recording_histogram: "Histogram mode" | ||
13359 | </source> | ||
13360 | <dest> | ||
13361 | *: none | ||
13362 | recording_histogram: "Histogram mode" | ||
13363 | </dest> | ||
13364 | <voice> | ||
13365 | *: none | ||
13366 | recording_histogram: "Histogram mode" | ||
13367 | </voice> | ||
13368 | </phrase> | ||
13369 | <phrase> | ||
13370 | id: LANG_RECORDING_HISTOGRAM_INTERVAL | ||
13371 | desc: in record settings menu | ||
13372 | user: core | ||
13373 | <source> | ||
13374 | *: none | ||
13375 | recording_histogram: "Histogram interval" | ||
13376 | </source> | ||
13377 | <dest> | ||
13378 | *: none | ||
13379 | recording_histogram: "Histogram interval" | ||
13380 | </dest> | ||
13381 | <voice> | ||
13382 | *: none | ||
13383 | recording_histogram: "Histogram interval" | ||
13384 | </voice> | ||
13385 | </phrase> | ||
13386 | |||
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 4bbc4b163c..b5bbecb9aa 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c | |||
@@ -350,7 +350,7 @@ static int clear_rec_directory(void) | |||
350 | } | 350 | } |
351 | MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR), | 351 | MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR), |
352 | clear_rec_directory, NULL, NULL, Icon_Folder); | 352 | clear_rec_directory, NULL, NULL, Icon_Folder); |
353 | 353 | ||
354 | MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL); | 354 | MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL); |
355 | 355 | ||
356 | #ifdef HAVE_AGC | 356 | #ifdef HAVE_AGC |
@@ -393,6 +393,26 @@ MENUITEM_FUNCTION(agc_cliptime, 0, ID2P(LANG_RECORDING_AGC_CLIPTIME), | |||
393 | agc_cliptime_func, NULL, NULL, Icon_Menu_setting); | 393 | agc_cliptime_func, NULL, NULL, Icon_Menu_setting); |
394 | #endif /* HAVE_AGC */ | 394 | #endif /* HAVE_AGC */ |
395 | 395 | ||
396 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
397 | static bool history_interval(void) | ||
398 | { | ||
399 | static const struct opt_items names[] = { | ||
400 | { "0s", TALK_ID(0, UNIT_SEC) }, | ||
401 | { "1s", TALK_ID(1, UNIT_SEC) }, | ||
402 | { "2s", TALK_ID(2, UNIT_SEC) }, | ||
403 | { "4s", TALK_ID(5, UNIT_SEC) } | ||
404 | }; | ||
405 | return set_option(str(LANG_RECORDING_HISTOGRAM_INTERVAL), | ||
406 | &global_settings.rec_histogram_interval, | ||
407 | INT, names, 4, NULL ); | ||
408 | } | ||
409 | |||
410 | MENUITEM_FUNCTION(recording_histogram, 0, | ||
411 | ID2P(LANG_RECORDING_HISTOGRAM_INTERVAL), | ||
412 | history_interval, NULL, NULL, Icon_Menu_setting); | ||
413 | |||
414 | #endif | ||
415 | |||
396 | /** Rec trigger **/ | 416 | /** Rec trigger **/ |
397 | enum trigger_menu_option | 417 | enum trigger_menu_option |
398 | { | 418 | { |
@@ -647,6 +667,9 @@ MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS), | |||
647 | #ifdef HAVE_AGC | 667 | #ifdef HAVE_AGC |
648 | &agc_preset, &agc_cliptime, | 668 | &agc_preset, &agc_cliptime, |
649 | #endif | 669 | #endif |
670 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
671 | &recording_histogram, | ||
672 | #endif | ||
650 | #ifdef HAVE_LCD_BITMAP | 673 | #ifdef HAVE_LCD_BITMAP |
651 | &peak_meter_menu, | 674 | &peak_meter_menu, |
652 | #endif | 675 | #endif |
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index fc68ce4267..8f32a837a7 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -66,7 +66,7 @@ static int pm_cur_left; /* current values (last peak_meter_peek) */ | |||
66 | static int pm_cur_right; | 66 | static int pm_cur_right; |
67 | static int pm_max_left; /* maximum values between peak meter draws */ | 67 | static int pm_max_left; /* maximum values between peak meter draws */ |
68 | static int pm_max_right; | 68 | static int pm_max_right; |
69 | #ifdef HAVE_AGC | 69 | #if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) |
70 | static int pm_peakhold_left; /* max. peak values between peakhold calls */ | 70 | static int pm_peakhold_left; /* max. peak values between peakhold calls */ |
71 | static int pm_peakhold_right; /* used for AGC and histogram display */ | 71 | static int pm_peakhold_right; /* used for AGC and histogram display */ |
72 | #endif | 72 | #endif |
@@ -799,9 +799,16 @@ static int peak_meter_read_l(void) | |||
799 | { | 799 | { |
800 | /* pm_max_left contains the maximum of all peak values that were read | 800 | /* pm_max_left contains the maximum of all peak values that were read |
801 | by peak_meter_peek since the last call of peak_meter_read_l */ | 801 | by peak_meter_peek since the last call of peak_meter_read_l */ |
802 | int retval = pm_max_left; | 802 | int retval; |
803 | |||
804 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
805 | srand(current_tick); | ||
806 | pm_max_left = rand()%MAX_PEAK; | ||
807 | #endif | ||
803 | 808 | ||
804 | #ifdef HAVE_AGC | 809 | retval = pm_max_left; |
810 | |||
811 | #if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC) | ||
805 | /* store max peak value for peak_meter_get_peakhold_x readout */ | 812 | /* store max peak value for peak_meter_get_peakhold_x readout */ |
806 | pm_peakhold_left = MAX(pm_max_left, pm_peakhold_left); | 813 | pm_peakhold_left = MAX(pm_max_left, pm_peakhold_left); |
807 | #endif | 814 | #endif |
@@ -812,11 +819,6 @@ static int peak_meter_read_l(void) | |||
812 | get fooled by an old maximum value */ | 819 | get fooled by an old maximum value */ |
813 | pm_max_left = pm_cur_left; | 820 | pm_max_left = pm_cur_left; |
814 | 821 | ||
815 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
816 | srand(current_tick); | ||
817 | retval = rand()%MAX_PEAK; | ||
818 | #endif | ||
819 | |||
820 | return retval; | 822 | return retval; |
821 | } | 823 | } |
822 | 824 | ||
@@ -830,9 +832,16 @@ static int peak_meter_read_r(void) | |||
830 | { | 832 | { |
831 | /* peak_meter_r contains the maximum of all peak values that were read | 833 | /* peak_meter_r contains the maximum of all peak values that were read |
832 | by peak_meter_peek since the last call of peak_meter_read_r */ | 834 | by peak_meter_peek since the last call of peak_meter_read_r */ |
833 | int retval = pm_max_right; | 835 | int retval; |
836 | |||
837 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
838 | srand(current_tick); | ||
839 | pm_max_right = rand()%MAX_PEAK; | ||
840 | #endif | ||
834 | 841 | ||
835 | #ifdef HAVE_AGC | 842 | retval = pm_max_right; |
843 | |||
844 | #if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC) | ||
836 | /* store max peak value for peak_meter_get_peakhold_x readout */ | 845 | /* store max peak value for peak_meter_get_peakhold_x readout */ |
837 | pm_peakhold_right = MAX(pm_max_right, pm_peakhold_right); | 846 | pm_peakhold_right = MAX(pm_max_right, pm_peakhold_right); |
838 | #endif | 847 | #endif |
@@ -843,15 +852,10 @@ static int peak_meter_read_r(void) | |||
843 | get fooled by an old maximum value */ | 852 | get fooled by an old maximum value */ |
844 | pm_max_right = pm_cur_right; | 853 | pm_max_right = pm_cur_right; |
845 | 854 | ||
846 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
847 | srand(current_tick); | ||
848 | retval = rand()%MAX_PEAK; | ||
849 | #endif | ||
850 | |||
851 | return retval; | 855 | return retval; |
852 | } | 856 | } |
853 | 857 | ||
854 | #ifdef HAVE_AGC | 858 | #if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) |
855 | /** | 859 | /** |
856 | * Reads out the current peak-hold values since the last call. | 860 | * Reads out the current peak-hold values since the last call. |
857 | * This is used by the histogram feature in the recording screen. | 861 | * This is used by the histogram feature in the recording screen. |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 8b52b7cac2..2c8e473c11 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -219,7 +219,6 @@ static char path_buffer[MAX_PATH]; | |||
219 | * overflow every 13 years 8-) | 219 | * overflow every 13 years 8-) |
220 | */ | 220 | */ |
221 | static long peak_time = 0; | 221 | static long peak_time = 0; |
222 | static long hist_time = 0; | ||
223 | 222 | ||
224 | static short peak_valid_mem[4]; | 223 | static short peak_valid_mem[4]; |
225 | #define BAL_MEM_SIZE 24 | 224 | #define BAL_MEM_SIZE 24 |
@@ -269,6 +268,38 @@ static short agc_baltime = 0; | |||
269 | /* AGC maximum gain */ | 268 | /* AGC maximum gain */ |
270 | static short agc_maxgain; | 269 | static short agc_maxgain; |
271 | #endif /* HAVE_AGC */ | 270 | #endif /* HAVE_AGC */ |
271 | #if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) | ||
272 | static long hist_time = 0; | ||
273 | #endif /* HAVE_AGC or HAVE_RECORDING_HISTOGRAM */ | ||
274 | /* Histogram data */ | ||
275 | /* TO DO: move some of this stuff inside the recording function? */ | ||
276 | #ifdef HAVE_RECORDING_HISTOGRAM | ||
277 | static int hist_l = 0; | ||
278 | static int hist_r = 0; | ||
279 | #define HIST_Y (hist_pos_y+hist_size_h-1) | ||
280 | #define HIST_W (LCD_WIDTH / 2 - 4) | ||
281 | #if LCD_DEPTH > 1 | ||
282 | #ifdef HAVE_LCD_COLOR | ||
283 | #define LCD_BAL_L LCD_RGBPACK(0, 0, 255) | ||
284 | #define LCD_BAL_R LCD_RGBPACK(204, 0, 0) | ||
285 | #define LCD_HIST_OVER LCD_RGBPACK(204, 0, 0) | ||
286 | #define LCD_HIST_HI LCD_RGBPACK(255, 204, 0) | ||
287 | #define LCD_HIST_OK LCD_RGBPACK(51, 153, 0) | ||
288 | #else /* HAVE_LCD_COLOR */ | ||
289 | #define LCD_BATT_OK LCD_BLACK | ||
290 | #define LCD_BATT_LO LCD_DARKGRAY | ||
291 | #define LCD_DISK_OK LCD_BLACK | ||
292 | #define LCD_DISK_LO LCD_DARKGRAY | ||
293 | #define LCD_HIST_OVER LCD_BLACK | ||
294 | #define LCD_HIST_OK LCD_DARKGRAY | ||
295 | #define LCD_BAL LCD_DARKGRAY | ||
296 | #endif /* HAVE_LCD_COLOR */ | ||
297 | #else /* LCD_DEPTH > 1 */ | ||
298 | #define LCD_HIST_OVER LCD_DEFAULT_FG | ||
299 | #define LCD_HIST_OK LCD_DEFAULT_FG | ||
300 | #define LCD_BAL LCD_DEFAULT_FG | ||
301 | #endif /* LCD_DEPTH > 1 */ | ||
302 | #endif /* HAVE_RECORDING_HISTOGRAM */ | ||
272 | 303 | ||
273 | static void set_gain(void) | 304 | static void set_gain(void) |
274 | { | 305 | { |
@@ -317,6 +348,13 @@ static bool read_peak_levels(int *peak_l, int *peak_r, int *balance) | |||
317 | *balance += balance_mem[i]; | 348 | *balance += balance_mem[i]; |
318 | *balance = *balance / BAL_MEM_SIZE; | 349 | *balance = *balance / BAL_MEM_SIZE; |
319 | 350 | ||
351 | #ifdef HAVE_RECORDING_HISTOGRAM | ||
352 | if (*peak_l > hist_l) | ||
353 | hist_l = *peak_l; | ||
354 | if (*peak_r > hist_r) | ||
355 | hist_r = *peak_r; | ||
356 | #endif | ||
357 | |||
320 | return true; | 358 | return true; |
321 | } | 359 | } |
322 | 360 | ||
@@ -1015,7 +1053,6 @@ bool recording_screen(bool no_source) | |||
1015 | #endif | 1053 | #endif |
1016 | #ifdef HAVE_AGC | 1054 | #ifdef HAVE_AGC |
1017 | bool peak_read = false; | 1055 | bool peak_read = false; |
1018 | bool peak_valid = false; | ||
1019 | int peak_l, peak_r; | 1056 | int peak_l, peak_r; |
1020 | int balance = 0; | 1057 | int balance = 0; |
1021 | #endif | 1058 | #endif |
@@ -1025,9 +1062,21 @@ bool recording_screen(bool no_source) | |||
1025 | int pm_h[NB_SCREENS]; /* peakmeter height */ | 1062 | int pm_h[NB_SCREENS]; /* peakmeter height */ |
1026 | int trig_ypos[NB_SCREENS]; /* trigger bar y pos */ | 1063 | int trig_ypos[NB_SCREENS]; /* trigger bar y pos */ |
1027 | int trig_width[NB_SCREENS]; /* trigger bar width */ | 1064 | int trig_width[NB_SCREENS]; /* trigger bar width */ |
1065 | int top_height_req[NB_SCREENS]; /* required height for top half */ | ||
1028 | bool compact_view[NB_SCREENS]; /* tweak layout tiny screens / big fonts */ | 1066 | bool compact_view[NB_SCREENS]; /* tweak layout tiny screens / big fonts */ |
1029 | |||
1030 | struct gui_synclist lists; /* the list in the bottom vp */ | 1067 | struct gui_synclist lists; /* the list in the bottom vp */ |
1068 | #if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) | ||
1069 | bool peak_valid = false; | ||
1070 | #endif | ||
1071 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
1072 | unsigned short hist_pos_y = 0; | ||
1073 | unsigned short hist_size_h = 0; | ||
1074 | int history_pos = 0; | ||
1075 | short hist_time_interval = 1; /* 1, 2, 4, 8 */ | ||
1076 | unsigned char history_l[HIST_W]; | ||
1077 | unsigned char history_r[HIST_W]; | ||
1078 | const char hist_level_marks[6] = { 29, 26, 23, 17, 9, 2}; | ||
1079 | #endif | ||
1031 | #ifdef HAVE_FMRADIO_REC | 1080 | #ifdef HAVE_FMRADIO_REC |
1032 | int prev_rec_source = global_settings.rec_source; /* detect source change */ | 1081 | int prev_rec_source = global_settings.rec_source; /* detect source change */ |
1033 | #endif | 1082 | #endif |
@@ -1084,49 +1133,6 @@ bool recording_screen(bool no_source) | |||
1084 | rec_init_filename(); | 1133 | rec_init_filename(); |
1085 | #endif | 1134 | #endif |
1086 | 1135 | ||
1087 | /* viewport init and calculations that only needs to be done once */ | ||
1088 | FOR_NB_SCREENS(i) | ||
1089 | { | ||
1090 | struct viewport *v; | ||
1091 | /* top vp, 4 lines, force sys font if total screen < 6 lines | ||
1092 | NOTE: one could limit the list to 1 line and get away with 5 lines */ | ||
1093 | v = &vp_top[i]; | ||
1094 | viewport_set_defaults(v, i); | ||
1095 | if (viewport_get_nb_lines(v) < 4) | ||
1096 | { | ||
1097 | /* compact needs 4 lines total */ | ||
1098 | v->font = FONT_SYSFIXED; | ||
1099 | compact_view[i] = false; | ||
1100 | } | ||
1101 | else | ||
1102 | { | ||
1103 | if (viewport_get_nb_lines(v) < (4+2)) /*top=4,list=2*/ | ||
1104 | compact_view[i] = true; | ||
1105 | else | ||
1106 | compact_view[i] = false; | ||
1107 | } | ||
1108 | vp_list[i] = *v; /* get a copy now so it can be sized more easily */ | ||
1109 | v->height = (font_get(v->font)->height)*(compact_view[i] ? 3 : 4); | ||
1110 | |||
1111 | /* list section, rest of the screen */ | ||
1112 | vp_list[i].y += vp_top[i].height; | ||
1113 | vp_list[i].height -= vp_top[i].height; | ||
1114 | screens[i].set_viewport(&vp_top[i]); /* req for next calls */ | ||
1115 | |||
1116 | screens[i].getstringsize("W", &w, &h); | ||
1117 | pm_y[i] = font_get(vp_top[i].font)->height * 2; | ||
1118 | trig_ypos[i] = font_get(vp_top[i].font)->height * 3; | ||
1119 | if(compact_view[i]) | ||
1120 | trig_ypos[i] -= (font_get(vp_top[i].font)->height)/2; | ||
1121 | } | ||
1122 | |||
1123 | /* init the bottom list */ | ||
1124 | gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list); | ||
1125 | gui_synclist_set_title(&lists, NULL, Icon_NOICON); | ||
1126 | |||
1127 | |||
1128 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */ | ||
1129 | |||
1130 | /* start of the loop: we stay in this loop until user quits recscreen */ | 1136 | /* start of the loop: we stay in this loop until user quits recscreen */ |
1131 | while(done <= 0) | 1137 | while(done <= 0) |
1132 | { | 1138 | { |
@@ -1143,6 +1149,65 @@ bool recording_screen(bool no_source) | |||
1143 | prev_rec_source = global_settings.rec_source; | 1149 | prev_rec_source = global_settings.rec_source; |
1144 | #endif | 1150 | #endif |
1145 | 1151 | ||
1152 | /* viewport init and calculations that only needs to be done once */ | ||
1153 | FOR_NB_SCREENS(i) | ||
1154 | { | ||
1155 | struct viewport *v; | ||
1156 | /* top vp, 4 lines, force sys font if total screen < 6 lines | ||
1157 | NOTE: one could limit the list to 1 line and get away with 5 lines */ | ||
1158 | top_height_req[i] = 4; | ||
1159 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
1160 | if((global_settings.rec_histogram_interval) && (!i)) | ||
1161 | top_height_req[i] += 1; /* use one line for histogram */ | ||
1162 | hist_time_interval = 1 << global_settings.rec_histogram_interval; | ||
1163 | #endif | ||
1164 | v = &vp_top[i]; | ||
1165 | viewport_set_defaults(v, i); | ||
1166 | if (viewport_get_nb_lines(v) < top_height_req[i]) | ||
1167 | { | ||
1168 | /* compact needs 4 lines total */ | ||
1169 | v->font = FONT_SYSFIXED; | ||
1170 | compact_view[i] = false; | ||
1171 | } | ||
1172 | else | ||
1173 | { | ||
1174 | /*top=4,list=2*/ | ||
1175 | if (viewport_get_nb_lines(v) < (top_height_req[i]+2)) | ||
1176 | compact_view[i] = true; | ||
1177 | else | ||
1178 | compact_view[i] = false; | ||
1179 | } | ||
1180 | vp_list[i] = *v; /* get a copy now so it can be sized more easily */ | ||
1181 | v->height = (font_get(v->font)->height)*(compact_view[i] ? 3 : | ||
1182 | top_height_req[i]); | ||
1183 | |||
1184 | /* list section, rest of the screen */ | ||
1185 | vp_list[i].y += vp_top[i].height; | ||
1186 | vp_list[i].height -= vp_top[i].height; | ||
1187 | screens[i].set_viewport(&vp_top[i]); /* req for next calls */ | ||
1188 | |||
1189 | screens[i].getstringsize("W", &w, &h); | ||
1190 | pm_y[i] = font_get(vp_top[i].font)->height * 2; | ||
1191 | trig_ypos[i] = font_get(vp_top[i].font)->height * 3; | ||
1192 | if(compact_view[i]) | ||
1193 | trig_ypos[i] -= (font_get(vp_top[i].font)->height)/2; | ||
1194 | } | ||
1195 | |||
1196 | /* init the bottom list */ | ||
1197 | gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list); | ||
1198 | gui_synclist_set_title(&lists, NULL, Icon_NOICON); | ||
1199 | |||
1200 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */ | ||
1201 | |||
1202 | #if defined(HAVE_RECORDING_HISTOGRAM) | ||
1203 | history_pos = 0; | ||
1204 | hist_pos_y = (compact_view[0] ? 3 : 4) * (font_get(vp_top[0].font)->height) | ||
1205 | + 1; | ||
1206 | hist_size_h = font_get(vp_top[0].font)->height - 2; | ||
1207 | memset(history_l, 0, sizeof(unsigned char)*HIST_W); | ||
1208 | memset(history_r, 0, sizeof(unsigned char)*HIST_W); | ||
1209 | #endif | ||
1210 | |||
1146 | FOR_NB_SCREENS(i) | 1211 | FOR_NB_SCREENS(i) |
1147 | { | 1212 | { |
1148 | pm_x[i] = 0; | 1213 | pm_x[i] = 0; |
@@ -1673,12 +1738,11 @@ bool recording_screen(bool no_source) | |||
1673 | unsigned int dseconds, dhours, dminutes; | 1738 | unsigned int dseconds, dhours, dminutes; |
1674 | unsigned long num_recorded_bytes, dsize, dmb; | 1739 | unsigned long num_recorded_bytes, dsize, dmb; |
1675 | 1740 | ||
1676 | |||
1677 | FOR_NB_SCREENS(i) | 1741 | FOR_NB_SCREENS(i) |
1678 | { | 1742 | { |
1679 | screens[i].set_viewport(&vp_top[i]); | 1743 | screens[i].set_viewport(&vp_top[i]); |
1680 | screens[i].clear_viewport(); | 1744 | screens[i].clear_viewport(); |
1681 | } | 1745 | } |
1682 | update_countdown = 5; | 1746 | update_countdown = 5; |
1683 | last_seconds = seconds; | 1747 | last_seconds = seconds; |
1684 | 1748 | ||
@@ -1796,6 +1860,83 @@ bool recording_screen(bool no_source) | |||
1796 | } | 1860 | } |
1797 | } | 1861 | } |
1798 | 1862 | ||
1863 | #ifdef HAVE_RECORDING_HISTOGRAM | ||
1864 | if(global_settings.rec_histogram_interval) | ||
1865 | { | ||
1866 | if (peak_valid && !(hist_time % hist_time_interval) && hist_l) | ||
1867 | { | ||
1868 | history_l[history_pos] = hist_l * hist_size_h / 32767; | ||
1869 | history_r[history_pos] = hist_r * hist_size_h / 32767; | ||
1870 | history_pos = (history_pos + 1) % HIST_W; | ||
1871 | history_l[history_pos] = history_r[history_pos] = 0; | ||
1872 | history_l[(history_pos + 1) % HIST_W] = 0; | ||
1873 | history_r[(history_pos + 1) % HIST_W] = 0; | ||
1874 | hist_l = 0; | ||
1875 | hist_r = 0; | ||
1876 | } | ||
1877 | lcd_set_drawmode(DRMODE_SOLID); | ||
1878 | lcd_drawrect(0, hist_pos_y - 1, | ||
1879 | HIST_W + 2, hist_size_h + 1); | ||
1880 | lcd_drawrect(HIST_W + 6, hist_pos_y - 1, | ||
1881 | HIST_W + 2, hist_size_h + 1); | ||
1882 | lcd_set_drawmode(DRMODE_FG); | ||
1883 | #ifdef HAVE_LCD_COLOR | ||
1884 | for (i = 0; i < HIST_W; i++) | ||
1885 | { | ||
1886 | if (history_l[i]) | ||
1887 | { | ||
1888 | if (history_l[i] == hist_size_h) | ||
1889 | lcd_set_foreground(LCD_HIST_OVER); | ||
1890 | else if (history_l[i] > hist_level_marks[1]) | ||
1891 | lcd_set_foreground(LCD_HIST_HI); | ||
1892 | else | ||
1893 | lcd_set_foreground(LCD_HIST_OK); | ||
1894 | lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[i]); | ||
1895 | } | ||
1896 | if (history_r[i]) | ||
1897 | { | ||
1898 | if (history_r[i] == hist_size_h) | ||
1899 | lcd_set_foreground(LCD_HIST_OVER); | ||
1900 | else if (history_r[i] > hist_level_marks[1]) | ||
1901 | lcd_set_foreground(LCD_HIST_HI); | ||
1902 | else | ||
1903 | lcd_set_foreground(LCD_HIST_OK); | ||
1904 | lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[i]); | ||
1905 | } | ||
1906 | } | ||
1907 | #else | ||
1908 | for (i = 0; i < HIST_W; i++) | ||
1909 | { | ||
1910 | if (history_l[i]) | ||
1911 | { | ||
1912 | if (history_l[i] == hist_size_h) | ||
1913 | lcd_set_foreground(LCD_HIST_OVER); | ||
1914 | else | ||
1915 | lcd_set_foreground(LCD_HIST_OK); | ||
1916 | lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[i]); | ||
1917 | } | ||
1918 | if (history_r[i]) | ||
1919 | { | ||
1920 | if (history_r[i] == hist_size_h) | ||
1921 | lcd_set_foreground(LCD_HIST_OVER); | ||
1922 | else | ||
1923 | lcd_set_foreground(LCD_HIST_OK); | ||
1924 | lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[i]); | ||
1925 | } | ||
1926 | } | ||
1927 | #endif /* HAVE_LCD_COLOR */ | ||
1928 | lcd_set_foreground( | ||
1929 | #ifdef HAVE_LCD_COLOR | ||
1930 | global_settings.fg_color); | ||
1931 | #else | ||
1932 | LCD_DEFAULT_FG); | ||
1933 | #endif | ||
1934 | for (i = 0; i < 6; i++) | ||
1935 | lcd_hline(HIST_W + 3, HIST_W + 4, | ||
1936 | HIST_Y - hist_level_marks[i]); | ||
1937 | } | ||
1938 | #endif /* HAVE_RECORDING_HISTOGRAM */ | ||
1939 | |||
1799 | #ifdef HAVE_AGC | 1940 | #ifdef HAVE_AGC |
1800 | hist_time++; | 1941 | hist_time++; |
1801 | #endif | 1942 | #endif |
@@ -1922,7 +2063,6 @@ rec_abort: | |||
1922 | 2063 | ||
1923 | FOR_NB_SCREENS(i) | 2064 | FOR_NB_SCREENS(i) |
1924 | screens[i].setfont(FONT_UI); | 2065 | screens[i].setfont(FONT_UI); |
1925 | |||
1926 | 2066 | ||
1927 | /* if the directory was created or recording happened, make sure the | 2067 | /* if the directory was created or recording happened, make sure the |
1928 | browser is updated */ | 2068 | browser is updated */ |
diff --git a/apps/settings.h b/apps/settings.h index bba33366ae..1186f47fb0 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -469,6 +469,9 @@ struct user_settings | |||
469 | int rec_stop_gap; /* index of trig_durations */ | 469 | int rec_stop_gap; /* index of trig_durations */ |
470 | int rec_trigger_mode; /* see TRIG_MODE_XXX constants */ | 470 | int rec_trigger_mode; /* see TRIG_MODE_XXX constants */ |
471 | int rec_trigger_type; /* what to do when trigger released */ | 471 | int rec_trigger_type; /* what to do when trigger released */ |
472 | #ifdef HAVE_RECORDING_HISTOGRAM | ||
473 | int rec_histogram_interval; /* recording peakmeter histogram */ | ||
474 | #endif | ||
472 | 475 | ||
473 | #ifdef HAVE_AGC | 476 | #ifdef HAVE_AGC |
474 | int rec_agc_preset_mic; /* AGC mic preset modes: | 477 | int rec_agc_preset_mic; /* AGC mic preset modes: |
diff --git a/apps/settings_list.c b/apps/settings_list.c index ade159b85c..0a7c3c5b99 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1135,6 +1135,13 @@ const struct settings_list settings[] = { | |||
1135 | CHOICE_SETTING(F_RECSETTING, rec_trigger_type, LANG_RECORD_TRIGGER_TYPE, TRIG_TYPE_STOP, | 1135 | CHOICE_SETTING(F_RECSETTING, rec_trigger_type, LANG_RECORD_TRIGGER_TYPE, TRIG_TYPE_STOP, |
1136 | "trigger type","stop,pause,nf stp", NULL ,3, | 1136 | "trigger type","stop,pause,nf stp", NULL ,3, |
1137 | ID2P(LANG_RECORD_TRIGGER_STOP), ID2P(LANG_PAUSE), ID2P(LANG_RECORD_TRIGGER_NEWFILESTP)), | 1137 | ID2P(LANG_RECORD_TRIGGER_STOP), ID2P(LANG_PAUSE), ID2P(LANG_RECORD_TRIGGER_NEWFILESTP)), |
1138 | #ifdef HAVE_RECORDING_HISTOGRAM | ||
1139 | /* TO DO: additional restictions of following REP items? */ | ||
1140 | TABLE_SETTING(F_RECSETTING, rec_histogram_interval, LANG_RECORDING_HISTOGRAM_INTERVAL, 0, | ||
1141 | "histogram interval","0s,1s,2s,4s", | ||
1142 | UNIT_SEC, NULL, NULL, NULL, 4, 0,1,2,4), | ||
1143 | #endif /* HAVE_RECORDING_HISTOGRAM */ | ||
1144 | |||
1138 | #endif /* HAVE_RECORDING */ | 1145 | #endif /* HAVE_RECORDING */ |
1139 | 1146 | ||
1140 | #ifdef HAVE_SPDIF_POWER | 1147 | #ifdef HAVE_SPDIF_POWER |