diff options
-rw-r--r-- | apps/gui/pitchscreen.c | 75 | ||||
-rw-r--r-- | apps/lang/english.lang | 53 |
2 files changed, 127 insertions, 1 deletions
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 200033bbf9..443a967178 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "lang.h" | 31 | #include "lang.h" |
32 | #include "icons.h" | 32 | #include "icons.h" |
33 | #include "screens.h" | 33 | #include "screens.h" |
34 | #include "talk.h" | ||
34 | #include "viewport.h" | 35 | #include "viewport.h" |
35 | #include "font.h" | 36 | #include "font.h" |
36 | #include "system.h" | 37 | #include "system.h" |
@@ -164,6 +165,18 @@ static bool at_limit = false; | |||
164 | * | 165 | * |
165 | */ | 166 | */ |
166 | 167 | ||
168 | static void speak_pitch_mode(bool enqueue) | ||
169 | { | ||
170 | bool timestretch_mode = global_settings.pitch_mode_timestretch && dsp_timestretch_available(); | ||
171 | if (timestretch_mode) | ||
172 | talk_id(VOICE_PITCH_TIMESTRETCH_MODE, enqueue); | ||
173 | if (global_settings.pitch_mode_semitone) | ||
174 | talk_id(VOICE_PITCH_SEMITONE_MODE, timestretch_mode ? true : enqueue); | ||
175 | else | ||
176 | talk_id(VOICE_PITCH_ABSOLUTE_MODE, timestretch_mode ? true : enqueue); | ||
177 | return; | ||
178 | } | ||
179 | |||
167 | /* | 180 | /* |
168 | * Fixes the viewports so they represent the 3 rows, and adds a little margin | 181 | * Fixes the viewports so they represent the 3 rows, and adds a little margin |
169 | * on all sides for the icons (which are drawn outside of the grid | 182 | * on all sides for the icons (which are drawn outside of the grid |
@@ -739,6 +752,7 @@ int gui_syncpitchscreen_run(void) | |||
739 | int32_t new_pitch; | 752 | int32_t new_pitch; |
740 | int32_t pitch_delta; | 753 | int32_t pitch_delta; |
741 | bool nudged = false; | 754 | bool nudged = false; |
755 | int i, updated = 4, decimals = 0; | ||
742 | bool exit = false; | 756 | bool exit = false; |
743 | /* should maybe be passed per parameter later, not needed for now */ | 757 | /* should maybe be passed per parameter later, not needed for now */ |
744 | struct viewport parent[NB_SCREENS]; | 758 | struct viewport parent[NB_SCREENS]; |
@@ -769,6 +783,10 @@ int gui_syncpitchscreen_run(void) | |||
769 | } | 783 | } |
770 | #endif | 784 | #endif |
771 | 785 | ||
786 | /* Count decimals for speaking */ | ||
787 | for (i = PITCH_SPEED_PRECISION; i >= 10; i /= 10) | ||
788 | decimals++; | ||
789 | |||
772 | /* set the semitone index based on the current pitch */ | 790 | /* set the semitone index based on the current pitch */ |
773 | semitone = get_semitone_from_pitch(pitch); | 791 | semitone = get_semitone_from_pitch(pitch); |
774 | 792 | ||
@@ -801,6 +819,49 @@ int gui_syncpitchscreen_run(void) | |||
801 | #if CONFIG_CODEC == SWCODEC | 819 | #if CONFIG_CODEC == SWCODEC |
802 | new_speed = 0; | 820 | new_speed = 0; |
803 | #endif | 821 | #endif |
822 | |||
823 | if (global_settings.talk_menu && updated) | ||
824 | { | ||
825 | talk_shutup(); | ||
826 | switch (updated) | ||
827 | { | ||
828 | case 1: | ||
829 | if (global_settings.pitch_mode_semitone) | ||
830 | talk_value_decimal(semitone, UNIT_SIGNED, decimals, false); | ||
831 | else | ||
832 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, false); | ||
833 | break; | ||
834 | #if CONFIG_CODEC == SWCODEC | ||
835 | case 2: | ||
836 | talk_value_decimal(speed, UNIT_PERCENT, decimals, false); | ||
837 | break; | ||
838 | #endif | ||
839 | case 3: | ||
840 | speak_pitch_mode(false); | ||
841 | break; | ||
842 | case 4: | ||
843 | #if CONFIG_CODEC == SWCODEC | ||
844 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) | ||
845 | talk_id(LANG_PITCH, false); | ||
846 | else | ||
847 | #endif | ||
848 | talk_id(LANG_PLAYBACK_RATE, false); | ||
849 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, true); | ||
850 | #if CONFIG_CODEC == SWCODEC | ||
851 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) | ||
852 | { | ||
853 | talk_id(LANG_SPEED, true); | ||
854 | talk_value_decimal(speed, UNIT_PERCENT, decimals, true); | ||
855 | } | ||
856 | #endif | ||
857 | speak_pitch_mode(true); | ||
858 | break; | ||
859 | default: | ||
860 | break; | ||
861 | } | ||
862 | } | ||
863 | updated = 0; | ||
864 | |||
804 | button = get_action(CONTEXT_PITCHSCREEN, HZ); | 865 | button = get_action(CONTEXT_PITCHSCREEN, HZ); |
805 | 866 | ||
806 | #ifdef HAVE_TOUCHSCREEN | 867 | #ifdef HAVE_TOUCHSCREEN |
@@ -817,6 +878,7 @@ int gui_syncpitchscreen_run(void) | |||
817 | pitch_delta = SEMITONE_SMALL_DELTA; | 878 | pitch_delta = SEMITONE_SMALL_DELTA; |
818 | else | 879 | else |
819 | pitch_delta = PITCH_SMALL_DELTA; | 880 | pitch_delta = PITCH_SMALL_DELTA; |
881 | updated = 1; | ||
820 | break; | 882 | break; |
821 | 883 | ||
822 | case ACTION_PS_INC_BIG: | 884 | case ACTION_PS_INC_BIG: |
@@ -824,6 +886,7 @@ int gui_syncpitchscreen_run(void) | |||
824 | pitch_delta = SEMITONE_BIG_DELTA; | 886 | pitch_delta = SEMITONE_BIG_DELTA; |
825 | else | 887 | else |
826 | pitch_delta = PITCH_BIG_DELTA; | 888 | pitch_delta = PITCH_BIG_DELTA; |
889 | updated = 1; | ||
827 | break; | 890 | break; |
828 | 891 | ||
829 | case ACTION_PS_DEC_SMALL: | 892 | case ACTION_PS_DEC_SMALL: |
@@ -831,6 +894,7 @@ int gui_syncpitchscreen_run(void) | |||
831 | pitch_delta = -SEMITONE_SMALL_DELTA; | 894 | pitch_delta = -SEMITONE_SMALL_DELTA; |
832 | else | 895 | else |
833 | pitch_delta = -PITCH_SMALL_DELTA; | 896 | pitch_delta = -PITCH_SMALL_DELTA; |
897 | updated = 1; | ||
834 | break; | 898 | break; |
835 | 899 | ||
836 | case ACTION_PS_DEC_BIG: | 900 | case ACTION_PS_DEC_BIG: |
@@ -838,6 +902,7 @@ int gui_syncpitchscreen_run(void) | |||
838 | pitch_delta = -SEMITONE_BIG_DELTA; | 902 | pitch_delta = -SEMITONE_BIG_DELTA; |
839 | else | 903 | else |
840 | pitch_delta = -PITCH_BIG_DELTA; | 904 | pitch_delta = -PITCH_BIG_DELTA; |
905 | updated = 1; | ||
841 | break; | 906 | break; |
842 | 907 | ||
843 | case ACTION_PS_NUDGE_RIGHT: | 908 | case ACTION_PS_NUDGE_RIGHT: |
@@ -856,6 +921,7 @@ int gui_syncpitchscreen_run(void) | |||
856 | #if CONFIG_CODEC == SWCODEC | 921 | #if CONFIG_CODEC == SWCODEC |
857 | speed = pitch; | 922 | speed = pitch; |
858 | #endif | 923 | #endif |
924 | updated = nudged ? 1 : 0; | ||
859 | break; | 925 | break; |
860 | #if CONFIG_CODEC == SWCODEC | 926 | #if CONFIG_CODEC == SWCODEC |
861 | } | 927 | } |
@@ -863,6 +929,7 @@ int gui_syncpitchscreen_run(void) | |||
863 | { | 929 | { |
864 | new_speed = speed + SPEED_SMALL_DELTA; | 930 | new_speed = speed + SPEED_SMALL_DELTA; |
865 | at_limit = false; | 931 | at_limit = false; |
932 | updated = 2; | ||
866 | } | 933 | } |
867 | break; | 934 | break; |
868 | 935 | ||
@@ -874,6 +941,7 @@ int gui_syncpitchscreen_run(void) | |||
874 | if(new_speed % PITCH_SPEED_PRECISION != 0) | 941 | if(new_speed % PITCH_SPEED_PRECISION != 0) |
875 | new_speed -= new_speed % PITCH_SPEED_PRECISION; | 942 | new_speed -= new_speed % PITCH_SPEED_PRECISION; |
876 | at_limit = false; | 943 | at_limit = false; |
944 | updated = 2; | ||
877 | } | 945 | } |
878 | break; | 946 | break; |
879 | #endif | 947 | #endif |
@@ -891,6 +959,7 @@ int gui_syncpitchscreen_run(void) | |||
891 | #endif | 959 | #endif |
892 | semitone = get_semitone_from_pitch(pitch); | 960 | semitone = get_semitone_from_pitch(pitch); |
893 | nudged = false; | 961 | nudged = false; |
962 | updated = 1; | ||
894 | } | 963 | } |
895 | break; | 964 | break; |
896 | 965 | ||
@@ -910,6 +979,7 @@ int gui_syncpitchscreen_run(void) | |||
910 | #if CONFIG_CODEC == SWCODEC | 979 | #if CONFIG_CODEC == SWCODEC |
911 | speed = pitch; | 980 | speed = pitch; |
912 | #endif | 981 | #endif |
982 | updated = nudged ? 1 : 0; | ||
913 | break; | 983 | break; |
914 | #if CONFIG_CODEC == SWCODEC | 984 | #if CONFIG_CODEC == SWCODEC |
915 | } | 985 | } |
@@ -917,6 +987,7 @@ int gui_syncpitchscreen_run(void) | |||
917 | { | 987 | { |
918 | new_speed = speed - SPEED_SMALL_DELTA; | 988 | new_speed = speed - SPEED_SMALL_DELTA; |
919 | at_limit = false; | 989 | at_limit = false; |
990 | updated = 2; | ||
920 | } | 991 | } |
921 | break; | 992 | break; |
922 | 993 | ||
@@ -928,6 +999,7 @@ int gui_syncpitchscreen_run(void) | |||
928 | if(new_speed % PITCH_SPEED_PRECISION != 0) | 999 | if(new_speed % PITCH_SPEED_PRECISION != 0) |
929 | new_speed += PITCH_SPEED_PRECISION - speed % PITCH_SPEED_PRECISION; | 1000 | new_speed += PITCH_SPEED_PRECISION - speed % PITCH_SPEED_PRECISION; |
930 | at_limit = false; | 1001 | at_limit = false; |
1002 | updated = 2; | ||
931 | } | 1003 | } |
932 | break; | 1004 | break; |
933 | #endif | 1005 | #endif |
@@ -945,6 +1017,7 @@ int gui_syncpitchscreen_run(void) | |||
945 | #endif | 1017 | #endif |
946 | semitone = get_semitone_from_pitch(pitch); | 1018 | semitone = get_semitone_from_pitch(pitch); |
947 | nudged = false; | 1019 | nudged = false; |
1020 | updated = 1; | ||
948 | } | 1021 | } |
949 | break; | 1022 | break; |
950 | 1023 | ||
@@ -960,6 +1033,7 @@ int gui_syncpitchscreen_run(void) | |||
960 | } | 1033 | } |
961 | #endif | 1034 | #endif |
962 | semitone = get_semitone_from_pitch(pitch); | 1035 | semitone = get_semitone_from_pitch(pitch); |
1036 | updated = 4; | ||
963 | break; | 1037 | break; |
964 | 1038 | ||
965 | case ACTION_PS_TOGGLE_MODE: | 1039 | case ACTION_PS_TOGGLE_MODE: |
@@ -978,6 +1052,7 @@ int gui_syncpitchscreen_run(void) | |||
978 | } | 1052 | } |
979 | settings_save(); | 1053 | settings_save(); |
980 | #endif | 1054 | #endif |
1055 | updated = 3; | ||
981 | break; | 1056 | break; |
982 | 1057 | ||
983 | case ACTION_PS_EXIT: | 1058 | case ACTION_PS_EXIT: |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 207bad6873..265fcd6844 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -11361,7 +11361,7 @@ | |||
11361 | </dest> | 11361 | </dest> |
11362 | <voice> | 11362 | <voice> |
11363 | *: none | 11363 | *: none |
11364 | swcodec: "Timestretch" | 11364 | swcodec: "Time stretch" |
11365 | </voice> | 11365 | </voice> |
11366 | </phrase> | 11366 | </phrase> |
11367 | <phrase> | 11367 | <phrase> |
@@ -14000,3 +14000,54 @@ | |||
14000 | charging: "Delay Before Resume" | 14000 | charging: "Delay Before Resume" |
14001 | </voice> | 14001 | </voice> |
14002 | </phrase> | 14002 | </phrase> |
14003 | <phrase> | ||
14004 | id: VOICE_PITCH_ABSOLUTE_MODE | ||
14005 | desc: spoken only | ||
14006 | user: core | ||
14007 | <source> | ||
14008 | *: none | ||
14009 | pitchscreen: "" | ||
14010 | </source> | ||
14011 | <dest> | ||
14012 | *: none | ||
14013 | pitchscreen: "" | ||
14014 | </dest> | ||
14015 | <voice> | ||
14016 | *: none | ||
14017 | pitchscreen: "Absolute mode" | ||
14018 | </voice> | ||
14019 | </phrase> | ||
14020 | <phrase> | ||
14021 | id: VOICE_PITCH_SEMITONE_MODE | ||
14022 | desc: spoken only | ||
14023 | user: core | ||
14024 | <source> | ||
14025 | *: none | ||
14026 | pitchscreen: "" | ||
14027 | </source> | ||
14028 | <dest> | ||
14029 | *: none | ||
14030 | pitchscreen: "" | ||
14031 | </dest> | ||
14032 | <voice> | ||
14033 | *: none | ||
14034 | pitchscreen: "Semitone mode" | ||
14035 | </voice> | ||
14036 | </phrase> | ||
14037 | <phrase> | ||
14038 | id: VOICE_PITCH_TIMESTRETCH_MODE | ||
14039 | desc: spoken only | ||
14040 | user: core | ||
14041 | <source> | ||
14042 | *: none | ||
14043 | pitchscreen: "" | ||
14044 | </source> | ||
14045 | <dest> | ||
14046 | *: none | ||
14047 | pitchscreen: "" | ||
14048 | </dest> | ||
14049 | <voice> | ||
14050 | *: none | ||
14051 | pitchscreen: "Time stretch" | ||
14052 | </voice> | ||
14053 | </phrase> | ||