mirror of https://github.com/g4klx/MMDVM.git
Move downsamplig call back to samples
This commit is contained in:
parent
e957f0154e
commit
66de35b6d8
14
FM.cpp
14
FM.cpp
|
@ -21,7 +21,8 @@
|
||||||
#include "FM.h"
|
#include "FM.h"
|
||||||
|
|
||||||
const uint16_t FM_TX_BLOCK_SIZE = 400U;
|
const uint16_t FM_TX_BLOCK_SIZE = 400U;
|
||||||
const uint16_t FM_SERIAL_BLOCK_SIZE = 126U;
|
const uint16_t FM_SERIAL_BLOCK_SIZE = 42U;//this is actually the number of sample pairs to send over serial. One sample pair is 3bytes.
|
||||||
|
//three times this vqlue shall never exceed 126 !
|
||||||
|
|
||||||
CFM::CFM() :
|
CFM::CFM() :
|
||||||
m_callsign(),
|
m_callsign(),
|
||||||
|
@ -117,6 +118,9 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
||||||
// Only let RF audio through when relaying RF audio
|
// Only let RF audio through when relaying RF audio
|
||||||
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||||
currentSample = m_blanking.process(currentSample);
|
currentSample = m_blanking.process(currentSample);
|
||||||
|
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
||||||
|
m_downsampler.addSample(currentSample);
|
||||||
|
|
||||||
currentSample *= currentBoost;
|
currentSample *= currentBoost;
|
||||||
} else {
|
} else {
|
||||||
currentSample = 0;
|
currentSample = 0;
|
||||||
|
@ -166,15 +170,17 @@ void CFM::process()
|
||||||
m_outputRFRB.get(sample);
|
m_outputRFRB.get(sample);
|
||||||
samples[i] = sample;
|
samples[i] = sample;
|
||||||
|
|
||||||
if(m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF)) {
|
if(m_extEnabled) {
|
||||||
m_downsampler.addSample(sample);
|
|
||||||
uint16_t downSamplerLength = m_downsampler.getData();
|
uint16_t downSamplerLength = m_downsampler.getData();
|
||||||
|
|
||||||
if(downSamplerLength >= FM_SERIAL_BLOCK_SIZE) {
|
if(downSamplerLength >= FM_SERIAL_BLOCK_SIZE) {
|
||||||
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
|
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
|
||||||
|
|
||||||
for(uint16_t j = 0U; j < downSamplerLength; j++) {
|
for(uint16_t j = 0U; j < downSamplerLength; j++) {
|
||||||
m_downsampler.getPackedData(serialSamples[j]);
|
m_downsampler.getPackedData(serialSamples[j]);
|
||||||
}
|
}
|
||||||
serial.writeFMData((uint8_t*)serialSamples, txLength * sizeof(TSamplePairPack));
|
|
||||||
|
serial.writeFMData((uint8_t*)serialSamples, downSamplerLength * sizeof(TSamplePairPack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue