mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-22 06:05:36 +08:00
Prepare for having two voice subsystems.
This commit is contained in:
@@ -29,10 +29,10 @@
|
|||||||
#include "PassAllPC.h"
|
#include "PassAllPC.h"
|
||||||
#include "PassAllTG.h"
|
#include "PassAllTG.h"
|
||||||
#include "DMRFullLC.h"
|
#include "DMRFullLC.h"
|
||||||
|
#include "XLXVoice.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "DMRLC.h"
|
#include "DMRLC.h"
|
||||||
#include "Voice.h"
|
|
||||||
#include "Sync.h"
|
#include "Sync.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "GitVersion.h"
|
#include "GitVersion.h"
|
||||||
@@ -409,7 +409,7 @@ int CDMRGateway::run()
|
|||||||
unsigned int rfTimeout = m_conf.getRFTimeout();
|
unsigned int rfTimeout = m_conf.getRFTimeout();
|
||||||
unsigned int netTimeout = m_conf.getNetTimeout();
|
unsigned int netTimeout = m_conf.getNetTimeout();
|
||||||
|
|
||||||
CVoice* voice = NULL;
|
CXLXVoice* voice = NULL;
|
||||||
if (m_conf.getVoiceEnabled() && m_xlxNetwork != NULL) {
|
if (m_conf.getVoiceEnabled() && m_xlxNetwork != NULL) {
|
||||||
std::string language = m_conf.getVoiceLanguage();
|
std::string language = m_conf.getVoiceLanguage();
|
||||||
std::string directory = m_conf.getVoiceDirectory();
|
std::string directory = m_conf.getVoiceDirectory();
|
||||||
@@ -419,7 +419,7 @@ int CDMRGateway::run()
|
|||||||
LogInfo(" Language: %s", language.c_str());
|
LogInfo(" Language: %s", language.c_str());
|
||||||
LogInfo(" Directory: %s", directory.c_str());
|
LogInfo(" Directory: %s", directory.c_str());
|
||||||
|
|
||||||
voice = new CVoice(directory, language, m_repeater->getId(), m_xlxSlot, m_xlxTG);
|
voice = new CXLXVoice(directory, language, m_repeater->getId(), m_xlxSlot, m_xlxTG);
|
||||||
bool ret = voice->open();
|
bool ret = voice->open();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
delete voice;
|
delete voice;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ UserControl=1
|
|||||||
|
|
||||||
# BrandMeister
|
# BrandMeister
|
||||||
[DMR Network 1]
|
[DMR Network 1]
|
||||||
Enabled=0
|
Enabled=1
|
||||||
Name=BM
|
Name=BM
|
||||||
Address=44.131.4.1
|
Address=44.131.4.1
|
||||||
Port=62031
|
Port=62031
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
<ClInclude Include="UDPSocket.h" />
|
<ClInclude Include="UDPSocket.h" />
|
||||||
<ClInclude Include="Utils.h" />
|
<ClInclude Include="Utils.h" />
|
||||||
<ClInclude Include="Version.h" />
|
<ClInclude Include="Version.h" />
|
||||||
<ClInclude Include="Voice.h" />
|
<ClInclude Include="XLXVoice.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="BPTC19696.cpp" />
|
<ClCompile Include="BPTC19696.cpp" />
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
<ClCompile Include="Timer.cpp" />
|
<ClCompile Include="Timer.cpp" />
|
||||||
<ClCompile Include="UDPSocket.cpp" />
|
<ClCompile Include="UDPSocket.cpp" />
|
||||||
<ClCompile Include="Utils.cpp" />
|
<ClCompile Include="Utils.cpp" />
|
||||||
<ClCompile Include="Voice.cpp" />
|
<ClCompile Include="XLXVoice.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -95,9 +95,6 @@
|
|||||||
<ClInclude Include="QR1676.h">
|
<ClInclude Include="QR1676.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Voice.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="RewriteTG.h">
|
<ClInclude Include="RewriteTG.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -140,6 +137,9 @@
|
|||||||
<ClInclude Include="RewriteDynTGRF.h">
|
<ClInclude Include="RewriteDynTGRF.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="XLXVoice.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Conf.cpp">
|
<ClCompile Include="Conf.cpp">
|
||||||
@@ -217,9 +217,6 @@
|
|||||||
<ClCompile Include="QR1676.cpp">
|
<ClCompile Include="QR1676.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Voice.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RewriteTG.cpp">
|
<ClCompile Include="RewriteTG.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -262,5 +259,8 @@
|
|||||||
<ClCompile Include="RewriteDynTGRF.cpp">
|
<ClCompile Include="RewriteDynTGRF.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="XLXVoice.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
2
Makefile
2
Makefile
@@ -7,7 +7,7 @@ LDFLAGS = -g
|
|||||||
OBJECTS = BPTC19696.o Conf.o CRC.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o \
|
OBJECTS = BPTC19696.o Conf.o CRC.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o \
|
||||||
Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o Reflectors.o RepeaterProtocol.o Rewrite.o RewriteDstId.o RewriteDynTGNet.o \
|
Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o Reflectors.o RepeaterProtocol.o Rewrite.o RewriteDstId.o RewriteDynTGNet.o \
|
||||||
RewriteDynTGRF.o RewritePC.o RewriteSrc.o RewriteSrcId.o RewriteTG.o RewriteType.o RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o \
|
RewriteDynTGRF.o RewritePC.o RewriteSrc.o RewriteSrcId.o RewriteTG.o RewriteType.o RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o \
|
||||||
Utils.o Voice.o
|
Utils.o XLXVoice.o
|
||||||
|
|
||||||
all: DMRGateway
|
all: DMRGateway
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "DMRSlotType.h"
|
#include "DMRSlotType.h"
|
||||||
#include "DMRFullLC.h"
|
#include "DMRFullLC.h"
|
||||||
|
#include "XLXVoice.h"
|
||||||
#include "DMREMB.h"
|
#include "DMREMB.h"
|
||||||
#include "Voice.h"
|
|
||||||
#include "Sync.h"
|
#include "Sync.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ const unsigned char COLOR_CODE = 3U;
|
|||||||
const unsigned int SILENCE_LENGTH = 9U;
|
const unsigned int SILENCE_LENGTH = 9U;
|
||||||
const unsigned int AMBE_LENGTH = 9U;
|
const unsigned int AMBE_LENGTH = 9U;
|
||||||
|
|
||||||
CVoice::CVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg) :
|
CXLXVoice::CXLXVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg) :
|
||||||
m_indxFile(),
|
m_indxFile(),
|
||||||
m_ambeFile(),
|
m_ambeFile(),
|
||||||
m_slot(slot),
|
m_slot(slot),
|
||||||
@@ -63,7 +63,7 @@ m_it()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CVoice::~CVoice()
|
CXLXVoice::~CXLXVoice()
|
||||||
{
|
{
|
||||||
for (std::vector<CDMRData*>::iterator it = m_data.begin(); it != m_data.end(); ++it)
|
for (std::vector<CDMRData*>::iterator it = m_data.begin(); it != m_data.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
@@ -77,7 +77,7 @@ CVoice::~CVoice()
|
|||||||
delete[] m_ambe;
|
delete[] m_ambe;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVoice::open()
|
bool CXLXVoice::open()
|
||||||
{
|
{
|
||||||
FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt");
|
FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt");
|
||||||
if (fpindx == NULL) {
|
if (fpindx == NULL) {
|
||||||
@@ -130,7 +130,7 @@ bool CVoice::open()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoice::linkedTo(unsigned int number, unsigned int room)
|
void CXLXVoice::linkedTo(unsigned int number, unsigned int room)
|
||||||
{
|
{
|
||||||
char letters[10U];
|
char letters[10U];
|
||||||
::sprintf(letters, "%03u", number);
|
::sprintf(letters, "%03u", number);
|
||||||
@@ -158,7 +158,7 @@ void CVoice::linkedTo(unsigned int number, unsigned int room)
|
|||||||
createVoice(words);
|
createVoice(words);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoice::unlinked()
|
void CXLXVoice::unlinked()
|
||||||
{
|
{
|
||||||
std::vector<std::string> words;
|
std::vector<std::string> words;
|
||||||
words.push_back("notlinked");
|
words.push_back("notlinked");
|
||||||
@@ -166,7 +166,7 @@ void CVoice::unlinked()
|
|||||||
createVoice(words);
|
createVoice(words);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoice::createVoice(const std::vector<std::string>& words)
|
void CXLXVoice::createVoice(const std::vector<std::string>& words)
|
||||||
{
|
{
|
||||||
unsigned int ambeLength = 0U;
|
unsigned int ambeLength = 0U;
|
||||||
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
|
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
|
||||||
@@ -273,7 +273,7 @@ void CVoice::createVoice(const std::vector<std::string>& words)
|
|||||||
m_timer.start();
|
m_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVoice::read(CDMRData& data)
|
bool CXLXVoice::read(CDMRData& data)
|
||||||
{
|
{
|
||||||
if (m_status != VS_SENDING)
|
if (m_status != VS_SENDING)
|
||||||
return false;
|
return false;
|
||||||
@@ -300,7 +300,7 @@ bool CVoice::read(CDMRData& data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoice::clock(unsigned int ms)
|
void CXLXVoice::clock(unsigned int ms)
|
||||||
{
|
{
|
||||||
m_timer.clock(ms);
|
m_timer.clock(ms);
|
||||||
if (m_timer.isRunning() && m_timer.hasExpired()) {
|
if (m_timer.isRunning() && m_timer.hasExpired()) {
|
||||||
@@ -313,7 +313,7 @@ void CVoice::clock(unsigned int ms)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoice::createHeaderTerminator(unsigned char type)
|
void CXLXVoice::createHeaderTerminator(unsigned char type)
|
||||||
{
|
{
|
||||||
CDMRData* data = new CDMRData;
|
CDMRData* data = new CDMRData;
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(Voice_H)
|
#if !defined(XLXVoice_H)
|
||||||
#define Voice_H
|
#define XLXVoice_H
|
||||||
|
|
||||||
#include "DMREmbeddedData.h"
|
#include "DMREmbeddedData.h"
|
||||||
#include "StopWatch.h"
|
#include "StopWatch.h"
|
||||||
@@ -40,10 +40,10 @@ struct CPositions {
|
|||||||
unsigned int m_length;
|
unsigned int m_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CVoice {
|
class CXLXVoice {
|
||||||
public:
|
public:
|
||||||
CVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg);
|
CXLXVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg);
|
||||||
~CVoice();
|
~CXLXVoice();
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
|
|
||||||
Reference in New Issue
Block a user