diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/recorder/peakmeter.c | 28 | ||||
-rw-r--r-- | apps/recorder/recording.c | 4 | ||||
-rw-r--r-- | apps/settings.c | 2 | ||||
-rw-r--r-- | apps/sound_menu.c | 61 |
4 files changed, 50 insertions, 45 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 0481e25acd..8bb771e9b3 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -68,6 +68,7 @@ static unsigned short db_min = 0; | |||
68 | static unsigned short db_max = 9000; | 68 | static unsigned short db_max = 9000; |
69 | static unsigned short db_range = 9000; | 69 | static unsigned short db_range = 9000; |
70 | 70 | ||
71 | #ifdef HAVE_RECORDING | ||
71 | static unsigned short trig_strt_threshold; | 72 | static unsigned short trig_strt_threshold; |
72 | static long trig_strt_duration; | 73 | static long trig_strt_duration; |
73 | static long trig_strt_dropout; | 74 | static long trig_strt_dropout; |
@@ -81,10 +82,11 @@ static long trig_hightime; | |||
81 | /* point in time when the volume fell below the threshold*/ | 82 | /* point in time when the volume fell below the threshold*/ |
82 | static long trig_lowtime; | 83 | static long trig_lowtime; |
83 | 84 | ||
84 | /* The output value of the trigger. See TRIG_XXX constants vor valid values */ | 85 | /* The output value of the trigger. See TRIG_XXX constants for valid values */ |
85 | static int trig_status = TRIG_OFF; | 86 | static int trig_status = TRIG_OFF; |
86 | 87 | ||
87 | static void (*trigger_listener)(int) = NULL; | 88 | static void (*trigger_listener)(int) = NULL; |
89 | #endif | ||
88 | 90 | ||
89 | #if CONFIG_HWCODEC == MASNONE | 91 | #if CONFIG_HWCODEC == MASNONE |
90 | #define MAS_REG_DQPEAK_L 0 | 92 | #define MAS_REG_DQPEAK_L 0 |
@@ -176,21 +178,6 @@ static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = { | |||
176 | }; | 178 | }; |
177 | #endif | 179 | #endif |
178 | 180 | ||
179 | const char* peak_meter_dbnames[DB_SCALE_SRC_VALUES_SIZE] = { | ||
180 | "0 db", | ||
181 | "-3 db", | ||
182 | "-6 db", | ||
183 | "-9 db", | ||
184 | "-12 db", | ||
185 | "-18 db", | ||
186 | "-24 db", | ||
187 | "-30 db", | ||
188 | "-40 db", | ||
189 | "-50 db", | ||
190 | "-60 db", | ||
191 | "-inf", | ||
192 | }; | ||
193 | |||
194 | static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE; | 181 | static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE; |
195 | 182 | ||
196 | /* if db_scale_valid is false the content of | 183 | /* if db_scale_valid is false the content of |
@@ -540,6 +527,7 @@ void peak_meter_playback(bool playback) | |||
540 | #endif | 527 | #endif |
541 | } | 528 | } |
542 | 529 | ||
530 | #ifdef HAVE_RECORDING | ||
543 | static void set_trig_status(int new_state) { | 531 | static void set_trig_status(int new_state) { |
544 | if (trig_status != new_state) { | 532 | if (trig_status != new_state) { |
545 | trig_status = new_state; | 533 | trig_status = new_state; |
@@ -548,6 +536,7 @@ static void set_trig_status(int new_state) { | |||
548 | } | 536 | } |
549 | } | 537 | } |
550 | } | 538 | } |
539 | #endif | ||
551 | 540 | ||
552 | /** | 541 | /** |
553 | * Reads peak values from the MAS, and detects clips. The | 542 | * Reads peak values from the MAS, and detects clips. The |
@@ -591,6 +580,7 @@ inline void peak_meter_peek(void) | |||
591 | current_tick + clip_time_out[peak_meter_clip_hold]; | 580 | current_tick + clip_time_out[peak_meter_clip_hold]; |
592 | } | 581 | } |
593 | 582 | ||
583 | #ifdef HAVE_RECORDING | ||
594 | switch (trig_status) { | 584 | switch (trig_status) { |
595 | case TRIG_READY: | 585 | case TRIG_READY: |
596 | /* no more changes, if trigger was activated as release trigger */ | 586 | /* no more changes, if trigger was activated as release trigger */ |
@@ -705,6 +695,7 @@ inline void peak_meter_peek(void) | |||
705 | } | 695 | } |
706 | break; | 696 | break; |
707 | } | 697 | } |
698 | #endif | ||
708 | 699 | ||
709 | /* peaks are searched -> we have to find the maximum. When | 700 | /* peaks are searched -> we have to find the maximum. When |
710 | many calls of peak_meter_peek the maximum value will be | 701 | many calls of peak_meter_peek the maximum value will be |
@@ -971,6 +962,7 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
971 | lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); | 962 | lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); |
972 | } | 963 | } |
973 | 964 | ||
965 | #ifdef HAVE_RECORDING | ||
974 | if (trig_status != TRIG_OFF) { | 966 | if (trig_status != TRIG_OFF) { |
975 | int start_trigx, stop_trigx, ycenter; | 967 | int start_trigx, stop_trigx, ycenter; |
976 | 968 | ||
@@ -984,8 +976,8 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
984 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); | 976 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); |
985 | lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter); | 977 | lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter); |
986 | if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); | 978 | if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); |
987 | |||
988 | } | 979 | } |
980 | #endif | ||
989 | 981 | ||
990 | #ifdef PM_DEBUG | 982 | #ifdef PM_DEBUG |
991 | /* display a bar to show how many calls to peak_meter_peek | 983 | /* display a bar to show how many calls to peak_meter_peek |
@@ -1011,6 +1003,7 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
1011 | last_right = right; | 1003 | last_right = right; |
1012 | } | 1004 | } |
1013 | 1005 | ||
1006 | #ifdef HAVE_RECORDING | ||
1014 | /** | 1007 | /** |
1015 | * Defines the parameters of the trigger. After these parameters are defined | 1008 | * Defines the parameters of the trigger. After these parameters are defined |
1016 | * the trigger can be started either by peak_meter_attack_trigger or by | 1009 | * the trigger can be started either by peak_meter_attack_trigger or by |
@@ -1142,6 +1135,7 @@ void peak_meter_draw_trig(int xpos, int ypos) { | |||
1142 | } | 1135 | } |
1143 | 1136 | ||
1144 | } | 1137 | } |
1138 | #endif | ||
1145 | 1139 | ||
1146 | int peak_meter_draw_get_btn(int x, int y, int width, int height) | 1140 | int peak_meter_draw_get_btn(int x, int y, int width, int height) |
1147 | { | 1141 | { |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 9ef6d4a521..68859632fa 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -318,7 +318,7 @@ bool recording_screen(void) | |||
318 | }; | 318 | }; |
319 | 319 | ||
320 | cursor = 0; | 320 | cursor = 0; |
321 | #ifndef SIMULATOR | 321 | #if defined(HAVE_LED) && !defined(SIMULATOR) |
322 | ata_set_led_enabled(false); | 322 | ata_set_led_enabled(false); |
323 | #endif | 323 | #endif |
324 | mpeg_init_recording(); | 324 | mpeg_init_recording(); |
@@ -859,7 +859,7 @@ bool recording_screen(void) | |||
859 | if (have_recorded) | 859 | if (have_recorded) |
860 | reload_directory(); | 860 | reload_directory(); |
861 | 861 | ||
862 | #ifndef SIMULATOR | 862 | #if defined(HAVE_LED) && !defined(SIMULATOR) |
863 | ata_set_led_enabled(true); | 863 | ata_set_led_enabled(true); |
864 | #endif | 864 | #endif |
865 | return been_in_usb_mode; | 865 | return been_in_usb_mode; |
diff --git a/apps/settings.c b/apps/settings.c index 39bb9b4d26..56dcd0af09 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -154,10 +154,12 @@ static const char off_on_ask[] = "off,on,ask"; | |||
154 | static const char graphic_numeric[] = "graphic,numeric"; | 154 | static const char graphic_numeric[] = "graphic,numeric"; |
155 | static const char off_number_spell_hover[] = "off,number,spell,hover"; | 155 | static const char off_number_spell_hover[] = "off,number,spell,hover"; |
156 | 156 | ||
157 | #ifdef HAVE_RECORDING | ||
157 | /* keep synchronous to trig_durations and | 158 | /* keep synchronous to trig_durations and |
158 | trigger_times in settings_apply_trigger */ | 159 | trigger_times in settings_apply_trigger */ |
159 | static const char trig_durations_conf [] = | 160 | static const char trig_durations_conf [] = |
160 | "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min"; | 161 | "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min"; |
162 | #endif | ||
161 | 163 | ||
162 | /* the part of the settings which ends up in the RTC RAM, where available | 164 | /* the part of the settings which ends up in the RTC RAM, where available |
163 | (those we either need early, save frequently, or without spinup) */ | 165 | (those we either need early, save frequently, or without spinup) */ |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 48cee349bd..fe3b9202b2 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -469,9 +469,7 @@ static char* create_thres_str(int threshold) | |||
469 | } | 469 | } |
470 | return retval; | 470 | return retval; |
471 | } | 471 | } |
472 | #endif | ||
473 | 472 | ||
474 | #if !defined(SIMULATOR) && CONFIG_HWCODEC == MAS3587F | ||
475 | #define INF_DB (-89) | 473 | #define INF_DB (-89) |
476 | static void change_threshold(int *threshold, int change) | 474 | static void change_threshold(int *threshold, int change) |
477 | { | 475 | { |
@@ -499,6 +497,17 @@ static void change_threshold(int *threshold, int change) | |||
499 | } | 497 | } |
500 | } | 498 | } |
501 | 499 | ||
500 | /* Variable button definitions */ | ||
501 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
502 | #define TRIG_CANCEL BUTTON_OFF | ||
503 | #define TRIG_ACCEPT BUTTON_PLAY | ||
504 | #define TRIG_RESET_SIM BUTTON_F2 | ||
505 | |||
506 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
507 | #define TRIG_CANCEL BUTTON_OFF | ||
508 | #define TRIG_ACCEPT BUTTON_MENU | ||
509 | #endif | ||
510 | |||
502 | /** | 511 | /** |
503 | * Displays a menu for editing the trigger settings. | 512 | * Displays a menu for editing the trigger settings. |
504 | */ | 513 | */ |
@@ -510,22 +519,29 @@ bool rectrigger(void) | |||
510 | int old_x_margin, old_y_margin; | 519 | int old_x_margin, old_y_margin; |
511 | 520 | ||
512 | #define TRIGGER_MODE_COUNT 3 | 521 | #define TRIGGER_MODE_COUNT 3 |
513 | char *trigger_modes[] = | 522 | static const unsigned char *trigger_modes[] = { |
514 | { | 523 | ID2P(LANG_OFF), |
515 | str(LANG_OFF), | 524 | ID2P(LANG_RECORD_TRIG_NOREARM), |
516 | str(LANG_RECORD_TRIG_NOREARM), | 525 | ID2P(LANG_RECORD_TRIG_REARM) |
517 | str(LANG_RECORD_TRIG_REARM) | ||
518 | }; | 526 | }; |
519 | 527 | ||
520 | #define PRERECORD_TIMES_COUNT 31 | 528 | #define PRERECORD_TIMES_COUNT 31 |
521 | char *prerecord_times[] = { | 529 | static const unsigned char *prerecord_times[] = { |
522 | str(LANG_OFF),"1s","2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", | 530 | ID2P(LANG_OFF),"1s","2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", |
523 | "10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", "18s", "19s", | 531 | "10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", "18s", "19s", |
524 | "20s", "21s", "22s", "23s", "24s", "25s", "26s", "27s", "28s", "29s", | 532 | "20s", "21s", "22s", "23s", "24s", "25s", "26s", "27s", "28s", "29s", |
525 | "30s" | 533 | "30s" |
526 | }; | 534 | }; |
527 | 535 | ||
528 | char *option_name[TRIG_OPTION_COUNT]; | 536 | static const unsigned char *option_name[] = { |
537 | [TRIGGER_MODE] = ID2P(LANG_RECORD_TRIGGER_MODE), | ||
538 | [PRERECORD_TIME] = ID2P(LANG_RECORD_PRERECORD_TIME), | ||
539 | [START_THRESHOLD] = ID2P(LANG_RECORD_START_THRESHOLD), | ||
540 | [START_DURATION] = ID2P(LANG_RECORD_MIN_DURATION), | ||
541 | [STOP_THRESHOLD] = ID2P(LANG_RECORD_STOP_THRESHOLD), | ||
542 | [STOP_POSTREC] = ID2P(LANG_RECORD_STOP_POSTREC), | ||
543 | [STOP_GAP] = ID2P(LANG_RECORD_STOP_GAP) | ||
544 | }; | ||
529 | 545 | ||
530 | int old_start_thres = global_settings.rec_start_thres; | 546 | int old_start_thres = global_settings.rec_start_thres; |
531 | int old_start_duration = global_settings.rec_start_duration; | 547 | int old_start_duration = global_settings.rec_start_duration; |
@@ -539,15 +555,6 @@ bool rectrigger(void) | |||
539 | int option_lines; | 555 | int option_lines; |
540 | int w, h; | 556 | int w, h; |
541 | 557 | ||
542 | option_name[TRIGGER_MODE] = str(LANG_RECORD_TRIGGER_MODE); | ||
543 | option_name[PRERECORD_TIME] = str(LANG_RECORD_PRERECORD_TIME); | ||
544 | option_name[START_THRESHOLD] = str(LANG_RECORD_START_THRESHOLD); | ||
545 | option_name[START_DURATION] = str(LANG_RECORD_MIN_DURATION); | ||
546 | option_name[STOP_THRESHOLD] = str(LANG_RECORD_STOP_THRESHOLD); | ||
547 | option_name[STOP_POSTREC] = str(LANG_RECORD_STOP_POSTREC); | ||
548 | option_name[STOP_GAP] = str(LANG_RECORD_STOP_GAP); | ||
549 | |||
550 | |||
551 | /* restart trigger with new values */ | 558 | /* restart trigger with new values */ |
552 | settings_apply_trigger(); | 559 | settings_apply_trigger(); |
553 | peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF); | 560 | peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF); |
@@ -569,20 +576,20 @@ bool rectrigger(void) | |||
569 | while (!exit_request) { | 576 | while (!exit_request) { |
570 | int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; | 577 | int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; |
571 | int button, i; | 578 | int button, i; |
572 | char *str; | 579 | const char *str; |
573 | char option_value[TRIG_OPTION_COUNT][7]; | 580 | char option_value[TRIG_OPTION_COUNT][7]; |
574 | 581 | ||
575 | snprintf( | 582 | snprintf( |
576 | option_value[TRIGGER_MODE], | 583 | option_value[TRIGGER_MODE], |
577 | sizeof option_value[TRIGGER_MODE], | 584 | sizeof option_value[TRIGGER_MODE], |
578 | "%s", | 585 | "%s", |
579 | trigger_modes[global_settings.rec_trigger_mode]); | 586 | P2STR(trigger_modes[global_settings.rec_trigger_mode])); |
580 | 587 | ||
581 | snprintf ( | 588 | snprintf ( |
582 | option_value[PRERECORD_TIME], | 589 | option_value[PRERECORD_TIME], |
583 | sizeof option_value[PRERECORD_TIME], | 590 | sizeof option_value[PRERECORD_TIME], |
584 | "%s", | 591 | "%s", |
585 | prerecord_times[global_settings.rec_prerecord_time]); | 592 | P2STR(prerecord_times[global_settings.rec_prerecord_time])); |
586 | 593 | ||
587 | /* due to value range shift (peak_meter_define_trigger) -1 is 0db */ | 594 | /* due to value range shift (peak_meter_define_trigger) -1 is 0db */ |
588 | if (global_settings.rec_start_thres == -1) { | 595 | if (global_settings.rec_start_thres == -1) { |
@@ -635,7 +642,7 @@ bool rectrigger(void) | |||
635 | for (i = 0; i < option_lines; i++) { | 642 | for (i = 0; i < option_lines; i++) { |
636 | int x, y; | 643 | int x, y; |
637 | 644 | ||
638 | str = option_name[i + offset]; | 645 | str = P2STR(option_name[i + offset]); |
639 | lcd_putsxy(5, stat_height + i * h, str); | 646 | lcd_putsxy(5, stat_height + i * h, str); |
640 | 647 | ||
641 | str = option_value[i + offset]; | 648 | str = option_value[i + offset]; |
@@ -659,7 +666,7 @@ bool rectrigger(void) | |||
659 | lcd_update(); | 666 | lcd_update(); |
660 | 667 | ||
661 | switch (button) { | 668 | switch (button) { |
662 | case BUTTON_OFF: | 669 | case TRIG_CANCEL: |
663 | splash(50, true, str(LANG_RESET_DONE_CANCEL)); | 670 | splash(50, true, str(LANG_RESET_DONE_CANCEL)); |
664 | global_settings.rec_start_thres = old_start_thres; | 671 | global_settings.rec_start_thres = old_start_thres; |
665 | global_settings.rec_start_duration = old_start_duration; | 672 | global_settings.rec_start_duration = old_start_duration; |
@@ -671,7 +678,7 @@ bool rectrigger(void) | |||
671 | exit_request = true; | 678 | exit_request = true; |
672 | break; | 679 | break; |
673 | 680 | ||
674 | case BUTTON_PLAY: | 681 | case TRIG_ACCEPT: |
675 | exit_request = true; | 682 | exit_request = true; |
676 | break; | 683 | break; |
677 | 684 | ||
@@ -785,9 +792,11 @@ bool rectrigger(void) | |||
785 | } | 792 | } |
786 | break; | 793 | break; |
787 | 794 | ||
788 | case BUTTON_F2: | 795 | #ifdef TRIG_RESET_SIM |
796 | case TRIG_RESET_SIM: | ||
789 | peak_meter_trigger(true); | 797 | peak_meter_trigger(true); |
790 | break; | 798 | break; |
799 | #endif | ||
791 | 800 | ||
792 | case SYS_USB_CONNECTED: | 801 | case SYS_USB_CONNECTED: |
793 | if(default_event_handler(button) == SYS_USB_CONNECTED) { | 802 | if(default_event_handler(button) == SYS_USB_CONNECTED) { |