1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-13 20:01:46 -05:00

SSB demod: removed UDP/RTP copy audio entirely

This commit is contained in:
f4exb 2018-03-28 09:27:47 +02:00
parent 814764eeee
commit 4501066426
10 changed files with 3 additions and 60 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

View File

@ -144,13 +144,11 @@ To avoid unwanted squelch opening on short transient bursts only signals wilth p
When the power threshold is close to the noise floor a few milliseconds help in preventing noise power wiggle to open the squelch. When the power threshold is close to the noise floor a few milliseconds help in preventing noise power wiggle to open the squelch.
<h3>12: Copy audio to UDP</h3> <h3>13: Audio mute and audio output select</h3>
Copies audio output to UDP. Output is mono S16LE samples regardless of binaural/monaural operation. Left click on this button to toggle audio mute for this channel.
<h3>13: Audio mute</h3> If you right click on it a dialog will open to select the audio output device.
Use this button to toggle audio mute for this channel.
<h3>14: Spectrum display</h3> <h3>14: Spectrum display</h3>

View File

@ -38,7 +38,6 @@ MESSAGE_CLASS_DEFINITION(SSBDemod::MsgConfigureChannelizer, Message)
const QString SSBDemod::m_channelIdURI = "de.maintech.sdrangelove.channel.ssb"; const QString SSBDemod::m_channelIdURI = "de.maintech.sdrangelove.channel.ssb";
const QString SSBDemod::m_channelId = "SSBDemod"; const QString SSBDemod::m_channelId = "SSBDemod";
const int SSBDemod::m_udpBlockSize = 512;
SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) : SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
ChannelSinkAPI(m_channelIdURI), ChannelSinkAPI(m_channelIdURI),
@ -87,9 +86,6 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen); SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen);
DSBFilter = new fftfilt((2.0f * m_Bandwidth) / m_audioSampleRate, 2 * ssbFftLen); DSBFilter = new fftfilt((2.0f * m_Bandwidth) / m_audioSampleRate, 2 * ssbFftLen);
m_audioNetSink = new AudioNetSink(0); // parent thread allocated dynamically - no RTP
m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort);
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true); applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true); applySettings(m_settings, true);
@ -104,7 +100,6 @@ SSBDemod::~SSBDemod()
if (SSBFilter) delete SSBFilter; if (SSBFilter) delete SSBFilter;
if (DSBFilter) delete DSBFilter; if (DSBFilter) delete DSBFilter;
DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_audioFifo); DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_audioFifo);
delete m_audioNetSink;
m_deviceAPI->removeChannelAPI(this); m_deviceAPI->removeChannelAPI(this);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer); m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
@ -220,8 +215,6 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{ {
m_audioBuffer[m_audioBufferFill].r = 0; m_audioBuffer[m_audioBufferFill].r = 0;
m_audioBuffer[m_audioBufferFill].l = 0; m_audioBuffer[m_audioBufferFill].l = 0;
if (m_settings.m_copyAudioToUDP) { m_audioNetSink->write(0); }
} }
else else
{ {
@ -237,8 +230,6 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].real() * m_volume * agcVal); m_audioBuffer[m_audioBufferFill].r = (qint16)(sideband[i].real() * m_volume * agcVal);
m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].imag() * m_volume * agcVal); m_audioBuffer[m_audioBufferFill].l = (qint16)(sideband[i].imag() * m_volume * agcVal);
} }
if (m_settings.m_copyAudioToUDP) { m_audioNetSink->write(m_audioBuffer[m_audioBufferFill].r + m_audioBuffer[m_audioBufferFill].l); }
} }
else else
{ {
@ -246,8 +237,6 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
qint16 sample = (qint16)(demod * m_volume * agcVal); qint16 sample = (qint16)(demod * m_volume * agcVal);
m_audioBuffer[m_audioBufferFill].l = sample; m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample; m_audioBuffer[m_audioBufferFill].r = sample;
if (m_settings.m_copyAudioToUDP) { m_audioNetSink->write(sample); }
} }
} }
@ -332,7 +321,6 @@ bool SSBDemod::handleMessage(const Message& cmd)
BasebandSampleSink::MsgThreadedSink& cfg = (BasebandSampleSink::MsgThreadedSink&) cmd; BasebandSampleSink::MsgThreadedSink& cfg = (BasebandSampleSink::MsgThreadedSink&) cmd;
const QThread *thread = cfg.getThread(); const QThread *thread = cfg.getThread();
qDebug("SSBDemod::handleMessage: BasebandSampleSink::MsgThreadedSink: %p", thread); qDebug("SSBDemod::handleMessage: BasebandSampleSink::MsgThreadedSink: %p", thread);
m_audioNetSink->moveToThread(const_cast<QThread*>(thread)); // use the thread for udp sinks
return true; return true;
} }
else if (DSPConfigureAudio::match(cmd)) else if (DSPConfigureAudio::match(cmd))
@ -428,7 +416,6 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force)
<< " m_audioFlipChannels: " << settings.m_audioFlipChannels << " m_audioFlipChannels: " << settings.m_audioFlipChannels
<< " m_dsb: " << settings.m_dsb << " m_dsb: " << settings.m_dsb
<< " m_audioMute: " << settings.m_audioMute << " m_audioMute: " << settings.m_audioMute
<< " m_copyAudioToUDP: " << settings.m_copyAudioToUDP
<< " m_agcActive: " << settings.m_agc << " m_agcActive: " << settings.m_agc
<< " m_agcClamping: " << settings.m_agcClamping << " m_agcClamping: " << settings.m_agcClamping
<< " m_agcTimeLog2: " << settings.m_agcTimeLog2 << " m_agcTimeLog2: " << settings.m_agcTimeLog2
@ -522,12 +509,6 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force)
<< " agcClamping: " << agcClamping; << " agcClamping: " << agcClamping;
} }
if ((m_settings.m_udpAddress != settings.m_udpAddress)
|| (m_settings.m_udpPort != settings.m_udpPort) || force)
{
m_audioNetSink->setDestination(settings.m_udpAddress, settings.m_udpPort);
}
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
{ {
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();

View File

@ -276,8 +276,6 @@ private:
uint m_audioBufferFill; uint m_audioBufferFill;
AudioFifo m_audioFifo; AudioFifo m_audioFifo;
quint32 m_audioSampleRate; quint32 m_audioSampleRate;
AudioNetSink *m_audioNetSink;
static const int m_udpBlockSize;
QMutex m_settingsMutex; QMutex m_settingsMutex;

View File

@ -222,12 +222,6 @@ void SSBDemodGUI::on_flipSidebands_clicked(bool checked __attribute__((unused)))
ui->lowCut->setValue(-lcValue); ui->lowCut->setValue(-lcValue);
} }
void SSBDemodGUI::on_copyAudioToUDP_toggled(bool checked)
{
m_settings.m_copyAudioToUDP = checked;
applySettings();
}
void SSBDemodGUI::onMenuDialogCalled(const QPoint &p) void SSBDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
@ -235,14 +229,11 @@ void SSBDemodGUI::onMenuDialogCalled(const QPoint &p)
dialog.exec(); dialog.exec();
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_title = m_channelMarker.getTitle();
setWindowTitle(m_settings.m_title); setWindowTitle(m_settings.m_title);
setTitleColor(m_settings.m_rgbColor); setTitleColor(m_settings.m_rgbColor);
displayUDPAddress();
applySettings(); applySettings();
} }
@ -486,7 +477,6 @@ void SSBDemodGUI::displaySettings()
setTitleColor(m_settings.m_rgbColor); setTitleColor(m_settings.m_rgbColor);
setWindowTitle(m_channelMarker.getTitle()); setWindowTitle(m_channelMarker.getTitle());
displayUDPAddress();
blockApplySettings(true); blockApplySettings(true);
@ -541,16 +531,10 @@ void SSBDemodGUI::displaySettings()
ui->agcThresholdGate->setValue(m_settings.m_agcThresholdGate); ui->agcThresholdGate->setValue(m_settings.m_agcThresholdGate);
s = QString::number(ui->agcThresholdGate->value(), 'f', 0); s = QString::number(ui->agcThresholdGate->value(), 'f', 0);
ui->agcThresholdGateText->setText(s); ui->agcThresholdGateText->setText(s);
ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP);
blockApplySettings(false); blockApplySettings(false);
} }
void SSBDemodGUI::displayUDPAddress()
{
ui->copyAudioToUDP->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_settings.m_udpAddress).arg(m_settings.m_udpPort));
}
void SSBDemodGUI::displayAGCPowerThreshold(int value) void SSBDemodGUI::displayAGCPowerThreshold(int value)
{ {
if (value == SSBDemodSettings::m_minPowerThresholdDB) if (value == SSBDemodSettings::m_minPowerThresholdDB)

View File

@ -72,7 +72,6 @@ private:
void applySettings(bool force = false); void applySettings(bool force = false);
void applyBandwidths(bool force = false); void applyBandwidths(bool force = false);
void displaySettings(); void displaySettings();
void displayUDPAddress();
void displayAGCPowerThreshold(int value); void displayAGCPowerThreshold(int value);
@ -95,7 +94,6 @@ private slots:
void on_audioMute_toggled(bool checked); void on_audioMute_toggled(bool checked);
void on_spanLog2_valueChanged(int value); void on_spanLog2_valueChanged(int value);
void on_flipSidebands_clicked(bool checked); void on_flipSidebands_clicked(bool checked);
void on_copyAudioToUDP_toggled(bool copy);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void handleInputMessages(); void handleInputMessages();

View File

@ -854,16 +854,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="ButtonSwitch" name="copyAudioToUDP">
<property name="toolTip">
<string>Copy audio to UDP</string>
</property>
<property name="text">
<string>U</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="audioMute"> <widget class="QToolButton" name="audioMute">
<property name="toolTip"> <property name="toolTip">

View File

@ -44,7 +44,6 @@ void SSBDemodSettings::resetToDefaults()
m_audioMute = false; m_audioMute = false;
m_agc = false; m_agc = false;
m_agcClamping = false; m_agcClamping = false;
m_copyAudioToUDP = false;
m_agcPowerThreshold = -40; m_agcPowerThreshold = -40;
m_agcThresholdGate = 4; m_agcThresholdGate = 4;
m_agcTimeLog2 = 7; m_agcTimeLog2 = 7;
@ -53,8 +52,6 @@ void SSBDemodSettings::resetToDefaults()
m_volume = 3.0; m_volume = 3.0;
m_spanLog2 = 3; m_spanLog2 = 3;
m_inputFrequencyOffset = 0; m_inputFrequencyOffset = 0;
m_udpAddress = "127.0.0.1";
m_udpPort = 9999;
m_rgbColor = QColor(0, 255, 0).rgb(); m_rgbColor = QColor(0, 255, 0).rgb();
m_title = "SSB Demodulator"; m_title = "SSB Demodulator";
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;

View File

@ -32,14 +32,11 @@ struct SSBDemodSettings
bool m_audioFlipChannels; bool m_audioFlipChannels;
bool m_dsb; bool m_dsb;
bool m_audioMute; bool m_audioMute;
bool m_copyAudioToUDP;
bool m_agc; bool m_agc;
bool m_agcClamping; bool m_agcClamping;
int m_agcTimeLog2; int m_agcTimeLog2;
int m_agcPowerThreshold; int m_agcPowerThreshold;
int m_agcThresholdGate; int m_agcThresholdGate;
QString m_udpAddress;
quint16 m_udpPort;
quint32 m_rgbColor; quint32 m_rgbColor;
QString m_title; QString m_title;
QString m_audioDeviceName; QString m_audioDeviceName;