Added voice prompt verbosity levels: off, beep, low, medium and high.
This commit is contained in:
parent
d68f01ffbc
commit
ad07a517bc
|
|
@ -172,8 +172,18 @@ typedef enum
|
||||||
vpqIncludeDescriptions=0x04
|
vpqIncludeDescriptions=0x04
|
||||||
} VoicePromptQueueFlags_T;
|
} VoicePromptQueueFlags_T;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
vpNone=0,
|
||||||
|
vpBeep,
|
||||||
|
vpLow,
|
||||||
|
vpMedium,
|
||||||
|
vpHigh
|
||||||
|
} VoicePromptVerbosity_T;
|
||||||
|
|
||||||
extern bool voicePromptDataIsLoaded;
|
extern bool voicePromptDataIsLoaded;
|
||||||
extern const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS;
|
extern const uint32_t VOICE_PROMPTS_FLASH_HEADER_ADDRESS;
|
||||||
|
extern VoicePromptVerbosity_T vpLevel;
|
||||||
// Loads just the TOC from Flash and stores in RAM for fast access.
|
// Loads just the TOC from Flash and stores in RAM for fast access.
|
||||||
void vpCacheInit(void);
|
void vpCacheInit(void);
|
||||||
// event driven to play a voice prompt in progress.
|
// event driven to play a voice prompt in progress.
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,10 @@ VoicePromptQueueFlags_T flags)
|
||||||
vpInitIfNeeded(flags);
|
vpInitIfNeeded(flags);
|
||||||
|
|
||||||
// mask off init and play because this function will handle init and play.
|
// mask off init and play because this function will handle init and play.
|
||||||
VoicePromptQueueFlags_T localFlags=flags & vpqIncludeDescriptions;
|
VoicePromptQueueFlags_T localFlags=flags & ~(vpqInit | vpqPlayImmediately);
|
||||||
|
if (vpLevel == vpHigh)
|
||||||
|
localFlags |= vpqIncludeDescriptions;
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ static uint32_t vpFlashDataAddress;// = VOICE_PROMPTS_FLASH_HEADER_ADDRESS + siz
|
||||||
#define Codec2DataBufferSize 2052
|
#define Codec2DataBufferSize 2052
|
||||||
|
|
||||||
bool voicePromptDataIsLoaded = false;
|
bool voicePromptDataIsLoaded = false;
|
||||||
|
VoicePromptVerbosity_T vpLevel = vpHigh;
|
||||||
|
|
||||||
static bool voicePromptIsActive = false;
|
static bool voicePromptIsActive = false;
|
||||||
// Uninitialized is -1.
|
// Uninitialized is -1.
|
||||||
static int promptDataPosition = -1;
|
static int promptDataPosition = -1;
|
||||||
|
|
@ -186,6 +188,9 @@ void vpInit(void)
|
||||||
|
|
||||||
void vpQueuePrompt(uint16_t prompt)
|
void vpQueuePrompt(uint16_t prompt)
|
||||||
{
|
{
|
||||||
|
if (vpLevel < vpLow)
|
||||||
|
return;
|
||||||
|
|
||||||
if (voicePromptIsActive)
|
if (voicePromptIsActive)
|
||||||
{
|
{
|
||||||
vpInit();
|
vpInit();
|
||||||
|
|
@ -225,6 +230,9 @@ VoicePromptFlags_T flags, voicePrompt_t* vp)
|
||||||
// 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 (vpLevel < vpLow)
|
||||||
|
return;
|
||||||
|
|
||||||
if (voicePromptIsActive)
|
if (voicePromptIsActive)
|
||||||
{
|
{
|
||||||
vpInit();
|
vpInit();
|
||||||
|
|
@ -281,6 +289,9 @@ void vpQueueString(char *promptString, VoicePromptFlags_T flags)
|
||||||
|
|
||||||
void vpQueueInteger(int32_t value)
|
void vpQueueInteger(int32_t value)
|
||||||
{
|
{
|
||||||
|
if (vpLevel < vpLow)
|
||||||
|
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);
|
||||||
vpQueueString(buf, 0);
|
vpQueueString(buf, 0);
|
||||||
|
|
@ -292,6 +303,9 @@ 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 (vpLevel < vpLow)
|
||||||
|
return;
|
||||||
|
|
||||||
if (stringTableStringPtr == NULL)
|
if (stringTableStringPtr == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -301,6 +315,9 @@ void vpQueueStringTableEntry(const char * const *stringTableStringPtr)
|
||||||
|
|
||||||
void vpPlay(void)
|
void vpPlay(void)
|
||||||
{
|
{
|
||||||
|
if (vpLevel < vpLow)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0))
|
if ((voicePromptIsActive == false) && (vpCurrentSequence.Length > 0))
|
||||||
{
|
{
|
||||||
voicePromptIsActive = true;// Start the playback
|
voicePromptIsActive = true;// Start the playback
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue