diff --git a/openrtx/include/core/voicePrompts.h b/openrtx/include/core/voicePrompts.h index bda62ccb..7930f147 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -217,7 +217,8 @@ typedef enum vpqInit=0x01, // stop any voice prompts already in progress. vpqPlayImmediately=0x02, // call play after queue at all levels. vpqPlayImmediatelyAtMediumOrHigher =0x04, - vpqIncludeDescriptions=0x08 + vpqIncludeDescriptions=0x08, + vpqAddSeparatingSilence=0x10 } VoicePromptQueueFlags_T; typedef enum diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 5ae1c0aa..697d112a 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -39,6 +39,15 @@ static void vpPlayIfNeeded(VoicePromptQueueFlags_T flags) vpPlay(); } +static void addSilenceIfNeeded(VoicePromptQueueFlags_T flags) +{ + if ((flags & vpqAddSeparatingSilence) == 0) + return; + + vpQueuePrompt(PROMPT_SILENCE); + vpQueuePrompt(PROMPT_SILENCE); +} + static void removeUnnecessaryZerosFromVoicePrompts(char *str) { const int NUM_DECIMAL_PLACES = 1; @@ -52,6 +61,7 @@ static void removeUnnecessaryZerosFromVoicePrompts(char *str) } } } + void announceVFO() { vpInit(); @@ -181,6 +191,8 @@ VoicePromptQueueFlags_T flags) // Force on the descriptions for level 3. if (state.settings.vpLevel == vpHigh) localFlags |= vpqIncludeDescriptions; + // ensure we add silence between various fields. + localFlags |= vpqAddSeparatingSilence; // if VFO mode, announce VFO. // channelIndex will be 0 if called from VFO mode. if (channelIndex == 0) @@ -193,7 +205,8 @@ VoicePromptQueueFlags_T flags) if (channel->mode == OPMODE_FM) { announceBandwidth(channel->bandwidth, localFlags); - + addSilenceIfNeeded(localFlags); + if (channel->fm.rxToneEn || channel->fm.txToneEn) { announceCTCSS(channel->fm.rxToneEn, channel->fm.rxTone, @@ -203,18 +216,22 @@ VoicePromptQueueFlags_T flags) } else if (channel->mode == OPMODE_M17) { + addSilenceIfNeeded(localFlags); announceM17Info(channel, localFlags); } else if (channel->mode == OPMODE_DMR) { + addSilenceIfNeeded(localFlags); announceContactWithIndex(channel->dmr.contact_index, localFlags); // Force announcement of the words timeslot and colorcode to avoid ambiguity. announceTimeslot(channel->dmr.dmr_timeslot, (localFlags | vpqIncludeDescriptions)); announceColorCode(channel->dmr.rxColorCode, channel->dmr.txColorCode, (localFlags | vpqIncludeDescriptions)); } + addSilenceIfNeeded(localFlags); anouncePower(channel->power, localFlags); - + addSilenceIfNeeded(localFlags); + if (channelIndex > 0) // i.e. not called from VFO. announceBank(bank, localFlags); @@ -490,7 +507,8 @@ void announceGPSInfo(VoicePromptQueueFlags_T flags) vpQueueString("3D", vpAnnounceCommonSymbols); break; } - // lat/long + addSilenceIfNeeded(flags); + // lat/long char buffer[16] = "\0"; vpQueuePrompt(PROMPT_LATITUDE); snprintf(buffer, 16, "%8.6f", state.gps_data.latitude); @@ -503,20 +521,22 @@ void announceGPSInfo(VoicePromptQueueFlags_T flags) vpQueuePrompt(PROMPT_LONGITUDE); vpQueueString(buffer, vpAnnounceCommonSymbols); vpQueuePrompt(direction); + addSilenceIfNeeded(flags); // speed/altitude: vpQueuePrompt(PROMPT_SPEED); snprintf(buffer, 16, "%4.1fkm/h", state.gps_data.speed); vpQueueString(buffer, vpAnnounceCommonSymbols); - vpQueuePrompt(PROMPT_ALTITUDE); snprintf(buffer, 16, "%4.1fm", state.gps_data.altitude); vpQueueString(buffer, vpAnnounceCommonSymbols); - + addSilenceIfNeeded(flags); + vpQueuePrompt(PROMPT_COMPASS); snprintf(buffer, 16, "%3.1f", state.gps_data.tmg_true); vpQueueString(buffer, vpAnnounceCommonSymbols); vpQueuePrompt(PROMPT_DEGREES); - + addSilenceIfNeeded(flags); + vpQueuePrompt(PROMPT_SATELLITES); vpQueueInteger(__builtin_popcount(state.gps_data.active_sats)); @@ -541,7 +561,7 @@ options rapidly. */ VoicePromptQueueFlags_T GetQueueFlagsForVoiceLevel() { - VoicePromptQueueFlags_T flags = vpqInit; + VoicePromptQueueFlags_T flags = vpqInit | vpqAddSeparatingSilence; uint8_t vpLevel = state.settings.vpLevel; switch (vpLevel) diff --git a/openrtx/src/core/voicePrompts.c b/openrtx/src/core/voicePrompts.c index 45ef3b22..e5c56760 100644 --- a/openrtx/src/core/voicePrompts.c +++ b/openrtx/src/core/voicePrompts.c @@ -334,6 +334,9 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags) promptString++; } + if (flags & vpqAddSeparatingSilence) + vpQueuePrompt(PROMPT_SILENCE); + } void vpQueueInteger(int32_t value)