mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-14 04:22:28 -04:00
UDP source: Implemented audio input port in input class only
This commit is contained in:
parent
c15b71eb6b
commit
ddd5ec5dc8
@ -46,6 +46,7 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
|||||||
m_outputSampleRate = 48000;
|
m_outputSampleRate = 48000;
|
||||||
m_rfBandwidth = 32000;
|
m_rfBandwidth = 32000;
|
||||||
m_udpPort = 9999;
|
m_udpPort = 9999;
|
||||||
|
m_audioPort = m_udpPort - 1;
|
||||||
m_nco.setFreq(0, m_inputSampleRate);
|
m_nco.setFreq(0, m_inputSampleRate);
|
||||||
m_interpolator.create(16, m_inputSampleRate, m_rfBandwidth / 2.0);
|
m_interpolator.create(16, m_inputSampleRate, m_rfBandwidth / 2.0);
|
||||||
m_sampleDistanceRemain = m_inputSampleRate / m_outputSampleRate;
|
m_sampleDistanceRemain = m_inputSampleRate / m_outputSampleRate;
|
||||||
@ -64,9 +65,9 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
|||||||
m_sampleBufferSSB.resize(udpFftLen);
|
m_sampleBufferSSB.resize(udpFftLen);
|
||||||
UDPFilter = new fftfilt(0.3 / 48.0, 16.0 / 48.0, udpFftLen);
|
UDPFilter = new fftfilt(0.3 / 48.0, 16.0 / 48.0, udpFftLen);
|
||||||
|
|
||||||
if (m_audioSocket->bind(QHostAddress::LocalHost, m_udpPort-1))
|
if (m_audioSocket->bind(QHostAddress::LocalHost, m_audioPort))
|
||||||
{
|
{
|
||||||
qDebug("UDPSrc::UDPSrc: bind audio socket to port %d", m_udpPort - 1);
|
qDebug("UDPSrc::UDPSrc: bind audio socket to port %d", m_audioPort);
|
||||||
connect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
connect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -91,6 +92,7 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
|||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
QString& udpAddress,
|
QString& udpAddress,
|
||||||
int udpPort,
|
int udpPort,
|
||||||
|
int audioPort,
|
||||||
bool audioActive)
|
bool audioActive)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat,
|
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat,
|
||||||
@ -98,6 +100,7 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
|||||||
rfBandwidth,
|
rfBandwidth,
|
||||||
udpAddress,
|
udpAddress,
|
||||||
udpPort,
|
udpPort,
|
||||||
|
audioPort,
|
||||||
audioActive);
|
audioActive);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
@ -284,12 +287,15 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
|||||||
if (cfg.getUDPPort() != m_udpPort)
|
if (cfg.getUDPPort() != m_udpPort)
|
||||||
{
|
{
|
||||||
m_udpPort = cfg.getUDPPort();
|
m_udpPort = cfg.getUDPPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfg.getAudioPort() != m_audioPort)
|
||||||
|
{
|
||||||
disconnect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
disconnect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
||||||
delete m_audioSocket;
|
delete m_audioSocket;
|
||||||
m_audioSocket = new QUdpSocket(this);
|
m_audioSocket = new QUdpSocket(this);
|
||||||
|
|
||||||
if (m_audioSocket->bind(QHostAddress::Any, m_udpPort-1))
|
if (m_audioSocket->bind(QHostAddress::Any, m_audioPort))
|
||||||
{
|
{
|
||||||
connect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
connect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
||||||
}
|
}
|
||||||
@ -334,7 +340,8 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
|||||||
<< " m_boost: " << m_boost
|
<< " m_boost: " << m_boost
|
||||||
<< " m_udpAddress: " << cfg.getUDPAddress()
|
<< " m_udpAddress: " << cfg.getUDPAddress()
|
||||||
<< " m_udpPort: " << m_udpPort
|
<< " m_udpPort: " << m_udpPort
|
||||||
<< " m+audioActive: " << m_audioActive;
|
<< " m_audioPort: " << m_audioPort
|
||||||
|
<< " m_audioActive: " << m_audioActive;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
QString& udpAddress,
|
QString& udpAddress,
|
||||||
int udpPort,
|
int udpPort,
|
||||||
|
int audioPort,
|
||||||
bool audioActive);
|
bool audioActive);
|
||||||
void configureImmediate(MessageQueue* messageQueue,
|
void configureImmediate(MessageQueue* messageQueue,
|
||||||
int boost,
|
int boost,
|
||||||
@ -68,6 +69,7 @@ protected:
|
|||||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||||
const QString& getUDPAddress() const { return m_udpAddress; }
|
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||||
int getUDPPort() const { return m_udpPort; }
|
int getUDPPort() const { return m_udpPort; }
|
||||||
|
int getAudioPort() const { return m_audioPort; }
|
||||||
bool getAudioActive() const { return m_audioActive; }
|
bool getAudioActive() const { return m_audioActive; }
|
||||||
|
|
||||||
static MsgUDPSrcConfigure* create(SampleFormat
|
static MsgUDPSrcConfigure* create(SampleFormat
|
||||||
@ -76,6 +78,7 @@ protected:
|
|||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
QString& udpAddress,
|
QString& udpAddress,
|
||||||
int udpPort,
|
int udpPort,
|
||||||
|
int audioPort,
|
||||||
bool audioActive)
|
bool audioActive)
|
||||||
{
|
{
|
||||||
return new MsgUDPSrcConfigure(sampleFormat,
|
return new MsgUDPSrcConfigure(sampleFormat,
|
||||||
@ -83,6 +86,7 @@ protected:
|
|||||||
rfBandwidth,
|
rfBandwidth,
|
||||||
udpAddress,
|
udpAddress,
|
||||||
udpPort,
|
udpPort,
|
||||||
|
audioPort,
|
||||||
audioActive);
|
audioActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +96,7 @@ protected:
|
|||||||
Real m_rfBandwidth;
|
Real m_rfBandwidth;
|
||||||
QString m_udpAddress;
|
QString m_udpAddress;
|
||||||
int m_udpPort;
|
int m_udpPort;
|
||||||
|
int m_audioPort;
|
||||||
bool m_audioActive;
|
bool m_audioActive;
|
||||||
|
|
||||||
MsgUDPSrcConfigure(SampleFormat sampleFormat,
|
MsgUDPSrcConfigure(SampleFormat sampleFormat,
|
||||||
@ -99,6 +104,7 @@ protected:
|
|||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
QString& udpAddress,
|
QString& udpAddress,
|
||||||
int udpPort,
|
int udpPort,
|
||||||
|
int audioPort,
|
||||||
bool audioActive) :
|
bool audioActive) :
|
||||||
Message(),
|
Message(),
|
||||||
m_sampleFormat(sampleFormat),
|
m_sampleFormat(sampleFormat),
|
||||||
@ -106,6 +112,7 @@ protected:
|
|||||||
m_rfBandwidth(rfBandwidth),
|
m_rfBandwidth(rfBandwidth),
|
||||||
m_udpAddress(udpAddress),
|
m_udpAddress(udpAddress),
|
||||||
m_udpPort(udpPort),
|
m_udpPort(udpPort),
|
||||||
|
m_audioPort(audioPort),
|
||||||
m_audioActive(audioActive)
|
m_audioActive(audioActive)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -171,6 +178,7 @@ protected:
|
|||||||
Real m_rfBandwidth;
|
Real m_rfBandwidth;
|
||||||
QHostAddress m_udpAddress;
|
QHostAddress m_udpAddress;
|
||||||
quint16 m_udpPort;
|
quint16 m_udpPort;
|
||||||
|
quint16 m_audioPort;
|
||||||
int m_boost;
|
int m_boost;
|
||||||
bool m_audioActive;
|
bool m_audioActive;
|
||||||
int m_volume;
|
int m_volume;
|
||||||
|
@ -331,6 +331,7 @@ void UDPSrcGUI::applySettings()
|
|||||||
rfBandwidth,
|
rfBandwidth,
|
||||||
m_udpAddress,
|
m_udpAddress,
|
||||||
udpPort,
|
udpPort,
|
||||||
|
udpPort - 1, // TODO: replace with the audio port
|
||||||
audioActive);
|
audioActive);
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(false);
|
ui->applyBtn->setEnabled(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user