mirror of https://github.com/g4klx/MMDVM.git
Add input audio delay to match the CTCSS decoder results.
This commit is contained in:
parent
fa29a27695
commit
3bb7cde322
14
FM.cpp
14
FM.cpp
|
@ -46,8 +46,10 @@ m_cosInvert(false),
|
|||
m_rfAudioBoost(1U),
|
||||
m_downsampler(128U),//Size might need adjustement
|
||||
m_rxLevel(1),
|
||||
m_inputRB(4800U), // 200ms of audio
|
||||
m_outputRB(2400U) // 100ms of audio
|
||||
{
|
||||
insertDelay(100U);
|
||||
}
|
||||
|
||||
void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
|
||||
|
@ -68,6 +70,10 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
|
|||
|
||||
uint8_t ctcssState = m_ctcssRX.process(currentSample);
|
||||
|
||||
// Delay the audio by 100ms to better match the CTCSS detector output
|
||||
m_inputRB.put(currentSample);
|
||||
m_inputRB.get(currentSample);
|
||||
|
||||
if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) {
|
||||
//Not enough samples to determine if you have CTCSS, just carry on
|
||||
continue;
|
||||
|
@ -462,6 +468,14 @@ void CFM::beginRelaying()
|
|||
m_ackMinTimer.start();
|
||||
}
|
||||
|
||||
void CFM::insertDelay(uint16_t ms)
|
||||
{
|
||||
uint32_t nSamples = ms * 24U;
|
||||
|
||||
for (uint32_t i = 0U; i < nSamples; i++)
|
||||
m_inputRB.put(0);
|
||||
}
|
||||
|
||||
void CFM::insertSilence(uint16_t ms)
|
||||
{
|
||||
uint32_t nSamples = ms * 24U;
|
||||
|
|
3
FM.h
3
FM.h
|
@ -84,6 +84,7 @@ private:
|
|||
q15_t m_rfAudioBoost;
|
||||
CFMDownsampler m_downsampler;
|
||||
q15_t m_rxLevel;
|
||||
CFMRB m_inputRB;
|
||||
CFMRB m_outputRB;
|
||||
|
||||
void stateMachine(bool validSignal);
|
||||
|
@ -99,6 +100,8 @@ private:
|
|||
|
||||
void sendCallsign();
|
||||
void beginRelaying();
|
||||
|
||||
void insertDelay(uint16_t ms);
|
||||
void insertSilence(uint16_t ms);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue