mirror of https://github.com/g4klx/MMDVMHost
Merge pull request #586 from F4FXL/FM_Ext
Some network stuff, still WIP
This commit is contained in:
commit
143652b7f2
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#define EMPHASIS_GAIN_DB 0 //Gain needs to be the same for pre an deeemphasis
|
#define EMPHASIS_GAIN_DB 0 //Gain needs to be the same for pre an deeemphasis
|
||||||
#define RF_AUDIO_SAMP_RATE 8000
|
#define RF_AUDIO_SAMP_RATE 8000
|
||||||
|
#define FM_AUDIO_BLOCK_SIZE 240
|
||||||
|
|
||||||
CFMControl::CFMControl(CFMNetwork* network) :
|
CFMControl::CFMControl(CFMNetwork* network) :
|
||||||
m_network(network),
|
m_network(network),
|
||||||
|
|
@ -55,14 +56,16 @@ bool CFMControl::writeModem(const unsigned char* data, unsigned int length)
|
||||||
|
|
||||||
m_incomingRFAudio.addData(data + 1U, length - 1U);
|
m_incomingRFAudio.addData(data + 1U, length - 1U);
|
||||||
unsigned int bufferLength = m_incomingRFAudio.dataSize();
|
unsigned int bufferLength = m_incomingRFAudio.dataSize();
|
||||||
|
if(bufferLength > 255U)
|
||||||
|
bufferLength = 255U;
|
||||||
|
|
||||||
if (bufferLength >= 3U) {
|
if (bufferLength >= 3U) {
|
||||||
bufferLength = bufferLength - bufferLength % 3U; //round down to nearest multiple of 3
|
bufferLength = bufferLength - bufferLength % 3U; //round down to nearest multiple of 3
|
||||||
unsigned char bufferData[bufferLength];
|
unsigned char bufferData[255];
|
||||||
m_incomingRFAudio.getData(bufferData, bufferLength);
|
m_incomingRFAudio.getData(bufferData, bufferLength);
|
||||||
|
|
||||||
// Unpack the serial data into float values.
|
// Unpack the serial data into float values.
|
||||||
for (unsigned int i = 0U; i < length; i += 3U) {
|
for (unsigned int i = 0U; i < bufferLength; i += 3U) {
|
||||||
unsigned short sample1 = 0U;
|
unsigned short sample1 = 0U;
|
||||||
unsigned short sample2 = 0U;
|
unsigned short sample2 = 0U;
|
||||||
unsigned int MASK = 0x00000FFFU;
|
unsigned int MASK = 0x00000FFFU;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue