Fixed speaking of voice prompt level when changing from the menu.

md1702
Silvano Seva 2022-08-26 16:58:43 +02:00
rodzic 7a78ece920
commit 33867ec009
5 zmienionych plików z 49 dodań i 1 usunięć

Wyświetl plik

@ -188,6 +188,11 @@ void vp_announceRestoreScreen();
void vp_announceSettingsTimeDate();
#endif
/**
* This is called to speak voice prompt level changes.
*/
void vp_announceSettingsVoiceLevel(const vpQueueFlags_t flags);
/**
*
*/

Wyświetl plik

@ -180,6 +180,9 @@ typedef enum
}
voicePrompt_t;
// The name of the voice prompt file is always encoded as the last prompt.
#define PROMPT_VOICE_NAME (NUM_VOICE_PROMPTS + (sizeof(stringsTable_t)/sizeof(char*)))
/**
* Flags controlling how vp_queueString operates.
*/

Wyświetl plik

@ -692,6 +692,31 @@ void vp_announceSettingsTimeDate()
}
#endif // RTC_PRESENT
void vp_announceSettingsVoiceLevel(const vpQueueFlags_t flags)
{
clearCurrPromptIfNeeded(flags);
switch (state.settings.vpLevel)
{
case vpNone:
vp_queueStringTableEntry(&currentLanguage->off);
break;
case vpBeep:
vp_queueStringTableEntry(&currentLanguage->beep);
break;
default:
if (flags & vpqIncludeDescriptions)
{
vp_queuePrompt(PROMPT_VOICE_NAME);
vp_queueStringTableEntry(&currentLanguage->level);
}
vp_queueInteger(state.settings.vpLevel-vpBeep);
break;
}
playIfNeeded(flags);
}
vpQueueFlags_t vp_getVoiceLevelQueueFlags()
{

Wyświetl plik

@ -742,6 +742,18 @@ static void _ui_changeVoiceLevel(int variation)
}
state.settings.vpLevel += variation;
// Force these flags to ensure the changes are spoken for levels 1 through 3.
vpQueueFlags_t flags = vpqInit
| vpqAddSeparatingSilence
| vpqPlayImmediately;
if (!vp_isPlaying())
{
flags |= vpqIncludeDescriptions;
}
vp_announceSettingsVoiceLevel(flags);
}
static void _ui_changePhoneticSpell(bool newVal)

Wyświetl plik

@ -102,8 +102,11 @@ static void announceMenuItemIfNeeded(char* name, char* value)
// e.g. when changing a value with left or right, we don't want to repeat the
// prompt if arrowing rapidly.
bool voicePromptWasPlaying = vp_isPlaying();
// Stop any prompt in progress and clear the buffer.
vp_clearCurrPrompt();
if (voicePromptWasPlaying)
vp_clearCurrPrompt();
// If no value is supplied, or, no prompt is in progress, announce the name.
if ((voicePromptWasPlaying == false) || (value == NULL) || (*value == '\0'))
vp_announceText(name, vpqDefault);