1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-03 09:44:01 -05:00

BFM demod: removed copy to UDP/RTP

This commit is contained in:
f4exb 2018-03-27 00:30:21 +02:00
parent 5e776596b5
commit 6f8d546ab7
7 changed files with 2 additions and 127 deletions

View File

@ -85,9 +85,6 @@ BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI) :
m_audioBufferFill = 0;
DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_audioFifo, getInputMessageQueue());
m_audioNetSink = new AudioNetSink(0); // parent thread allocated dynamically
m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort);
m_audioNetSink->setStereo(true);
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
@ -106,7 +103,6 @@ BFMDemod::~BFMDemod()
}
DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_audioFifo);
delete m_audioNetSink;
m_deviceAPI->removeChannelAPI(this);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
@ -237,12 +233,6 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_deemphasisFilterY.process(ci.real() - sampleStereo, deemph_r);
m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume);
m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume);
if (m_settings.m_copyAudioToUDP)
{
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill].l);
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill].r);
}
}
else
{
@ -251,12 +241,6 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
quint16 sample = (qint16)(deemph * (1<<12) * m_settings.m_volume);
m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample;
if (m_settings.m_copyAudioToUDP)
{
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill].l);
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill].r);
}
}
++m_audioBufferFill;
@ -356,10 +340,6 @@ bool BFMDemod::handleMessage(const Message& cmd)
}
else if (BasebandSampleSink::MsgThreadedSink::match(cmd))
{
BasebandSampleSink::MsgThreadedSink& cfg = (BasebandSampleSink::MsgThreadedSink&) cmd;
const QThread *thread = cfg.getThread();
qDebug("BFMDemod::handleMessage: BasebandSampleSink::MsgThreadedSink: %p", thread);
m_audioNetSink->moveToThread(const_cast<QThread*>(thread)); // use the thread for udp sinks
return true;
}
else if (DSPSignalNotification::match(cmd))
@ -434,7 +414,6 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force)
<< " m_lsbStereo: " << settings.m_lsbStereo
<< " m_showPilot: " << settings.m_showPilot
<< " m_rdsActive: " << settings.m_rdsActive
<< " m_copyAudioToUDP: " << settings.m_copyAudioToUDP
<< " m_udpAddress: " << settings.m_udpAddress
<< " m_udpPort: " << settings.m_udpPort
<< " force: " << force;
@ -496,32 +475,6 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force)
m_deemphasisFilterY.configure(default_deemphasis * settings.m_audioSampleRate * 1.0e-6);
}
if ((settings.m_udpAddress != m_settings.m_udpAddress)
|| (settings.m_udpPort != m_settings.m_udpPort) || force)
{
m_audioNetSink->setDestination(settings.m_udpAddress, settings.m_udpPort);
}
if ((settings.m_copyAudioUseRTP != m_settings.m_copyAudioUseRTP) || force)
{
if (settings.m_copyAudioUseRTP)
{
if (m_audioNetSink->selectType(AudioNetSink::SinkRTP)) {
qDebug("WFMDemod::applySettings: set audio sink to RTP mode");
} else {
qWarning("WFMDemod::applySettings: RTP support for audio sink not available. Fall back too UDP");
}
}
else
{
if (m_audioNetSink->selectType(AudioNetSink::SinkUDP)) {
qDebug("WFMDemod::applySettings: set audio sink to UDP mode");
} else {
qWarning("WFMDemod::applySettings: failed to set audio sink to UDP mode");
}
}
}
m_settings = settings;
}

View File

@ -152,7 +152,6 @@ public:
m_magsqCount = 0;
}
bool isAudioNetSinkRTPCapable() const { return false; }
RDSParser& getRDSParser() { return m_rdsParser; }
static const QString m_channelIdURI;
@ -222,7 +221,6 @@ private:
static const int default_excursion = 750000; // +/- 75 kHz
PhaseDiscriminators m_phaseDiscri;
AudioNetSink *m_audioNetSink;
static const int m_udpBlockSize;

