Restore silence

This commit is contained in:
Geoffrey Merck 2020-05-12 14:45:03 +02:00
parent d23c0900c1
commit b64712f657
2 changed files with 13 additions and 37 deletions

49
FM.cpp
View File

@ -181,43 +181,6 @@ void CFM::process()
io.write(STATE_FM, samples, txLength);
}
// if (space > 2 && length >= FM_TX_BLOCK_SIZE ) {
// if(length > FM_TX_BLOCK_SIZE)
// length = FM_TX_BLOCK_SIZE;
// if(space > FM_TX_BLOCK_SIZE)
// space = FM_TX_BLOCK_SIZE;
// if(length > space)
// length = space;
// q15_t samples[FM_TX_BLOCK_SIZE];
// for(uint16_t i = 0U; i < length; i++) {
// q15_t sample = 0;
// m_outputRFRB.get(sample);
// samples[i] = sample;
// }
// io.write(STATE_FM, samples, length);
// }
// if (m_extEnabled) {
// length = m_downsampler.getData();
// //Write audio to serial
// if (length >= FM_SERIAL_BLOCK_SIZE) {
// if(length > FM_SERIAL_BLOCK_SIZE)
// length = FM_SERIAL_BLOCK_SIZE;
// TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
// for(uint16_t i = 0U; i < length; i++) {
// TSamplePairPack samplePair = {0U, 0U, 0U};
// m_downsampler.getPackedData(samplePair);
// serialSamples[i] = samplePair;
// }
// serial.writeFMData((uint8_t*)&serialSamples, length * sizeof(TSamplePairPack));
// }
// }
}
void CFM::reset()
@ -386,6 +349,8 @@ void CFM::listeningState(bool validRFSignal, bool validExtSignal)
sendCallsign();
}
insertDelay(50U);
beginRelaying();
m_callsignTimer.start();
@ -406,6 +371,8 @@ void CFM::listeningState(bool validRFSignal, bool validExtSignal)
sendCallsign();
}
insertDelay(50U);
beginRelaying();
m_callsignTimer.start();
@ -757,3 +724,11 @@ void CFM::insertDelay(uint16_t ms)
m_inputRFRB.put(0);
}
void CFM::insertSilence(uint16_t ms)
{
uint32_t nSamples = ms * 24U;
for (uint32_t i = 0U; i < nSamples; i++)
m_outputRFRB.put(0);
}

1
FM.h
View File

@ -120,6 +120,7 @@ private:
void beginRelaying();
void insertDelay(uint16_t ms);
void insertSilence(uint16_t ms);
};
#endif