mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-28 21:12:26 -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_rfBandwidth = 32000;
|
||||
m_udpPort = 9999;
|
||||
m_audioPort = m_udpPort - 1;
|
||||
m_nco.setFreq(0, m_inputSampleRate);
|
||||
m_interpolator.create(16, m_inputSampleRate, m_rfBandwidth / 2.0);
|
||||
m_sampleDistanceRemain = m_inputSampleRate / m_outputSampleRate;
|
||||
@ -64,9 +65,9 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
||||
m_sampleBufferSSB.resize(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()));
|
||||
}
|
||||
else
|
||||
@ -91,6 +92,7 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat,
|
||||
@ -98,6 +100,7 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
||||
rfBandwidth,
|
||||
udpAddress,
|
||||
udpPort,
|
||||
audioPort,
|
||||
audioActive);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
@ -284,12 +287,15 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
if (cfg.getUDPPort() != m_udpPort)
|
||||
{
|
||||
m_udpPort = cfg.getUDPPort();
|
||||
}
|
||||
|
||||
if (cfg.getAudioPort() != m_audioPort)
|
||||
{
|
||||
disconnect(m_audioSocket, SIGNAL(readyRead()), this, SLOT(audioReadyRead()));
|
||||
delete m_audioSocket;
|
||||
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()));
|
||||
}
|
||||
@ -334,7 +340,8 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
<< " m_boost: " << m_boost
|
||||
<< " m_udpAddress: " << cfg.getUDPAddress()
|
||||
<< " m_udpPort: " << m_udpPort
|
||||
<< " m+audioActive: " << m_audioActive;
|
||||
<< " m_audioPort: " << m_audioPort
|
||||
<< " m_audioActive: " << m_audioActive;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive);
|
||||
void configureImmediate(MessageQueue* messageQueue,
|
||||
int boost,
|
||||
@ -68,6 +69,7 @@ protected:
|
||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||
int getUDPPort() const { return m_udpPort; }
|
||||
int getAudioPort() const { return m_audioPort; }
|
||||
bool getAudioActive() const { return m_audioActive; }
|
||||
|
||||
static MsgUDPSrcConfigure* create(SampleFormat
|
||||
@ -76,6 +78,7 @@ protected:
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive)
|
||||
{
|
||||
return new MsgUDPSrcConfigure(sampleFormat,
|
||||
@ -83,6 +86,7 @@ protected:
|
||||
rfBandwidth,
|
||||
udpAddress,
|
||||
udpPort,
|
||||
audioPort,
|
||||
audioActive);
|
||||
}
|
||||
|
||||
@ -92,6 +96,7 @@ protected:
|
||||
Real m_rfBandwidth;
|
||||
QString m_udpAddress;
|
||||
int m_udpPort;
|
||||
int m_audioPort;
|
||||
bool m_audioActive;
|
||||
|
||||
MsgUDPSrcConfigure(SampleFormat sampleFormat,
|
||||
@ -99,6 +104,7 @@ protected:
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive) :
|
||||
Message(),
|
||||
m_sampleFormat(sampleFormat),
|
||||
@ -106,6 +112,7 @@ protected:
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_udpAddress(udpAddress),
|
||||
m_udpPort(udpPort),
|
||||
m_audioPort(audioPort),
|
||||
m_audioActive(audioActive)
|
||||
{ }
|
||||
};
|
||||
@ -171,6 +178,7 @@ protected:
|
||||
Real m_rfBandwidth;
|
||||
QHostAddress m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
quint16 m_audioPort;
|
||||
int m_boost;
|
||||
bool m_audioActive;
|
||||
int m_volume;
|
||||
|
@ -331,6 +331,7 @@ void UDPSrcGUI::applySettings()
|
||||
rfBandwidth,
|
||||
m_udpAddress,
|
||||
udpPort,
|
||||
udpPort - 1, // TODO: replace with the audio port
|
||||
audioActive);
|
||||
|
||||
ui->applyBtn->setEnabled(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user