Index: apps/action.h =================================================================== --- apps/action.h (Revision 21894) +++ apps/action.h (Arbeitskopie) @@ -209,6 +209,7 @@ ACTION_PS_NUDGE_LEFTOFF, ACTION_PS_NUDGE_RIGHTOFF, ACTION_PS_TOGGLE_MODE, + ACTION_PS_TOGGLE_MODE_BACK, ACTION_PS_RESET, ACTION_PS_EXIT, /* _STD_* isnt going to work here */ ACTION_PS_SLOWER, Index: apps/gui/pitchscreen.c =================================================================== --- apps/gui/pitchscreen.c (Revision 21894) +++ apps/gui/pitchscreen.c (Arbeitskopie) @@ -575,6 +575,26 @@ return new_semitone; } +static void toggle_pitch_mode(bool forth, int32_t *pitch, int32_t *speed) +{ + global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone; +#if CONFIG_CODEC == SWCODEC + + if (dsp_timestretch_available() && (global_settings.pitch_mode_semitone ^ forth)) + { + global_settings.pitch_mode_timestretch = !global_settings.pitch_mode_timestretch; + if(!global_settings.pitch_mode_timestretch) + { + /* no longer in timestretch mode. Reset speed */ + *speed = *pitch; + dsp_set_timestretch(PITCH_SPEED_100); + } + } + settings_save(); +#endif +} + + /* returns: 0 on exit @@ -803,21 +823,11 @@ break; case ACTION_PS_TOGGLE_MODE: - global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone; -#if CONFIG_CODEC == SWCODEC + toggle_pitch_mode(true, &pitch, &speed); + break; - if (dsp_timestretch_available() && !global_settings.pitch_mode_semitone) - { - global_settings.pitch_mode_timestretch = !global_settings.pitch_mode_timestretch; - if(!global_settings.pitch_mode_timestretch) - { - /* no longer in timestretch mode. Reset speed */ - speed = pitch; - dsp_set_timestretch(PITCH_SPEED_100); - } - } - settings_save(); -#endif + case ACTION_PS_TOGGLE_MODE_BACK: + toggle_pitch_mode(false, &pitch, &speed); break; case ACTION_PS_EXIT: Index: apps/keymaps/keymap-h1x0_h3x0.c =================================================================== --- apps/keymaps/keymap-h1x0_h3x0.c (Revision 21894) +++ apps/keymaps/keymap-h1x0_h3x0.c (Arbeitskopie) @@ -226,7 +226,8 @@ { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, - { ACTION_PS_TOGGLE_MODE, BUTTON_MODE, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_MODE|BUTTON_REL, BUTTON_MODE }, + { ACTION_PS_TOGGLE_MODE_BACK,BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE }, { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, { ACTION_PS_EXIT, BUTTON_ON, BUTTON_NONE }, { ACTION_PS_EXIT, BUTTON_OFF, BUTTON_NONE },