diff options
Diffstat (limited to 'apps/menus')
-rw-r--r-- | apps/menus/recording_menu.c | 91 |
1 files changed, 72 insertions, 19 deletions
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index e2be128d2d..70389045d7 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c | |||
@@ -381,17 +381,23 @@ enum trigger_menu_option | |||
381 | TRIG_OPTION_COUNT, | 381 | TRIG_OPTION_COUNT, |
382 | }; | 382 | }; |
383 | 383 | ||
384 | static char* create_thres_str(int threshold) | 384 | static char* create_thres_str(int threshold, long *voice_id) |
385 | { | 385 | { |
386 | static char retval[6]; | 386 | static char retval[6]; |
387 | if (threshold < 0) { | 387 | if (threshold < 0) { |
388 | if (threshold < -88) { | 388 | if (threshold < -88) { |
389 | snprintf (retval, sizeof retval, "%s", str(LANG_DB_INF)); | 389 | snprintf (retval, sizeof retval, "%s", str(LANG_DB_INF)); |
390 | if(voice_id) | ||
391 | *voice_id = LANG_DB_INF; | ||
390 | } else { | 392 | } else { |
391 | snprintf (retval, sizeof retval, "%ddb", threshold + 1); | 393 | snprintf (retval, sizeof retval, "%ddb", threshold + 1); |
394 | if(voice_id) | ||
395 | *voice_id = TALK_ID(threshold + 1, UNIT_DB); | ||
392 | } | 396 | } |
393 | } else { | 397 | } else { |
394 | snprintf (retval, sizeof retval, "%d%%", threshold); | 398 | snprintf (retval, sizeof retval, "%d%%", threshold); |
399 | if(voice_id) | ||
400 | *voice_id = TALK_ID(threshold, UNIT_PERCENT); | ||
395 | } | 401 | } |
396 | return retval; | 402 | return retval; |
397 | } | 403 | } |
@@ -442,11 +448,13 @@ bool rectrigger(void) | |||
442 | }; | 448 | }; |
443 | 449 | ||
444 | #define PRERECORD_TIMES_COUNT 31 | 450 | #define PRERECORD_TIMES_COUNT 31 |
445 | static const unsigned char *prerecord_times[] = { | 451 | static const struct opt_items prerecord_times[] = { |
446 | ID2P(LANG_OFF),"1s","2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", | 452 | { STR(LANG_OFF) }, |
447 | "10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", "18s", "19s", | 453 | #define T(x) { (unsigned char *)(#x "s"), TALK_ID(x, UNIT_SEC) } |
448 | "20s", "21s", "22s", "23s", "24s", "25s", "26s", "27s", "28s", "29s", | 454 | T(1), T(2), T(3), T(4), T(5), T(6), T(7), T(8), T(9), T(10), |
449 | "30s" | 455 | T(11), T(12), T(13), T(14), T(15), T(16), T(17), T(18), T(19), T(20), |
456 | T(21), T(22), T(23), T(24), T(25), T(26), T(27), T(28), T(29), T(30), | ||
457 | #undef T | ||
450 | }; | 458 | }; |
451 | 459 | ||
452 | #define TRIGGER_TYPE_COUNT 3 | 460 | #define TRIGGER_TYPE_COUNT 3 |
@@ -486,6 +494,8 @@ bool rectrigger(void) | |||
486 | int trig_ypos[NB_SCREENS]; | 494 | int trig_ypos[NB_SCREENS]; |
487 | int trig_width[NB_SCREENS]; | 495 | int trig_width[NB_SCREENS]; |
488 | 496 | ||
497 | bool say_field = true, say_value = true; | ||
498 | |||
489 | FOR_NB_SCREENS(i) | 499 | FOR_NB_SCREENS(i) |
490 | { | 500 | { |
491 | offset[i] = 0; | 501 | offset[i] = 0; |
@@ -535,23 +545,17 @@ bool rectrigger(void) | |||
535 | "%s", | 545 | "%s", |
536 | P2STR(trigger_types[global_settings.rec_trigger_type])); | 546 | P2STR(trigger_types[global_settings.rec_trigger_type])); |
537 | 547 | ||
538 | snprintf( | ||
539 | option_value[TRIGGER_TYPE], | ||
540 | sizeof option_value[TRIGGER_TYPE], | ||
541 | "%s", | ||
542 | P2STR(trigger_types[global_settings.rec_trigger_type])); | ||
543 | |||
544 | snprintf ( | 548 | snprintf ( |
545 | option_value[PRERECORD_TIME], | 549 | option_value[PRERECORD_TIME], |
546 | sizeof option_value[PRERECORD_TIME], | 550 | sizeof option_value[PRERECORD_TIME], |
547 | "%s", | 551 | "%s", |
548 | P2STR(prerecord_times[global_settings.rec_prerecord_time])); | 552 | prerecord_times[global_settings.rec_prerecord_time].string); |
549 | 553 | ||
550 | /* due to value range shift (peak_meter_define_trigger) -1 is 0db */ | 554 | /* due to value range shift (peak_meter_define_trigger) -1 is 0db */ |
551 | if (global_settings.rec_start_thres == -1) { | 555 | if (global_settings.rec_start_thres == -1) { |
552 | str = str(LANG_OFF); | 556 | str = str(LANG_OFF); |
553 | } else { | 557 | } else { |
554 | str = create_thres_str(global_settings.rec_start_thres); | 558 | str = create_thres_str(global_settings.rec_start_thres, NULL); |
555 | } | 559 | } |
556 | snprintf( | 560 | snprintf( |
557 | option_value[START_THRESHOLD], | 561 | option_value[START_THRESHOLD], |
@@ -563,13 +567,12 @@ bool rectrigger(void) | |||
563 | option_value[START_DURATION], | 567 | option_value[START_DURATION], |
564 | sizeof option_value[START_DURATION], | 568 | sizeof option_value[START_DURATION], |
565 | "%s", | 569 | "%s", |
566 | trig_durations[global_settings.rec_start_duration]); | 570 | trig_durations[global_settings.rec_start_duration].string); |
567 | |||
568 | 571 | ||
569 | if (global_settings.rec_stop_thres <= INF_DB) { | 572 | if (global_settings.rec_stop_thres <= INF_DB) { |
570 | str = str(LANG_OFF); | 573 | str = str(LANG_OFF); |
571 | } else { | 574 | } else { |
572 | str = create_thres_str(global_settings.rec_stop_thres); | 575 | str = create_thres_str(global_settings.rec_stop_thres, NULL); |
573 | } | 576 | } |
574 | snprintf( | 577 | snprintf( |
575 | option_value[STOP_THRESHOLD], | 578 | option_value[STOP_THRESHOLD], |
@@ -581,13 +584,13 @@ bool rectrigger(void) | |||
581 | option_value[STOP_POSTREC], | 584 | option_value[STOP_POSTREC], |
582 | sizeof option_value[STOP_POSTREC], | 585 | sizeof option_value[STOP_POSTREC], |
583 | "%s", | 586 | "%s", |
584 | trig_durations[global_settings.rec_stop_postrec]); | 587 | trig_durations[global_settings.rec_stop_postrec].string); |
585 | 588 | ||
586 | snprintf( | 589 | snprintf( |
587 | option_value[STOP_GAP], | 590 | option_value[STOP_GAP], |
588 | sizeof option_value[STOP_GAP], | 591 | sizeof option_value[STOP_GAP], |
589 | "%s", | 592 | "%s", |
590 | trig_durations[global_settings.rec_stop_gap]); | 593 | trig_durations[global_settings.rec_stop_gap].string); |
591 | 594 | ||
592 | FOR_NB_SCREENS(i) | 595 | FOR_NB_SCREENS(i) |
593 | { | 596 | { |
@@ -629,6 +632,52 @@ bool rectrigger(void) | |||
629 | VERTICAL); | 632 | VERTICAL); |
630 | } | 633 | } |
631 | 634 | ||
635 | bool enqueue = false; | ||
636 | if(say_field) { | ||
637 | talk_id(P2ID(option_name[selected]), enqueue); | ||
638 | enqueue = true; | ||
639 | } | ||
640 | if(say_value) { | ||
641 | long id; | ||
642 | switch(selected) { | ||
643 | case TRIGGER_MODE: | ||
644 | id = P2ID(trigger_modes[global_settings.rec_trigger_mode]); | ||
645 | break; | ||
646 | case TRIGGER_TYPE: | ||
647 | id = P2ID(trigger_types[global_settings.rec_trigger_type]); | ||
648 | break; | ||
649 | case PRERECORD_TIME: | ||
650 | id = prerecord_times[global_settings.rec_prerecord_time] | ||
651 | .voice_id; | ||
652 | break; | ||
653 | case START_THRESHOLD: | ||
654 | if (global_settings.rec_start_thres == -1) | ||
655 | id = LANG_OFF; | ||
656 | else create_thres_str(global_settings.rec_start_thres, &id); | ||
657 | break; | ||
658 | case START_DURATION: | ||
659 | id = trig_durations[global_settings.rec_start_duration] | ||
660 | .voice_id; | ||
661 | break; | ||
662 | case STOP_THRESHOLD: | ||
663 | if (global_settings.rec_stop_thres <= INF_DB) | ||
664 | id = LANG_OFF; | ||
665 | else create_thres_str(global_settings.rec_stop_thres, &id); | ||
666 | break; | ||
667 | case STOP_POSTREC: | ||
668 | id = trig_durations[global_settings.rec_stop_postrec].voice_id; | ||
669 | break; | ||
670 | case STOP_GAP: | ||
671 | id = trig_durations[global_settings.rec_stop_gap].voice_id; | ||
672 | break; | ||
673 | case TRIG_OPTION_COUNT: | ||
674 | // avoid compiler warnings | ||
675 | break; | ||
676 | }; | ||
677 | talk_id(id, enqueue); | ||
678 | } | ||
679 | say_field = say_value = false; | ||
680 | |||
632 | peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, NB_SCREENS); | 681 | peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, NB_SCREENS); |
633 | button = peak_meter_draw_get_btn(0, pm_y, 8, NB_SCREENS); | 682 | button = peak_meter_draw_get_btn(0, pm_y, 8, NB_SCREENS); |
634 | 683 | ||
@@ -661,6 +710,7 @@ bool rectrigger(void) | |||
661 | offset[i] = MIN(offset[i], (int)selected); | 710 | offset[i] = MIN(offset[i], (int)selected); |
662 | offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1); | 711 | offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1); |
663 | } | 712 | } |
713 | say_field = say_value = true; | ||
664 | break; | 714 | break; |
665 | 715 | ||
666 | case ACTION_STD_NEXT: | 716 | case ACTION_STD_NEXT: |
@@ -671,6 +721,7 @@ bool rectrigger(void) | |||
671 | offset[i] = MIN(offset[i], (int)selected); | 721 | offset[i] = MIN(offset[i], (int)selected); |
672 | offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1); | 722 | offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1); |
673 | } | 723 | } |
724 | say_field = say_value = true; | ||
674 | break; | 725 | break; |
675 | 726 | ||
676 | case ACTION_SETTINGS_INC: | 727 | case ACTION_SETTINGS_INC: |
@@ -719,6 +770,7 @@ bool rectrigger(void) | |||
719 | } | 770 | } |
720 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); | 771 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); |
721 | settings_apply_trigger(); | 772 | settings_apply_trigger(); |
773 | say_value = true; | ||
722 | break; | 774 | break; |
723 | 775 | ||
724 | case ACTION_SETTINGS_DEC: | 776 | case ACTION_SETTINGS_DEC: |
@@ -770,6 +822,7 @@ bool rectrigger(void) | |||
770 | } | 822 | } |
771 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); | 823 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); |
772 | settings_apply_trigger(); | 824 | settings_apply_trigger(); |
825 | say_value = true; | ||
773 | break; | 826 | break; |
774 | 827 | ||
775 | case ACTION_REC_F2: | 828 | case ACTION_REC_F2: |