mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Fix complilation on Linux.
This commit is contained in:
@@ -136,9 +136,8 @@ unsigned int CFMControl::readModem(unsigned char* data, unsigned int space)
|
|||||||
if (space > 252U)
|
if (space > 252U)
|
||||||
space = 252U;
|
space = 252U;
|
||||||
|
|
||||||
unsigned short netData[168U]; // Modem can handle up to 168 samples at a time
|
float netData[168U]; // Modem can handle up to 168 samples at a time
|
||||||
unsigned int length = m_network->read((unsigned char*)netData, 168U * sizeof(unsigned short));
|
unsigned int length = m_network->read(netData, 168U);
|
||||||
length /= sizeof(unsigned short);
|
|
||||||
if (length == 0U)
|
if (length == 0U)
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|
||||||
@@ -147,13 +146,8 @@ unsigned int CFMControl::readModem(unsigned char* data, unsigned int space)
|
|||||||
unsigned int nData = 0U;
|
unsigned int nData = 0U;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < length; i++) {
|
for (unsigned int i = 0; i < length; i++) {
|
||||||
unsigned short netSample = SWAP_BYTES_16(netData[i]);
|
// Pre-emphasis
|
||||||
|
float sampleFloat = m_preemphasis->filter(netData[i]);
|
||||||
// Convert the unsigned 16-bit data (+65535 - 0) to float (+1.0 - -1.0)
|
|
||||||
float sampleFloat = (float(netSample) / 32768.0F) - 1.0F;
|
|
||||||
|
|
||||||
//preemphasis
|
|
||||||
sampleFloat = m_preemphasis->filter(sampleFloat);
|
|
||||||
|
|
||||||
// Convert float to 12-bit samples (0 to 4095)
|
// Convert float to 12-bit samples (0 to 4095)
|
||||||
unsigned int sample12bit = (unsigned int)((sampleFloat + 1.0F) * 2048.0F + 0.5F);
|
unsigned int sample12bit = (unsigned int)((sampleFloat + 1.0F) * 2048.0F + 0.5F);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ bool CFMNetwork::open()
|
|||||||
return m_socket.open();
|
return m_socket.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFMNetwork::writeData(const float* data, unsigned int nSamples)
|
bool CFMNetwork::writeData(float* data, unsigned int nSamples)
|
||||||
{
|
{
|
||||||
assert(m_outgoing != NULL);
|
assert(m_outgoing != NULL);
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
@@ -193,9 +193,9 @@ unsigned int CFMNetwork::read(float* data, unsigned int nSamples)
|
|||||||
if (m_sampleRate != 8000U) {
|
if (m_sampleRate != 8000U) {
|
||||||
float in[750U];
|
float in[750U];
|
||||||
|
|
||||||
unsigned int j = 0U;
|
|
||||||
for (unsigned int i = 0U; i < nSamples; i++) {
|
for (unsigned int i = 0U; i < nSamples; i++) {
|
||||||
unsigned short val = ((buffer[j++] & 0xFFU) << 8) + ((buffer[j++] & 0xFFU) << 0);
|
unsigned short val = ((buffer[i * 2U + 0U] & 0xFFU) << 8) +
|
||||||
|
((buffer[i * 2U + 1U] & 0xFFU) << 0);
|
||||||
in[i] = (float(val) - 32768.0F) / 32768.0F;
|
in[i] = (float(val) - 32768.0F) / 32768.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,9 +214,9 @@ unsigned int CFMNetwork::read(float* data, unsigned int nSamples)
|
|||||||
|
|
||||||
return src.output_frames_gen;
|
return src.output_frames_gen;
|
||||||
} else {
|
} else {
|
||||||
unsigned int j = 0U;
|
|
||||||
for (unsigned int i = 0U; i < nSamples; i++) {
|
for (unsigned int i = 0U; i < nSamples; i++) {
|
||||||
unsigned short val = ((buffer[j++] & 0xFFU) << 8) + ((buffer[j++] & 0xFFU) << 0);
|
unsigned short val = ((buffer[i * 2U + 0U] & 0xFFU) << 8) +
|
||||||
|
((buffer[i * 2U + 1U] & 0xFFU) << 0);
|
||||||
data[i] = (float(val) - 32768.0F) / 32768.0F;
|
data[i] = (float(val) - 32768.0F) / 32768.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ public:
|
|||||||
|
|
||||||
void enable(bool enabled);
|
void enable(bool enabled);
|
||||||
|
|
||||||
bool writeData(const float* data, unsigned int nSamples);
|
bool writeData(float* data, unsigned int nSamples);
|
||||||
|
|
||||||
bool writeEOT();
|
bool writeEOT();
|
||||||
|
|
||||||
unsigned int read(float* data, unsigned int nSamples);
|
unsigned int read(float* data, unsigned int nSamples);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -5,11 +5,11 @@ CXX = c++
|
|||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread
|
||||||
LIBS = -lpthread -lutil
|
LIBS = -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread
|
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread
|
||||||
#LIBS = -lpthread -lgps -lutil
|
#LIBS = -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g
|
LDFLAGS = -g
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ CC = gcc
|
|||||||
CXX = g++
|
CXX = g++
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
|
||||||
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil
|
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
|
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
|
||||||
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil
|
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g -L/usr/local/lib
|
LDFLAGS = -g -L/usr/local/lib
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ CC = gcc
|
|||||||
CXX = g++
|
CXX = g++
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
|
||||||
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil
|
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
|
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
|
||||||
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil
|
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g -L/usr/local/lib
|
LDFLAGS = -g -L/usr/local/lib
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ CXX = g++
|
|||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -I/usr/local/include
|
||||||
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil
|
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -I/usr/local/include
|
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -I/usr/local/include
|
||||||
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil
|
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g -L/usr/local/lib
|
LDFLAGS = -g -L/usr/local/lib
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ CXX = g++
|
|||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DOLED -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DOLED -I/usr/local/include
|
||||||
LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lutil
|
LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPS -std=c++0x -pthread -DOLED -I/usr/local/include
|
#CFLAGS = -g -O3 -Wall -DUSE_GPS -std=c++0x -pthread -DOLED -I/usr/local/include
|
||||||
#LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lgps -lutil
|
#LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g -L/usr/local/lib
|
LDFLAGS = -g -L/usr/local/lib
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ CXX = g++
|
|||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
|
||||||
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil
|
LIBS = -lwiringPi -lwiringPiDev -lpthread -lutil -lsamplerate
|
||||||
|
|
||||||
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
# Use the following CFLAGS and LIBS if you do want to use gpsd.
|
||||||
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
|
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
|
||||||
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil
|
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps -lutil -lsamplerate
|
||||||
|
|
||||||
LDFLAGS = -g -L/usr/local/lib
|
LDFLAGS = -g -L/usr/local/lib
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user