kopia lustrzana https://github.com/OpenRTX/OpenRTX
Renamed vp_clearCurrPrompt() to vp_flush(), added a vp_stop() function allowing to stop an in-progress voice prompt but without flushing the data buffer
rodzic
d81a4220d1
commit
cad026f902
|
@ -238,10 +238,15 @@ void vp_init();
|
||||||
void vp_terminate();
|
void vp_terminate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the currently in-progress prompt, to be called before building a new
|
* Stop an in-progress prompt and rewind data pointers to the beginning keeping
|
||||||
* voice prompt sequence.
|
* prompt data intact. This allows to replay the prompt.
|
||||||
*/
|
*/
|
||||||
void vp_clearCurrPrompt();
|
void vp_stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop an in-progress prompt, if present, and clear the prompt data buffer.
|
||||||
|
*/
|
||||||
|
void vp_flush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an individual prompt item to the prompt queue.
|
* Append an individual prompt item to the prompt queue.
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
static void clearCurrPromptIfNeeded(const vpQueueFlags_t flags)
|
static void clearCurrPromptIfNeeded(const vpQueueFlags_t flags)
|
||||||
{
|
{
|
||||||
if (flags & vpqInit)
|
if (flags & vpqInit)
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void playIfNeeded(const vpQueueFlags_t flags)
|
static void playIfNeeded(const vpQueueFlags_t flags)
|
||||||
|
@ -73,7 +73,7 @@ static void removeUnnecessaryZerosFromVoicePrompts(char* str)
|
||||||
|
|
||||||
void vp_announceVFO()
|
void vp_announceVFO()
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
vp_queuePrompt(PROMPT_VFO);
|
vp_queuePrompt(PROMPT_VFO);
|
||||||
vp_play();
|
vp_play();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void vp_announceChannelSummary(const channel_t* channel,
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
vpQueueFlags_t localFlags = vpqAddSeparatingSilence;
|
vpQueueFlags_t localFlags = vpqAddSeparatingSilence;
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void vp_announceInputChar(const char ch)
|
||||||
char buf[2] = "\0";
|
char buf[2] = "\0";
|
||||||
buf[0] = ch;
|
buf[0] = ch;
|
||||||
|
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
uint8_t flags = vpAnnounceCaps
|
uint8_t flags = vpAnnounceCaps
|
||||||
| vpAnnounceSpace
|
| vpAnnounceSpace
|
||||||
|
@ -301,7 +301,7 @@ void vp_announceInputReceiveOrTransmit(const bool tx, const vpQueueFlags_t flags
|
||||||
void vp_replayLastPrompt()
|
void vp_replayLastPrompt()
|
||||||
{
|
{
|
||||||
if (vp_isPlaying())
|
if (vp_isPlaying())
|
||||||
vp_terminate();
|
vp_stop();
|
||||||
else
|
else
|
||||||
vp_play();
|
vp_play();
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ void vp_announceGPSInfo()
|
||||||
if (!state.settings.gps_enabled)
|
if (!state.settings.gps_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
vpQueueFlags_t flags = vpqIncludeDescriptions
|
vpQueueFlags_t flags = vpqIncludeDescriptions
|
||||||
| vpqAddSeparatingSilence;
|
| vpqAddSeparatingSilence;
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ void vp_announceGPSInfo()
|
||||||
|
|
||||||
void vp_announceAboutScreen()
|
void vp_announceAboutScreen()
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->openRTX);
|
vp_queueStringTableEntry(¤tLanguage->openRTX);
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ void vp_announceAboutScreen()
|
||||||
|
|
||||||
void vp_announceBackupScreen()
|
void vp_announceBackupScreen()
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->flashBackup);
|
vp_queueStringTableEntry(¤tLanguage->flashBackup);
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ void vp_announceBackupScreen()
|
||||||
|
|
||||||
void vp_announceRestoreScreen()
|
void vp_announceRestoreScreen()
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->flashRestore);
|
vp_queueStringTableEntry(¤tLanguage->flashRestore);
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@ void vp_announceRestoreScreen()
|
||||||
#ifdef RTC_PRESENT
|
#ifdef RTC_PRESENT
|
||||||
void vp_announceSettingsTimeDate()
|
void vp_announceSettingsTimeDate()
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->timeAndDate);
|
vp_queueStringTableEntry(¤tLanguage->timeAndDate);
|
||||||
|
|
||||||
|
|
|
@ -305,22 +305,28 @@ void vp_terminate()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp_clearCurrPrompt()
|
void vp_stop()
|
||||||
{
|
{
|
||||||
voicePromptActive = false;
|
voicePromptActive = false;
|
||||||
vpCurrentSequence.length = 0;
|
|
||||||
vpCurrentSequence.pos = 0;
|
vpCurrentSequence.pos = 0;
|
||||||
vpCurrentSequence.c2DataIndex = 0;
|
vpCurrentSequence.c2DataIndex = 0;
|
||||||
vpCurrentSequence.c2DataLength = 0;
|
vpCurrentSequence.c2DataLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vp_flush()
|
||||||
|
{
|
||||||
|
// Stop the prompt and reset the codec data length
|
||||||
|
vp_stop();
|
||||||
|
vpCurrentSequence.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void vp_queuePrompt(const uint16_t prompt)
|
void vp_queuePrompt(const uint16_t prompt)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (voicePromptActive)
|
if (voicePromptActive)
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
if (vpCurrentSequence.length < VP_SEQUENCE_BUF_SIZE)
|
if (vpCurrentSequence.length < VP_SEQUENCE_BUF_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +341,7 @@ void vp_queueString(const char* string, vpFlags_t flags)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (voicePromptActive)
|
if (voicePromptActive)
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
if (state.settings.vpPhoneticSpell)
|
if (state.settings.vpPhoneticSpell)
|
||||||
flags |= vpAnnouncePhoneticRendering;
|
flags |= vpAnnouncePhoneticRendering;
|
||||||
|
|
|
@ -587,7 +587,7 @@ static int _ui_fsm_loadChannel(int16_t channel_index, bool *sync_rtx)
|
||||||
|
|
||||||
static void _ui_fsm_confirmVFOInput(bool *sync_rtx)
|
static void _ui_fsm_confirmVFOInput(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
// Switch to TX input
|
// Switch to TX input
|
||||||
if(ui_state.input_set == SET_RX)
|
if(ui_state.input_set == SET_RX)
|
||||||
{
|
{
|
||||||
|
@ -637,7 +637,7 @@ static void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
|
||||||
// Advance input position
|
// Advance input position
|
||||||
ui_state.input_position += 1;
|
ui_state.input_position += 1;
|
||||||
// clear any prompts in progress.
|
// clear any prompts in progress.
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
// Save pressed number to calculate frequency and show in GUI
|
// Save pressed number to calculate frequency and show in GUI
|
||||||
ui_state.input_number = input_getPressedNumber(msg);
|
ui_state.input_number = input_getPressedNumber(msg);
|
||||||
// queue the digit just pressed.
|
// queue the digit just pressed.
|
||||||
|
|
|
@ -104,7 +104,7 @@ static void announceMenuItemIfNeeded(char* name, char* value)
|
||||||
bool voicePromptWasPlaying = vp_isPlaying();
|
bool voicePromptWasPlaying = vp_isPlaying();
|
||||||
|
|
||||||
// Stop any prompt in progress and/or clear the buffer.
|
// Stop any prompt in progress and/or clear the buffer.
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
|
|
||||||
// If no value is supplied, or, no prompt is in progress, announce the name.
|
// If no value is supplied, or, no prompt is in progress, announce the name.
|
||||||
if ((voicePromptWasPlaying == false) || (value == NULL) || (*value == '\0'))
|
if ((voicePromptWasPlaying == false) || (value == NULL) || (*value == '\0'))
|
||||||
|
|
|
@ -35,7 +35,7 @@ int main()
|
||||||
vpQueueFlags_t flags = vp_getVoiceLevelQueueFlags();
|
vpQueueFlags_t flags = vp_getVoiceLevelQueueFlags();
|
||||||
|
|
||||||
vp_init();
|
vp_init();
|
||||||
vp_clearCurrPrompt();
|
vp_flush();
|
||||||
vp_queueStringTableEntry(¤tLanguage->allChannels);
|
vp_queueStringTableEntry(¤tLanguage->allChannels);
|
||||||
vp_play();
|
vp_play();
|
||||||
while(true)
|
while(true)
|
||||||
|
|
Ładowanie…
Reference in New Issue