View File

@ -201,18 +201,6 @@ void BFMDemodGUI::on_lsbStereo_toggled(bool lsb)
applySettings();
}
void BFMDemodGUI::on_copyAudioToUDP_toggled(bool copy)
{
m_settings.m_copyAudioToUDP = copy;
applySettings();
}
void BFMDemodGUI::on_useRTP_toggled(bool checked)
{
m_settings.m_copyAudioUseRTP = checked;
applySettings();
}
void BFMDemodGUI::on_showPilot_clicked()
{
m_settings.m_showPilot = ui->showPilot->isChecked();
@ -324,7 +312,6 @@ void BFMDemodGUI::onMenuDialogCalled(const QPoint &p)
setWindowTitle(m_settings.m_title);
setTitleColor(m_settings.m_rgbColor);
displayUDPAddress();
applySettings();
}
@ -381,10 +368,6 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_deviceUISet->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this);
if (!m_bfmDemod->isAudioNetSinkRTPCapable()) {
ui->useRTP->hide();
}
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
@ -407,11 +390,6 @@ BFMDemodGUI::~BFMDemodGUI()
delete ui;
}
void BFMDemodGUI::displayUDPAddress()
{
ui->copyAudioToUDP->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_settings.m_udpAddress).arg(m_settings.m_udpPort));
}
void BFMDemodGUI::blockApplySettings(bool block)
{
m_doApplySettings = !block;
@ -442,7 +420,6 @@ void BFMDemodGUI::displaySettings()
setTitleColor(m_settings.m_rgbColor);
setWindowTitle(m_channelMarker.getTitle());
displayUDPAddress();
blockApplySettings(true);
@ -464,11 +441,6 @@ void BFMDemodGUI::displaySettings()
ui->lsbStereo->setChecked(m_settings.m_lsbStereo);
ui->showPilot->setChecked(m_settings.m_showPilot);
ui->rds->setChecked(m_settings.m_rdsActive);
ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP);
if (m_bfmDemod->isAudioNetSinkRTPCapable()) {
ui->useRTP->setChecked(m_settings.m_copyAudioUseRTP);
}
blockApplySettings(false);
}

View File

@ -80,7 +80,6 @@ private:
void blockApplySettings(bool block);
void applySettings(bool force = false);
void displaySettings();
void displayUDPAddress();
void rdsUpdate(bool force);
void rdsUpdateFixedFields();
@ -108,8 +107,6 @@ private slots:
void on_lsbStereo_toggled(bool lsb);
void on_showPilot_clicked();
void on_rds_clicked();
void on_copyAudioToUDP_toggled(bool copy);
void on_useRTP_toggled(bool checked);
void on_g14ProgServiceNames_currentIndexChanged(int index);
void on_clearData_clicked(bool checked);
void on_g00AltFrequenciesBox_activated(int index);

View File

@ -62,16 +62,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -308,29 +299,6 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="copyAudioToUDP">
<property name="toolTip">
<string>Copy audio to UDP</string>
</property>
<property name="text">
<string>U</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useRTP">
<property name="toolTip">
<string>Use RTP protocol for audio copy to UDP</string>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -541,16 +509,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>

View File

@ -46,8 +46,6 @@ void BFMDemodSettings::resetToDefaults()
m_lsbStereo = false;
m_showPilot = false;
m_rdsActive = false;
m_copyAudioToUDP = false;
m_copyAudioUseRTP = false;
m_udpAddress = "127.0.0.1";
m_udpPort = 9999;
m_rgbColor = QColor(80, 120, 228).rgb();

View File

@ -33,8 +33,6 @@ struct BFMDemodSettings
bool m_lsbStereo;
bool m_showPilot;
bool m_rdsActive;
bool m_copyAudioToUDP;
bool m_copyAudioUseRTP;
QString m_udpAddress;
quint16 m_udpPort;
quint32 m_rgbColor;