Voice prompts bugfixes:
- added missing initialization of codec2 in voice prompts code - discarding the voice prompt header as we only support 3200 bit rate - fixed wrong offset in pick vpQueueStringTableEntry - fixed bug in vpInit causing voiceprompts to hang
This commit is contained in:
parent
5bb7fc96a8
commit
8eca684a7d
|
|
@ -697,6 +697,10 @@ sine_test = executable('sine_test',
|
||||||
sources : unit_test_src + ['tests/unit/play_sine.c'],
|
sources : unit_test_src + ['tests/unit/play_sine.c'],
|
||||||
kwargs : unit_test_opts)
|
kwargs : unit_test_opts)
|
||||||
|
|
||||||
|
vp_test = executable('vp_test',
|
||||||
|
sources : unit_test_src + ['tests/unit/voice_prompts.c'],
|
||||||
|
kwargs : unit_test_opts)
|
||||||
|
|
||||||
test('M17 Golay Unit Test', m17_golay_test)
|
test('M17 Golay Unit Test', m17_golay_test)
|
||||||
test('M17 Viterbi Unit Test', m17_viterbi_test)
|
test('M17 Viterbi Unit Test', m17_viterbi_test)
|
||||||
test('M17 Demodulator Test', m17_demodulator_test)
|
test('M17 Demodulator Test', m17_demodulator_test)
|
||||||
|
|
@ -704,3 +708,4 @@ test('M17 RRC Test', m17_rrc_test)
|
||||||
test('Codeplug Test', cps_test)
|
test('Codeplug Test', cps_test)
|
||||||
test('Linux InputStream Test', linux_inputStream_test)
|
test('Linux InputStream Test', linux_inputStream_test)
|
||||||
test('Sine Test', sine_test)
|
test('Sine Test', sine_test)
|
||||||
|
test('Voice Prompts Test', vp_test)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
#include <datatypes.h>
|
#include <datatypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
// Voice prompts are encoded using the codec2 file format used by ffmpeg
|
||||||
|
#define CODEC2_HEADER_SIZE 7
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Please note, these prompts represent spoken words or phrases which are not in
|
Please note, these prompts represent spoken words or phrases which are not in
|
||||||
the UI string table, for example letters of the alphabet, digits, and
|
the UI string table, for example letters of the alphabet, digits, and
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,8 @@ void vpCacheInit(void)
|
||||||
// loaded.
|
// loaded.
|
||||||
if (state.settings.vpLevel > vpBeep) state.settings.vpLevel = vpBeep;
|
if (state.settings.vpLevel > vpBeep) state.settings.vpLevel = vpBeep;
|
||||||
}
|
}
|
||||||
|
// TODO: Move this somewhere else for compatibility with M17
|
||||||
|
codec_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vpCheckHeader(uint32_t* bufferAddress)
|
bool vpCheckHeader(uint32_t* bufferAddress)
|
||||||
|
|
@ -155,7 +157,8 @@ static void GetCodec2Data(int offset, int length)
|
||||||
if ((offset < 0) || (length > Codec2DataBufferSize))
|
if ((offset < 0) || (length > Codec2DataBufferSize))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fseek(voice_prompt_file, vpDataOffset+offset, SEEK_SET);
|
// Skip codec2 header
|
||||||
|
fseek(voice_prompt_file, vpDataOffset+offset+CODEC2_HEADER_SIZE, SEEK_SET);
|
||||||
fread((void*)&Codec2Data, length, 1, voice_prompt_file);
|
fread((void*)&Codec2Data, length, 1, voice_prompt_file);
|
||||||
// zero buffer from length to the next multiple of 8 to avoid garbage
|
// zero buffer from length to the next multiple of 8 to avoid garbage
|
||||||
// being played back, since codec2 frames are pushed in lots of 8 bytes.
|
// being played back, since codec2 frames are pushed in lots of 8 bytes.
|
||||||
|
|
@ -181,11 +184,6 @@ void vpTerminate(void)
|
||||||
|
|
||||||
void vpInit(void)
|
void vpInit(void)
|
||||||
{
|
{
|
||||||
if (voicePromptIsActive)
|
|
||||||
{
|
|
||||||
vpTerminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
vpCurrentSequence.length = 0;
|
vpCurrentSequence.length = 0;
|
||||||
vpCurrentSequence.pos = 0;
|
vpCurrentSequence.pos = 0;
|
||||||
vpCurrentSequence.codec2DataIndex = 0;
|
vpCurrentSequence.codec2DataIndex = 0;
|
||||||
|
|
@ -343,8 +341,9 @@ void vpQueueStringTableEntry(const char* const* stringTableStringPtr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vpQueuePrompt(NUM_VOICE_PROMPTS +
|
vpQueuePrompt(NUM_VOICE_PROMPTS + 1 +
|
||||||
(stringTableStringPtr - ¤tLanguage->languageName));
|
(stringTableStringPtr - ¤tLanguage->languageName)
|
||||||
|
/ sizeof(const char *));
|
||||||
}
|
}
|
||||||
|
|
||||||
void vpPlay(void)
|
void vpPlay(void)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
|
||||||
|
* Niccolò Izzo IU2KIN *
|
||||||
|
* Frederik Saraci IU2NRO *
|
||||||
|
* Silvano Seva IU2KWO *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
// Test private methods
|
||||||
|
#define private public
|
||||||
|
|
||||||
|
#include <state.h>
|
||||||
|
#include <voicePromptUtils.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test voice prompts playback
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
state.settings.vpLevel = 3;
|
||||||
|
VoicePromptQueueFlags_T flags = GetQueueFlagsForVoiceLevel();
|
||||||
|
|
||||||
|
vpCacheInit();
|
||||||
|
vpInit();
|
||||||
|
vpQueueStringTableEntry(¤tLanguage->allChannels);
|
||||||
|
vpPlay();
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
vpTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue