mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-04-05 14:37:02 +00:00
Add input audio delay to match the CTCSS decoder results.
This commit is contained in:
parent
fa29a27695
commit
3bb7cde322
2 changed files with 17 additions and 0 deletions
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue