kopia lustrzana https://github.com/OpenRTX/OpenRTX
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 hangmd1702
rodzic
5bb7fc96a8
commit
8eca684a7d
|
@ -697,10 +697,15 @@ sine_test = executable('sine_test',
|
|||
sources : unit_test_src + ['tests/unit/play_sine.c'],
|
||||
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 Viterbi Unit Test', m17_viterbi_test)
|
||||
test('M17 Demodulator Test', m17_demodulator_test)
|
||||
test('M17 RRC Test', m17_rrc_test)
|
||||
test('Codeplug Test', cps_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 <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
|
||||
the UI string table, for example letters of the alphabet, digits, and
|
||||
|
@ -270,4 +273,4 @@ bool vpCheckHeader(uint32_t* bufferAddress);
|
|||
int vp_open(char *vp_name);
|
||||
void vp_close();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -137,6 +137,8 @@ void vpCacheInit(void)
|
|||
// loaded.
|
||||
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)
|
||||
|
@ -154,8 +156,9 @@ static void GetCodec2Data(int offset, int length)
|
|||
|
||||
if ((offset < 0) || (length > Codec2DataBufferSize))
|
||||
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);
|
||||
// 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.
|
||||
|
@ -181,11 +184,6 @@ void vpTerminate(void)
|
|||
|
||||
void vpInit(void)
|
||||
{
|
||||
if (voicePromptIsActive)
|
||||
{
|
||||
vpTerminate();
|
||||
}
|
||||
|
||||
vpCurrentSequence.length = 0;
|
||||
vpCurrentSequence.pos = 0;
|
||||
vpCurrentSequence.codec2DataIndex = 0;
|
||||
|
@ -343,8 +341,9 @@ void vpQueueStringTableEntry(const char* const* stringTableStringPtr)
|
|||
{
|
||||
return;
|
||||
}
|
||||
vpQueuePrompt(NUM_VOICE_PROMPTS +
|
||||
(stringTableStringPtr - ¤tLanguage->languageName));
|
||||
vpQueuePrompt(NUM_VOICE_PROMPTS + 1 +
|
||||
(stringTableStringPtr - ¤tLanguage->languageName)
|
||||
/ sizeof(const char *));
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue