Apply clang-format
This commit is contained in:
parent
29de1d36d4
commit
1f71789a9d
|
|
@ -21,9 +21,9 @@
|
||||||
#ifndef VOICE_PROMPT_UTILS_H_INCLUDED
|
#ifndef VOICE_PROMPT_UTILS_H_INCLUDED
|
||||||
#define VOICE_PROMPT_UTILS_H_INCLUDED
|
#define VOICE_PROMPT_UTILS_H_INCLUDED
|
||||||
|
|
||||||
#include "voicePrompts.h"
|
|
||||||
#include "ui/UIStrings.h"
|
|
||||||
#include "cps.h"
|
#include "cps.h"
|
||||||
|
#include "ui/UIStrings.h"
|
||||||
|
#include "voicePrompts.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Please Note!
|
Please Note!
|
||||||
|
|
@ -38,12 +38,14 @@ should be used to ensure that the message interupts the current prompt and
|
||||||
plays immediately.
|
plays immediately.
|
||||||
*/
|
*/
|
||||||
void announceVFO();
|
void announceVFO();
|
||||||
void announceChannelName(channel_t* channel, uint16_t channelIndex, VoicePromptQueueFlags_T flags);
|
void announceChannelName(channel_t* channel, uint16_t channelIndex,
|
||||||
|
VoicePromptQueueFlags_T flags);
|
||||||
void vpQueueFrequency(freq_t freq);
|
void vpQueueFrequency(freq_t freq);
|
||||||
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags);
|
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags);
|
||||||
void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags);
|
void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags);
|
||||||
void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags);
|
void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags);
|
||||||
void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t bank);
|
void announceChannelSummary(channel_t* channel, uint16_t channelIndex,
|
||||||
|
uint16_t bank);
|
||||||
void AnnounceInputChar(char ch);
|
void AnnounceInputChar(char ch);
|
||||||
void announceInputReceiveOrTransmit(bool tx, VoicePromptQueueFlags_T flags);
|
void announceInputReceiveOrTransmit(bool tx, VoicePromptQueueFlags_T flags);
|
||||||
void ReplayLastPrompt();
|
void ReplayLastPrompt();
|
||||||
|
|
@ -55,14 +57,16 @@ passed in and if so, queues it, but if not, just spells the text
|
||||||
character by character.
|
character by character.
|
||||||
*/
|
*/
|
||||||
void announceText(char* text, VoicePromptQueueFlags_T flags);
|
void announceText(char* text, VoicePromptQueueFlags_T flags);
|
||||||
void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8_t txTone, VoicePromptQueueFlags_T flags);
|
void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled,
|
||||||
|
uint8_t txTone, VoicePromptQueueFlags_T flags);
|
||||||
void anouncePower(float power, VoicePromptQueueFlags_T flags);
|
void anouncePower(float power, VoicePromptQueueFlags_T flags);
|
||||||
void announceBrightness(uint8_t brightness, VoicePromptQueueFlags_T flags);
|
void announceBrightness(uint8_t brightness, VoicePromptQueueFlags_T flags);
|
||||||
void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags);
|
void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags);
|
||||||
void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags);
|
void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags);
|
||||||
void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags);
|
void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags);
|
||||||
void announceTimeslot(uint8_t timeslot, VoicePromptQueueFlags_T flags);
|
void announceTimeslot(uint8_t timeslot, VoicePromptQueueFlags_T flags);
|
||||||
void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode, VoicePromptQueueFlags_T flags);
|
void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode,
|
||||||
|
VoicePromptQueueFlags_T flags);
|
||||||
void announceBank(uint16_t bank, VoicePromptQueueFlags_T flags);
|
void announceBank(uint16_t bank, VoicePromptQueueFlags_T flags);
|
||||||
void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags);
|
void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags);
|
||||||
#ifdef GPS_PRESENT
|
#ifdef GPS_PRESENT
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,8 @@ PROMPT_ALTITUDE, // altitude
|
||||||
PROMPT_SATELLITES, // satellites
|
PROMPT_SATELLITES, // satellites
|
||||||
PROMPT_COMPASS, // compass
|
PROMPT_COMPASS, // compass
|
||||||
PROMPT_DEGREES, // degrees
|
PROMPT_DEGREES, // degrees
|
||||||
PROMPT_VP_UNAVAILABLE, // Voice prompts will be unavailable during this operation.
|
PROMPT_VP_UNAVAILABLE, // Voice prompts will be unavailable during this
|
||||||
|
// operation.
|
||||||
PROMPT_CHARACTER, // character
|
PROMPT_CHARACTER, // character
|
||||||
PROMPT_SPACE, // space
|
PROMPT_SPACE, // space
|
||||||
PROMPT_PERCENT, // Percent
|
PROMPT_PERCENT, // Percent
|
||||||
|
|
@ -181,7 +182,8 @@ NUM_VOICE_PROMPTS,
|
||||||
|
|
||||||
// PROMPT_VOICE_NAME is always the very last prompt after the indexed prompts
|
// PROMPT_VOICE_NAME is always the very last prompt after the indexed prompts
|
||||||
// from the strings table.
|
// from the strings table.
|
||||||
#define PROMPT_VOICE_NAME (NUM_VOICE_PROMPTS + (sizeof(stringsTable_t)/sizeof(char*)))
|
#define PROMPT_VOICE_NAME \
|
||||||
|
(NUM_VOICE_PROMPTS + (sizeof(stringsTable_t) / sizeof(char*)))
|
||||||
/*
|
/*
|
||||||
These flags govern how vpQueueString operates.
|
These flags govern how vpQueueString operates.
|
||||||
For example, when editing, it is desireable to hear spaces, capitals and
|
For example, when editing, it is desireable to hear spaces, capitals and
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@
|
||||||
#ifndef EnglishStrings_h_included
|
#ifndef EnglishStrings_h_included
|
||||||
#define EnglishStrings_h_included
|
#define EnglishStrings_h_included
|
||||||
#include "ui/UIStrings.h"
|
#include "ui/UIStrings.h"
|
||||||
const stringsTable_t englishStrings =
|
|
||||||
{
|
const stringsTable_t englishStrings = {
|
||||||
.languageName = "English",
|
.languageName = "English",
|
||||||
.off = "OFF",
|
.off = "OFF",
|
||||||
.on = "ON",
|
.on = "ON",
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
This string table's order must not be altered as voice prompts will be indexed in the same order as these strings.
|
This string table's order must not be altered as voice prompts will be indexed
|
||||||
Also, menus may be printed using string table offsets.
|
in the same order as these strings. Also, menus may be printed using string
|
||||||
|
table offsets.
|
||||||
*/
|
*/
|
||||||
#ifndef UIStrings_h_included
|
#ifndef UIStrings_h_included
|
||||||
#define UIStrings_h_included
|
#define UIStrings_h_included
|
||||||
|
|
|
||||||
|
|
@ -16,33 +16,38 @@
|
||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
// This file contains functions for announcing radio functions using the building blocks in voicePrompts.h/c.
|
|
||||||
|
/**
|
||||||
|
* This file contains functions for announcing radio functions using the
|
||||||
|
* building blocks in voicePrompts.h/c.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/voicePromptUtils.h"
|
||||||
|
|
||||||
|
#include <state.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <state.h>
|
|
||||||
#include "interfaces/cps_io.h"
|
#include "interfaces/cps_io.h"
|
||||||
#include "core/voicePromptUtils.h"
|
|
||||||
|
|
||||||
static void vpInitIfNeeded(VoicePromptQueueFlags_T flags)
|
static void vpInitIfNeeded(VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if (flags & vpqInit)
|
if (flags & vpqInit) vpInit();
|
||||||
vpInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vpPlayIfNeeded(VoicePromptQueueFlags_T flags)
|
static void vpPlayIfNeeded(VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
uint8_t vpLevel = state.settings.vpLevel;
|
uint8_t vpLevel = state.settings.vpLevel;
|
||||||
|
|
||||||
if ((flags & vpqPlayImmediately)
|
if ((flags & vpqPlayImmediately) ||
|
||||||
|| ((flags & vpqPlayImmediatelyAtMediumOrHigher) && (vpLevel >= vpMedium)))
|
((flags & vpqPlayImmediatelyAtMediumOrHigher) && (vpLevel >= vpMedium)))
|
||||||
vpPlay();
|
vpPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addSilenceIfNeeded(VoicePromptQueueFlags_T flags)
|
static void addSilenceIfNeeded(VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if ((flags & vpqAddSeparatingSilence) == 0)
|
if ((flags & vpqAddSeparatingSilence) == 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
vpQueuePrompt(PROMPT_SILENCE);
|
vpQueuePrompt(PROMPT_SILENCE);
|
||||||
vpQueuePrompt(PROMPT_SILENCE);
|
vpQueuePrompt(PROMPT_SILENCE);
|
||||||
|
|
@ -109,8 +114,7 @@ void vpQueueFrequency(freq_t freq)
|
||||||
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags)
|
void announceFrequencies(freq_t rx, freq_t tx, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
// if rx and tx frequencies differ, announce both, otherwise just announce
|
// If rx and tx frequencies differ, announce both, otherwise just one
|
||||||
// one.
|
|
||||||
if (rx == tx)
|
if (rx == tx)
|
||||||
vpQueueFrequency(rx);
|
vpQueueFrequency(rx);
|
||||||
else
|
else
|
||||||
|
|
@ -127,8 +131,7 @@ void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_MODE);
|
||||||
vpQueuePrompt(PROMPT_MODE);
|
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
|
@ -148,13 +151,11 @@ void announceRadioMode(uint8_t mode, VoicePromptQueueFlags_T flags)
|
||||||
|
|
||||||
void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags)
|
void announceBandwidth(uint8_t bandwidth, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if (bandwidth > BW_25)
|
if (bandwidth > BW_25) bandwidth = BW_25; // Should probably never happen!
|
||||||
bandwidth = BW_25; // should probably never happen!
|
|
||||||
|
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_BANDWIDTH);
|
||||||
vpQueuePrompt(PROMPT_BANDWIDTH);
|
|
||||||
|
|
||||||
char* bandwidths[] = {"12.5", "20", "25"};
|
char* bandwidths[] = {"12.5", "20", "25"};
|
||||||
vpQueueString(bandwidths[bandwidth], vpAnnounceCommonSymbols);
|
vpQueueString(bandwidths[bandwidth], vpAnnounceCommonSymbols);
|
||||||
|
|
@ -169,8 +170,7 @@ void anouncePower(float power, VoicePromptQueueFlags_T flags)
|
||||||
|
|
||||||
char buffer[16] = "\0";
|
char buffer[16] = "\0";
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_POWER);
|
||||||
vpQueuePrompt(PROMPT_POWER);
|
|
||||||
|
|
||||||
snprintf(buffer, 16, "%1.1f", power);
|
snprintf(buffer, 16, "%1.1f", power);
|
||||||
vpQueueString(buffer, vpAnnounceCommonSymbols);
|
vpQueueString(buffer, vpAnnounceCommonSymbols);
|
||||||
|
|
@ -179,7 +179,8 @@ void anouncePower(float power, VoicePromptQueueFlags_T flags)
|
||||||
vpPlayIfNeeded(flags);
|
vpPlayIfNeeded(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t bank)
|
void announceChannelSummary(channel_t* channel, uint16_t channelIndex,
|
||||||
|
uint16_t bank)
|
||||||
{
|
{
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|
||||||
|
|
@ -187,17 +188,16 @@ void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t
|
||||||
|
|
||||||
VoicePromptQueueFlags_T localFlags = vpqAddSeparatingSilence;
|
VoicePromptQueueFlags_T localFlags = vpqAddSeparatingSilence;
|
||||||
// Force on the descriptions for level 3.
|
// Force on the descriptions for level 3.
|
||||||
if (state.settings.vpLevel == vpHigh)
|
if (state.settings.vpLevel == vpHigh) localFlags |= vpqIncludeDescriptions;
|
||||||
localFlags |= vpqIncludeDescriptions;
|
// If VFO mode, announce VFO.
|
||||||
// if VFO mode, announce VFO.
|
|
||||||
// channelIndex will be 0 if called from VFO mode.
|
// channelIndex will be 0 if called from VFO mode.
|
||||||
if (channelIndex == 0)
|
if (channelIndex == 0)
|
||||||
vpQueuePrompt(PROMPT_VFO);
|
vpQueuePrompt(PROMPT_VFO);
|
||||||
else
|
else
|
||||||
announceChannelName(channel, channelIndex, localFlags);
|
announceChannelName(channel, channelIndex, localFlags);
|
||||||
announceFrequencies(channel->rx_frequency , channel->tx_frequency, localFlags);
|
announceFrequencies(channel->rx_frequency, channel->tx_frequency,
|
||||||
|
localFlags);
|
||||||
announceRadioMode(channel->mode, localFlags);
|
announceRadioMode(channel->mode, localFlags);
|
||||||
|
|
||||||
if (channel->mode == OPMODE_FM)
|
if (channel->mode == OPMODE_FM)
|
||||||
{
|
{
|
||||||
announceBandwidth(channel->bandwidth, localFlags);
|
announceBandwidth(channel->bandwidth, localFlags);
|
||||||
|
|
@ -206,8 +206,7 @@ void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t
|
||||||
if (channel->fm.rxToneEn || channel->fm.txToneEn)
|
if (channel->fm.rxToneEn || channel->fm.txToneEn)
|
||||||
{
|
{
|
||||||
announceCTCSS(channel->fm.rxToneEn, channel->fm.rxTone,
|
announceCTCSS(channel->fm.rxToneEn, channel->fm.rxTone,
|
||||||
channel->fm.txToneEn, channel->fm.txTone,
|
channel->fm.txToneEn, channel->fm.txTone, localFlags);
|
||||||
localFlags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (channel->mode == OPMODE_M17)
|
else if (channel->mode == OPMODE_M17)
|
||||||
|
|
@ -219,9 +218,12 @@ void announceChannelSummary(channel_t* channel, uint16_t channelIndex, uint16_t
|
||||||
{
|
{
|
||||||
addSilenceIfNeeded(localFlags);
|
addSilenceIfNeeded(localFlags);
|
||||||
announceContactWithIndex(channel->dmr.contact_index, localFlags);
|
announceContactWithIndex(channel->dmr.contact_index, localFlags);
|
||||||
// Force announcement of the words timeslot and colorcode to avoid ambiguity.
|
// Force announcement of the words timeslot and colorcode to avoid
|
||||||
announceTimeslot(channel->dmr.dmr_timeslot, (localFlags | vpqIncludeDescriptions));
|
// ambiguity.
|
||||||
announceColorCode(channel->dmr.rxColorCode, channel->dmr.txColorCode, (localFlags | vpqIncludeDescriptions));
|
announceTimeslot(channel->dmr.dmr_timeslot,
|
||||||
|
(localFlags | vpqIncludeDescriptions));
|
||||||
|
announceColorCode(channel->dmr.rxColorCode, channel->dmr.txColorCode,
|
||||||
|
(localFlags | vpqIncludeDescriptions));
|
||||||
}
|
}
|
||||||
addSilenceIfNeeded(localFlags);
|
addSilenceIfNeeded(localFlags);
|
||||||
|
|
||||||
|
|
@ -241,7 +243,8 @@ void AnnounceInputChar(char ch)
|
||||||
|
|
||||||
vpInit();
|
vpInit();
|
||||||
|
|
||||||
uint8_t flags = vpAnnounceCaps | vpAnnounceSpace | vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols;
|
uint8_t flags = vpAnnounceCaps | vpAnnounceSpace | vpAnnounceCommonSymbols |
|
||||||
|
vpAnnounceLessCommonSymbols;
|
||||||
|
|
||||||
vpQueueString(buf, flags);
|
vpQueueString(buf, flags);
|
||||||
|
|
||||||
|
|
@ -279,22 +282,23 @@ void announceError(VoicePromptQueueFlags_T flags)
|
||||||
|
|
||||||
void announceText(char* text, VoicePromptQueueFlags_T flags)
|
void announceText(char* text, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if (!text || !*text)
|
if (!text || !*text) return;
|
||||||
return;
|
|
||||||
|
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
// see if we have a prompt for this string.
|
// See if we have a prompt for this string.
|
||||||
int offset = GetEnglishStringTableOffset(text);
|
int offset = GetEnglishStringTableOffset(text);
|
||||||
|
|
||||||
if (offset != -1)
|
if (offset != -1)
|
||||||
vpQueueStringTableEntry((const char* const *)(¤tLanguage->languageName + offset));
|
vpQueueStringTableEntry(
|
||||||
else // just spel it out
|
(const char* const*)(¤tLanguage->languageName + offset));
|
||||||
|
else // Just spell it out
|
||||||
vpQueueString(text, vpAnnounceCommonSymbols);
|
vpQueueString(text, vpAnnounceCommonSymbols);
|
||||||
|
|
||||||
vpPlayIfNeeded(flags);
|
vpPlayIfNeeded(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8_t txTone, VoicePromptQueueFlags_T flags)
|
void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled,
|
||||||
|
uint8_t txTone, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
|
|
@ -318,7 +322,7 @@ void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8
|
||||||
vpPlayIfNeeded(flags);
|
vpPlayIfNeeded(flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// speak the individual rx and tx tones.
|
// Speak the individual rx and tx tones.
|
||||||
if (rxToneEnabled)
|
if (rxToneEnabled)
|
||||||
{
|
{
|
||||||
vpQueuePrompt(PROMPT_RECEIVE);
|
vpQueuePrompt(PROMPT_RECEIVE);
|
||||||
|
|
@ -355,8 +359,7 @@ void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_SQUELCH);
|
||||||
vpQueuePrompt(PROMPT_SQUELCH);
|
|
||||||
|
|
||||||
vpQueueInteger(squelch);
|
vpQueueInteger(squelch);
|
||||||
|
|
||||||
|
|
@ -365,29 +368,24 @@ void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags)
|
||||||
|
|
||||||
void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags)
|
void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if (!contact)
|
if (!contact) return;
|
||||||
return;
|
|
||||||
|
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_CONTACT);
|
||||||
vpQueuePrompt(PROMPT_CONTACT);
|
|
||||||
|
|
||||||
if (contact->name[0])
|
if (contact->name[0]) vpQueueString(contact->name, vpAnnounceCommonSymbols);
|
||||||
vpQueueString(contact->name, vpAnnounceCommonSymbols);
|
|
||||||
|
|
||||||
vpPlayIfNeeded(flags);
|
vpPlayIfNeeded(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags)
|
void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
contact_t contact;
|
contact_t contact;
|
||||||
|
|
||||||
if (cps_readContact(&contact, index) == -1)
|
if (cps_readContact(&contact, index) == -1) return;
|
||||||
return;
|
|
||||||
|
|
||||||
announceContact(&contact, flags);
|
announceContact(&contact, flags);
|
||||||
}
|
}
|
||||||
|
|
@ -396,20 +394,19 @@ void announceTimeslot(uint8_t timeslot, VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_TIMESLOT);
|
||||||
vpQueuePrompt(PROMPT_TIMESLOT);
|
|
||||||
|
|
||||||
vpQueueInteger(timeslot);
|
vpQueueInteger(timeslot);
|
||||||
|
|
||||||
vpPlayIfNeeded(flags);
|
vpPlayIfNeeded(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode, VoicePromptQueueFlags_T flags)
|
void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode,
|
||||||
|
VoicePromptQueueFlags_T flags)
|
||||||
{
|
{
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_COLORCODE);
|
||||||
vpQueuePrompt(PROMPT_COLORCODE);
|
|
||||||
|
|
||||||
if (rxColorCode == txColorCode)
|
if (rxColorCode == txColorCode)
|
||||||
{
|
{
|
||||||
|
|
@ -451,8 +448,7 @@ void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags)
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
if (state.m17_data.dst_addr[0])
|
if (state.m17_data.dst_addr[0])
|
||||||
{
|
{
|
||||||
if (flags & vpqIncludeDescriptions)
|
if (flags & vpqIncludeDescriptions) vpQueuePrompt(PROMPT_DEST_ID);
|
||||||
vpQueuePrompt(PROMPT_DEST_ID);
|
|
||||||
vpQueueString(state.m17_data.dst_addr, vpAnnounceCommonSymbols);
|
vpQueueString(state.m17_data.dst_addr, vpAnnounceCommonSymbols);
|
||||||
}
|
}
|
||||||
else if (channel->m17.contact_index)
|
else if (channel->m17.contact_index)
|
||||||
|
|
@ -464,11 +460,11 @@ void announceM17Info(channel_t* channel, VoicePromptQueueFlags_T flags)
|
||||||
#ifdef GPS_PRESENT
|
#ifdef GPS_PRESENT
|
||||||
void announceGPSInfo()
|
void announceGPSInfo()
|
||||||
{
|
{
|
||||||
if (!state.settings.gps_enabled)
|
if (!state.settings.gps_enabled) return;
|
||||||
return;
|
|
||||||
|
|
||||||
vpInit();
|
vpInit();
|
||||||
VoicePromptQueueFlags_T flags = vpqIncludeDescriptions | vpqAddSeparatingSilence;
|
VoicePromptQueueFlags_T flags =
|
||||||
|
vpqIncludeDescriptions | vpqAddSeparatingSilence;
|
||||||
|
|
||||||
vpQueueStringTableEntry(¤tLanguage->gps);
|
vpQueueStringTableEntry(¤tLanguage->gps);
|
||||||
|
|
||||||
|
|
@ -597,33 +593,37 @@ void announceSettingsTimeDate()
|
||||||
datetime_t local_time = utcToLocalTime(state.time, state.settings.utc_timezone);
|
datetime_t local_time = utcToLocalTime(state.time, state.settings.utc_timezone);
|
||||||
|
|
||||||
char buffer[16] = "\0";
|
char buffer[16] = "\0";
|
||||||
snprintf(buffer, 16, "%02d/%02d/%02d",
|
snprintf(buffer, 16, "%02d/%02d/%02d", local_time.date, local_time.month,
|
||||||
local_time.date, local_time.month, local_time.year);
|
local_time.year);
|
||||||
vpQueueString(buffer, (vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols));
|
vpQueueString(buffer,
|
||||||
|
(vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols));
|
||||||
|
|
||||||
snprintf(buffer, 16, "%02d:%02d:%02d",
|
snprintf(buffer, 16, "%02d:%02d:%02d", local_time.hour, local_time.minute,
|
||||||
local_time.hour, local_time.minute, local_time.second);
|
local_time.second);
|
||||||
vpQueueString(buffer, (vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols));
|
vpQueueString(buffer,
|
||||||
|
(vpAnnounceCommonSymbols | vpAnnounceLessCommonSymbols));
|
||||||
|
|
||||||
vpPlay();
|
vpPlay();
|
||||||
}
|
}
|
||||||
#endif // RTC_PRESENT
|
#endif // RTC_PRESENT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
there are 5 levels of verbosity:
|
* There are 5 levels of verbosity:
|
||||||
|
*
|
||||||
vpNone: no voice or beeps.
|
* vpNone: no voice or beeps.
|
||||||
vpBeep: beeps only.
|
* vpBeep: beeps only.
|
||||||
vpLow: menus talk, but channel and frequency changes are indicated with a beep
|
* vpLow: menus talk, but channel and frequency changes are indicated with a
|
||||||
and only voiced on demand with f1.
|
* beep and only voiced on demand with f1.
|
||||||
vpMedium: menus, channel and frequency changes talk but with extra
|
* vpMedium: menus, channel and frequency changes talk but with extra
|
||||||
descriptions eliminated unless ambiguity would result. E.g. We'd say "FM"
|
* descriptions eliminated unless ambiguity would result. E.g. We'd say "FM"
|
||||||
rather than "Mode: FM" in the channel summary.
|
* rather than "Mode: FM" in the channel summary.
|
||||||
vpHigh: like vpMedium except with extra descriptions: e.g. "Mode fm".
|
* vpHigh: like vpMedium except with extra descriptions: e.g. "Mode fm".
|
||||||
Also, if a voice prompt is in progress, e.g. changing a menu item, the descriptions are eliminated.
|
*
|
||||||
e.g. changing ctcss tones would not repeat "ctcss" when arrowing through the
|
* Also, if a voice prompt is in progress, e.g. changing a menu item, the
|
||||||
options rapidly.
|
* descriptions are eliminated, e.g., changing ctcss tones would not repeat
|
||||||
|
* "ctcss" when arrowing through the options rapidly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VoicePromptQueueFlags_T GetQueueFlagsForVoiceLevel()
|
VoicePromptQueueFlags_T GetQueueFlagsForVoiceLevel()
|
||||||
{
|
{
|
||||||
VoicePromptQueueFlags_T flags = vpqInit | vpqAddSeparatingSilence;
|
VoicePromptQueueFlags_T flags = vpqInit | vpqAddSeparatingSilence;
|
||||||
|
|
@ -634,21 +634,20 @@ VoicePromptQueueFlags_T GetQueueFlagsForVoiceLevel()
|
||||||
case vpNone:
|
case vpNone:
|
||||||
case vpBeep:
|
case vpBeep:
|
||||||
return vpqDefault;
|
return vpqDefault;
|
||||||
// play some immediately, other things on demand.
|
// Play some immediately, other things on demand.
|
||||||
case vpLow:
|
case vpLow:
|
||||||
flags |= vpqPlayImmediatelyAtMediumOrHigher;
|
flags |= vpqPlayImmediatelyAtMediumOrHigher;
|
||||||
break;
|
break;
|
||||||
// play all immediatley but without extra descriptions
|
// Play all immediately but without extra descriptions
|
||||||
case vpMedium:
|
case vpMedium:
|
||||||
{
|
{
|
||||||
flags |= vpqPlayImmediately;
|
flags |= vpqPlayImmediately;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// play immediatley with descriptions unless speech is in progress.
|
// Play immediately with descriptions unless speech is in progress.
|
||||||
case vpHigh:
|
case vpHigh:
|
||||||
flags |= vpqPlayImmediately;
|
flags |= vpqPlayImmediately;
|
||||||
if (!vpIsPlaying())
|
if (!vpIsPlaying()) flags |= vpqIncludeDescriptions;
|
||||||
flags |= vpqIncludeDescriptions;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,16 @@
|
||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#include "core/voicePrompts.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <state.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include "interfaces/keyboard.h"
|
#include "interfaces/keyboard.h"
|
||||||
#include "core/voicePrompts.h"
|
|
||||||
#include "ui/UIStrings.h"
|
#include "ui/UIStrings.h"
|
||||||
#include <state.h>
|
|
||||||
|
|
||||||
const uint32_t VOICE_PROMPTS_DATA_MAGIC = 0x5056; //'VP'
|
const uint32_t VOICE_PROMPTS_DATA_MAGIC = 0x5056; //'VP'
|
||||||
const uint32_t VOICE_PROMPTS_DATA_VERSION = 0x1000; // v1000 OpenRTX
|
const uint32_t VOICE_PROMPTS_DATA_VERSION = 0x1000; // v1000 OpenRTX
|
||||||
|
|
@ -45,7 +47,10 @@ typedef struct
|
||||||
// Address of voice prompt header for checking version etc.
|
// Address of voice prompt header for checking version etc.
|
||||||
const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS = 0x8F400;
|
const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS = 0x8F400;
|
||||||
// Start of actual voice prompt data.
|
// Start of actual voice prompt data.
|
||||||
static uint32_t vpFlashDataAddress;// = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t) + sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ;
|
static uint32_t
|
||||||
|
vpFlashDataAddress; // = VOICE_PROMPTS_FLASH_HEADER_ADDRESS +
|
||||||
|
// sizeof(voicePromptsDataHeader_t) +
|
||||||
|
// sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ;
|
||||||
// TODO figure out Codec2 frame equivalent.
|
// TODO figure out Codec2 frame equivalent.
|
||||||
// 76 x 27 byte Codec2 frames
|
// 76 x 27 byte Codec2 frames
|
||||||
#define Codec2DataBufferSize 2052
|
#define Codec2DataBufferSize 2052
|
||||||
|
|
@ -71,16 +76,11 @@ typedef struct
|
||||||
int Length;
|
int Length;
|
||||||
} vpSequence_t;
|
} vpSequence_t;
|
||||||
|
|
||||||
static vpSequence_t vpCurrentSequence =
|
static vpSequence_t vpCurrentSequence = {.Pos = 0, .Length = 0};
|
||||||
{
|
|
||||||
.Pos = 0,
|
|
||||||
.Length = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
uint32_t tableOfContents[VOICE_PROMPTS_TOC_SIZE];
|
uint32_t tableOfContents[VOICE_PROMPTS_TOC_SIZE];
|
||||||
|
|
||||||
const userDictEntry userDictionary[]=
|
const userDictEntry userDictionary[] = {
|
||||||
{
|
|
||||||
{"hotspot", PROMPT_CUSTOM1}, // Hotspot
|
{"hotspot", PROMPT_CUSTOM1}, // Hotspot
|
||||||
{"clearnode", PROMPT_CUSTOM2}, // ClearNode
|
{"clearnode", PROMPT_CUSTOM2}, // ClearNode
|
||||||
{"sharinode", PROMPT_CUSTOM3}, // ShariNode
|
{"sharinode", PROMPT_CUSTOM3}, // ShariNode
|
||||||
|
|
@ -90,20 +90,24 @@ const userDictEntry userDictionary[]=
|
||||||
{"blindhams", PROMPT_CUSTOM7}, // BlindHams
|
{"blindhams", PROMPT_CUSTOM7}, // BlindHams
|
||||||
{"allstar", PROMPT_CUSTOM8}, // Allstar
|
{"allstar", PROMPT_CUSTOM8}, // Allstar
|
||||||
{"parrot", PROMPT_CUSTOM9}, // Parrot
|
{"parrot", PROMPT_CUSTOM9}, // Parrot
|
||||||
{"channel",PROMPT_CHANNEL},
|
{"channel", PROMPT_CHANNEL}, {0, 0}};
|
||||||
{0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
void vpCacheInit(void)
|
void vpCacheInit(void)
|
||||||
{
|
{
|
||||||
voicePromptsDataHeader_t header;
|
voicePromptsDataHeader_t header;
|
||||||
// ToDo not sure where this is coming from yet.
|
// ToDo not sure where this is coming from yet.
|
||||||
//SPI_Flash_read(VOICE_PROMPTS_FLASH_HEADER_ADDRESS,(uint8_t *)&header,sizeof(voicePromptsDataHeader_t));
|
// SPI_Flash_read(VOICE_PROMPTS_FLASH_HEADER_ADDRESS,(uint8_t
|
||||||
|
// *)&header,sizeof(voicePromptsDataHeader_t));
|
||||||
|
|
||||||
if (vpCheckHeader((uint32_t*)&header))
|
if (vpCheckHeader((uint32_t*)&header))
|
||||||
{ // ToDo see above
|
{ // ToDo see above
|
||||||
vpDataIsLoaded = false; //SPI_Flash_read(VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t), (uint8_t *)&tableOfContents, sizeof(uint32_t) * VOICE_PROMPTS_TOC_SIZE);
|
vpDataIsLoaded = false; // SPI_Flash_read(VOICE_PROMPTS_FLASH_HEADER_ADDRESS
|
||||||
vpFlashDataAddress = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + sizeof(voicePromptsDataHeader_t) + sizeof(uint32_t)*VOICE_PROMPTS_TOC_SIZE ;
|
// + sizeof(voicePromptsDataHeader_t), (uint8_t
|
||||||
|
// *)&tableOfContents, sizeof(uint32_t) *
|
||||||
|
// VOICE_PROMPTS_TOC_SIZE);
|
||||||
|
vpFlashDataAddress = VOICE_PROMPTS_FLASH_HEADER_ADDRESS +
|
||||||
|
sizeof(voicePromptsDataHeader_t) +
|
||||||
|
sizeof(uint32_t) * VOICE_PROMPTS_TOC_SIZE;
|
||||||
}
|
}
|
||||||
if (vpDataIsLoaded)
|
if (vpDataIsLoaded)
|
||||||
{ // if the hash key is down, set vpLevel to high, if beep or less.
|
{ // if the hash key is down, set vpLevel to high, if beep or less.
|
||||||
|
|
@ -111,9 +115,9 @@ void vpCacheInit(void)
|
||||||
state.settings.vpLevel = vpHigh;
|
state.settings.vpLevel = vpHigh;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // ensure we at least have beeps in the event no voice prompts are loaded.
|
{ // ensure we at least have beeps in the event no voice prompts are
|
||||||
if (state.settings.vpLevel > vpBeep)
|
// loaded.
|
||||||
state.settings.vpLevel = vpBeep;
|
if (state.settings.vpLevel > vpBeep) state.settings.vpLevel = vpBeep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +125,8 @@ bool vpCheckHeader(uint32_t *bufferAddress)
|
||||||
{
|
{
|
||||||
voicePromptsDataHeader_t* header = (voicePromptsDataHeader_t*)bufferAddress;
|
voicePromptsDataHeader_t* header = (voicePromptsDataHeader_t*)bufferAddress;
|
||||||
|
|
||||||
return ((header->magic == VOICE_PROMPTS_DATA_MAGIC) && (header->version == VOICE_PROMPTS_DATA_VERSION));
|
return ((header->magic == VOICE_PROMPTS_DATA_MAGIC) &&
|
||||||
|
(header->version == VOICE_PROMPTS_DATA_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetCodec2Data(int offset, int length)
|
static void GetCodec2Data(int offset, int length)
|
||||||
|
|
@ -130,7 +135,8 @@ static void GetCodec2Data(int offset,int length)
|
||||||
{ // ToDo where are we reading this from?
|
{ // ToDo where are we reading this from?
|
||||||
// Just so we can build,
|
// Just so we can build,
|
||||||
;
|
;
|
||||||
//SPI_Flash_read(vpFlashDataAddress + offset, (uint8_t *)&Codec2Data, length);
|
// SPI_Flash_read(vpFlashDataAddress + offset, (uint8_t *)&Codec2Data,
|
||||||
|
// length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +148,8 @@ void vpTick(void)
|
||||||
{ // ToDo figure out buffering.
|
{ // ToDo figure out buffering.
|
||||||
// if (wavbuffer_count <= (WAV_BUFFER_COUNT / 2))
|
// if (wavbuffer_count <= (WAV_BUFFER_COUNT / 2))
|
||||||
{
|
{
|
||||||
// codecDecode((uint8_t *)&Codec2Data[promptDataPosition], 3);
|
// codecDecode((uint8_t
|
||||||
|
// *)&Codec2Data[promptDataPosition], 3);
|
||||||
promptDataPosition += 27;
|
promptDataPosition += 27;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,13 +162,17 @@ void vpTick(void)
|
||||||
vpCurrentSequence.Pos++;
|
vpCurrentSequence.Pos++;
|
||||||
promptDataPosition = 0;
|
promptDataPosition = 0;
|
||||||
|
|
||||||
int promptNumber = vpCurrentSequence.Buffer[vpCurrentSequence.Pos];
|
int promptNumber =
|
||||||
currentPromptLength = tableOfContents[promptNumber + 1] - tableOfContents[promptNumber];
|
vpCurrentSequence.Buffer[vpCurrentSequence.Pos];
|
||||||
GetCodec2Data(tableOfContents[promptNumber], currentPromptLength);
|
currentPromptLength = tableOfContents[promptNumber + 1] -
|
||||||
|
tableOfContents[promptNumber];
|
||||||
|
GetCodec2Data(tableOfContents[promptNumber],
|
||||||
|
currentPromptLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// wait for wave buffer to empty when prompt has finished playing
|
// wait for wave buffer to empty when prompt has finished
|
||||||
|
// playing
|
||||||
|
|
||||||
// if (wavbuffer_count == 0)
|
// if (wavbuffer_count == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -176,9 +187,11 @@ void vpTick(void)
|
||||||
{
|
{
|
||||||
promptTail--;
|
promptTail--;
|
||||||
|
|
||||||
/*if ((promptTail == 0) && trxCarrierDetected() && (trxGetMode() == RADIO_MODE_ANALOG))
|
/*if ((promptTail == 0) && trxCarrierDetected() && (trxGetMode() ==
|
||||||
|
RADIO_MODE_ANALOG))
|
||||||
{// ToDo enable amp.
|
{// ToDo enable amp.
|
||||||
//GPIO_PinWrite(GPIO_RX_audio_mux, Pin_RX_audio_mux, 1); // Set the audio path to AT1846 -> audio amp.
|
//GPIO_PinWrite(GPIO_RX_audio_mux, Pin_RX_audio_mux, 1); // Set
|
||||||
|
the audio path to AT1846 -> audio amp.
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -212,8 +225,7 @@ void vpInit(void)
|
||||||
|
|
||||||
void vpQueuePrompt(uint16_t prompt)
|
void vpQueuePrompt(uint16_t prompt)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (voicePromptIsActive)
|
if (voicePromptIsActive)
|
||||||
{
|
{
|
||||||
|
|
@ -244,15 +256,20 @@ static uint16_t UserDictLookup(char* ptr, int* advanceBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetSymbolVPIfItShouldBeAnnounced(char symbol,
|
static bool GetSymbolVPIfItShouldBeAnnounced(char symbol,
|
||||||
VoicePromptFlags_T flags, voicePrompt_t* vp)
|
VoicePromptFlags_T flags,
|
||||||
|
voicePrompt_t* vp)
|
||||||
{
|
{
|
||||||
*vp = PROMPT_SILENCE;
|
*vp = PROMPT_SILENCE;
|
||||||
|
|
||||||
const char indexedSymbols[] = "%.+-*#!,@:?()~/[]<>=$'`&|_^{}"; // Must match order of symbols in voicePrompt_t enum.
|
const char indexedSymbols[] =
|
||||||
|
"%.+-*#!,@:?()~/[]<>=$'`&|_^{}"; // Must match order of symbols in
|
||||||
|
// voicePrompt_t enum.
|
||||||
const char commonSymbols[] = "%.+-*#";
|
const char commonSymbols[] = "%.+-*#";
|
||||||
|
|
||||||
bool announceCommonSymbols = (flags & vpAnnounceCommonSymbols) ? true : false;
|
bool announceCommonSymbols =
|
||||||
bool announceLessCommonSymbols=(flags & vpAnnounceLessCommonSymbols) ? true : false;
|
(flags & vpAnnounceCommonSymbols) ? true : false;
|
||||||
|
bool announceLessCommonSymbols =
|
||||||
|
(flags & vpAnnounceLessCommonSymbols) ? true : false;
|
||||||
|
|
||||||
char* symbolPtr = strchr(indexedSymbols, symbol);
|
char* symbolPtr = strchr(indexedSymbols, symbol);
|
||||||
|
|
||||||
|
|
@ -265,22 +282,21 @@ VoicePromptFlags_T flags, voicePrompt_t* vp)
|
||||||
|
|
||||||
*vp = PROMPT_PERCENT + (symbolPtr - indexedSymbols);
|
*vp = PROMPT_PERCENT + (symbolPtr - indexedSymbols);
|
||||||
|
|
||||||
return ((commonSymbol && announceCommonSymbols) || (!commonSymbol && announceLessCommonSymbols));
|
return ((commonSymbol && announceCommonSymbols) ||
|
||||||
|
(!commonSymbol && announceLessCommonSymbols));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function spells out a string letter by letter.
|
// This function spells out a string letter by letter.
|
||||||
void vpQueueString(char* promptString, VoicePromptFlags_T flags)
|
void vpQueueString(char* promptString, VoicePromptFlags_T flags)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (voicePromptIsActive)
|
if (voicePromptIsActive)
|
||||||
{
|
{
|
||||||
vpInit();
|
vpInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.settings.vpPhoneticSpell)
|
if (state.settings.vpPhoneticSpell) flags |= vpAnnouncePhoneticRendering;
|
||||||
flags|=vpAnnouncePhoneticRendering;
|
|
||||||
while (*promptString != 0)
|
while (*promptString != 0)
|
||||||
{
|
{
|
||||||
int advanceBy = 0;
|
int advanceBy = 0;
|
||||||
|
|
@ -297,8 +313,7 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
|
||||||
}
|
}
|
||||||
else if ((*promptString >= 'A') && (*promptString <= 'Z'))
|
else if ((*promptString >= 'A') && (*promptString <= 'Z'))
|
||||||
{
|
{
|
||||||
if (flags&vpAnnounceCaps)
|
if (flags & vpAnnounceCaps) vpQueuePrompt(PROMPT_CAP);
|
||||||
vpQueuePrompt(PROMPT_CAP);
|
|
||||||
if (flags & vpAnnouncePhoneticRendering)
|
if (flags & vpAnnouncePhoneticRendering)
|
||||||
vpQueuePrompt((*promptString - 'A') + PROMPT_A_PHONETIC);
|
vpQueuePrompt((*promptString - 'A') + PROMPT_A_PHONETIC);
|
||||||
else
|
else
|
||||||
|
|
@ -322,7 +337,8 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
|
||||||
else // announce ASCII
|
else // announce ASCII
|
||||||
{
|
{
|
||||||
int32_t val = *promptString;
|
int32_t val = *promptString;
|
||||||
vpQueuePrompt(PROMPT_CHARACTER); // just the word "code" as we don't have character.
|
vpQueuePrompt(PROMPT_CHARACTER); // just the word "code" as we
|
||||||
|
// don't have character.
|
||||||
vpQueueInteger(val);
|
vpQueueInteger(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -334,15 +350,12 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
|
||||||
|
|
||||||
promptString++;
|
promptString++;
|
||||||
}
|
}
|
||||||
if (flags & vpqAddSeparatingSilence)
|
if (flags & vpqAddSeparatingSilence) vpQueuePrompt(PROMPT_SILENCE);
|
||||||
vpQueuePrompt(PROMPT_SILENCE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vpQueueInteger(int32_t value)
|
void vpQueueInteger(int32_t value)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow) return;
|
||||||
return;
|
|
||||||
|
|
||||||
char buf[12] = {0}; // min: -2147483648, max: 2147483647
|
char buf[12] = {0}; // min: -2147483648, max: 2147483647
|
||||||
snprintf(buf, 12, "%d", value);
|
snprintf(buf, 12, "%d", value);
|
||||||
|
|
@ -355,20 +368,19 @@ void vpQueueInteger(int32_t value)
|
||||||
// NUM_VOICE_PROMPTS + (stringTableStringPtr - currentLanguage->languageName)
|
// NUM_VOICE_PROMPTS + (stringTableStringPtr - currentLanguage->languageName)
|
||||||
void vpQueueStringTableEntry(const char* const* stringTableStringPtr)
|
void vpQueueStringTableEntry(const char* const* stringTableStringPtr)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (stringTableStringPtr == NULL)
|
if (stringTableStringPtr == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vpQueuePrompt(NUM_VOICE_PROMPTS + (stringTableStringPtr - ¤tLanguage->languageName));
|
vpQueuePrompt(NUM_VOICE_PROMPTS +
|
||||||
|
(stringTableStringPtr - ¤tLanguage->languageName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void vpPlay(void)
|
void vpPlay(void)
|
||||||
{
|
{
|
||||||
if (state.settings.vpLevel < vpLow)
|
if (state.settings.vpLevel < vpLow) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0))
|
if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0))
|
||||||
{
|
{
|
||||||
|
|
@ -377,15 +389,16 @@ void vpPlay(void)
|
||||||
|
|
||||||
vpCurrentSequence.Pos = 0;
|
vpCurrentSequence.Pos = 0;
|
||||||
|
|
||||||
currentPromptLength = tableOfContents[promptNumber + 1] - tableOfContents[promptNumber];
|
currentPromptLength =
|
||||||
|
tableOfContents[promptNumber + 1] - tableOfContents[promptNumber];
|
||||||
GetCodec2Data(tableOfContents[promptNumber], currentPromptLength);
|
GetCodec2Data(tableOfContents[promptNumber], currentPromptLength);
|
||||||
|
|
||||||
// GPIO_PinWrite(GPIO_RX_audio_mux, Pin_RX_audio_mux, 0);// set the audio mux HR-C6000 -> audio amp
|
// GPIO_PinWrite(GPIO_RX_audio_mux, Pin_RX_audio_mux, 0);// set
|
||||||
|
// the audio mux HR-C6000 -> audio amp
|
||||||
// enableAudioAmp(AUDIO_AMP_MODE_PROMPT);
|
// enableAudioAmp(AUDIO_AMP_MODE_PROMPT);
|
||||||
|
|
||||||
// codecInit(true);
|
// codecInit(true);
|
||||||
promptDataPosition = 0;
|
promptDataPosition = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,21 @@
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
This string table's order must not be altered as voice prompts will be indexed in the same order as these strings.
|
This string table's order must not be altered as voice prompts will be indexed
|
||||||
|
in the same order as these strings.
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
|
||||||
#include "ui/UIStrings.h"
|
#include "ui/UIStrings.h"
|
||||||
#include "ui/EnglishStrings.h"
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "ui/EnglishStrings.h"
|
||||||
|
|
||||||
// add more languages here.
|
// add more languages here.
|
||||||
const stringsTable_t languages[NUM_LANGUAGES] = {englishStrings};
|
const stringsTable_t languages[NUM_LANGUAGES] = {englishStrings};
|
||||||
// default to English.
|
// default to English.
|
||||||
const stringsTable_t* currentLanguage = &languages[0];
|
const stringsTable_t* currentLanguage = &languages[0];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given an english string such as a menu item or value,
|
Given an english string such as a menu item or value,
|
||||||
search the english string table and return the offset if found.
|
search the english string table and return the offset if found.
|
||||||
|
|
@ -39,8 +41,7 @@ struct, or to announce an indexed voice prompt.
|
||||||
*/
|
*/
|
||||||
int GetEnglishStringTableOffset(char* text)
|
int GetEnglishStringTableOffset(char* text)
|
||||||
{
|
{
|
||||||
if (!text || !*text)
|
if (!text || !*text) return -1; // error.
|
||||||
return -1; // error.
|
|
||||||
|
|
||||||
uint8_t stringCount = sizeof(stringsTable_t) / sizeof(char*);
|
uint8_t stringCount = sizeof(stringsTable_t) / sizeof(char*);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue