mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 03:54:30 -04:00
AM demod: removed UDP/RTP copy audio entirely
This commit is contained in:
@@ -65,8 +65,6 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
|
||||
|
||||
DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_audioFifo, getInputMessageQueue());
|
||||
m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate();
|
||||
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);
|
||||
applySettings(m_settings, true);
|
||||
@@ -80,7 +78,6 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
|
||||
AMDemod::~AMDemod()
|
||||
{
|
||||
DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_audioFifo);
|
||||
delete m_audioNetSink;
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
@@ -194,7 +191,6 @@ bool AMDemod::handleMessage(const Message& cmd)
|
||||
BasebandSampleSink::MsgThreadedSink& cfg = (BasebandSampleSink::MsgThreadedSink&) cmd;
|
||||
const QThread *thread = cfg.getThread();
|
||||
qDebug("AMDemod::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))
|
||||
@@ -273,9 +269,6 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
|
||||
<< " m_squelch: " << settings.m_squelch
|
||||
<< " m_audioMute: " << settings.m_audioMute
|
||||
<< " m_bandpassEnable: " << settings.m_bandpassEnable
|
||||
<< " m_copyAudioToUDP: " << settings.m_copyAudioToUDP
|
||||
<< " m_udpAddress: " << settings.m_udpAddress
|
||||
<< " m_udpPort: " << settings.m_udpPort
|
||||
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
||||
<< " force: " << force;
|
||||
|
||||
@@ -295,12 +288,6 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
|
||||
m_squelchLevel = pow(10.0, settings.m_squelch / 10.0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
@@ -361,9 +348,6 @@ int AMDemod::webapiSettingsPutPatch(
|
||||
if (channelSettingsKeys.contains("audioMute")) {
|
||||
settings.m_audioMute = response.getAmDemodSettings()->getAudioMute() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("copyAudioToUDP")) {
|
||||
settings.m_copyAudioToUDP = response.getAmDemodSettings()->getCopyAudioToUdp() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset"))
|
||||
{
|
||||
settings.m_inputFrequencyOffset = response.getAmDemodSettings()->getInputFrequencyOffset();
|
||||
@@ -381,12 +365,6 @@ int AMDemod::webapiSettingsPutPatch(
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getAmDemodSettings()->getTitle();
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpAddress")) {
|
||||
settings.m_udpAddress = *response.getAmDemodSettings()->getUdpAddress();
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpPort")) {
|
||||
settings.m_udpPort = response.getAmDemodSettings()->getUdpPort();
|
||||
}
|
||||
if (channelSettingsKeys.contains("volume")) {
|
||||
settings.m_volume = response.getAmDemodSettings()->getVolume();
|
||||
}
|
||||
@@ -429,12 +407,10 @@ int AMDemod::webapiReportGet(
|
||||
void AMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const AMDemodSettings& settings)
|
||||
{
|
||||
response.getAmDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
|
||||
response.getAmDemodSettings()->setCopyAudioToUdp(settings.m_copyAudioToUDP ? 1 : 0);
|
||||
response.getAmDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getAmDemodSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
||||
response.getAmDemodSettings()->setRgbColor(settings.m_rgbColor);
|
||||
response.getAmDemodSettings()->setSquelch(settings.m_squelch);
|
||||
response.getAmDemodSettings()->setUdpPort(settings.m_udpPort);
|
||||
response.getAmDemodSettings()->setVolume(settings.m_volume);
|
||||
response.getAmDemodSettings()->setBandpassEnable(settings.m_bandpassEnable ? 1 : 0);
|
||||
|
||||
@@ -443,12 +419,6 @@ void AMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
|
||||
} else {
|
||||
response.getAmDemodSettings()->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
|
||||
if (response.getAmDemodSettings()->getUdpAddress()) {
|
||||
*response.getAmDemodSettings()->getUdpAddress() = settings.m_udpAddress;
|
||||
} else {
|
||||
response.getAmDemodSettings()->setUdpAddress(new QString(settings.m_udpAddress));
|
||||
}
|
||||
}
|
||||
|
||||
void AMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "dsp/agc.h"
|
||||
#include "dsp/bandpass.h"
|
||||
#include "audio/audiofifo.h"
|
||||
#include "audio/audionetsink.h"
|
||||
#include "util/message.h"
|
||||
#include "amdemodsettings.h"
|
||||
|
||||
@@ -168,7 +167,6 @@ private:
|
||||
AudioVector m_audioBuffer;
|
||||
uint32_t m_audioBufferFill;
|
||||
AudioFifo m_audioFifo;
|
||||
AudioNetSink *m_audioNetSink;
|
||||
|
||||
static const int m_udpBlockSize;
|
||||
|
||||
@@ -227,18 +225,11 @@ private:
|
||||
|
||||
Real attack = (m_squelchCount - 0.05f * m_audioSampleRate) / (0.05f * m_audioSampleRate);
|
||||
sample = demod * attack * (m_audioSampleRate/24) * m_settings.m_volume;
|
||||
if (m_settings.m_copyAudioToUDP) {
|
||||
m_audioNetSink->write(demod * attack * 32768.0f);
|
||||
}
|
||||
|
||||
m_squelchOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sample = 0;
|
||||
if (m_settings.m_copyAudioToUDP) {
|
||||
m_audioNetSink->write(0);
|
||||
}
|
||||
m_squelchOpen = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,12 +173,6 @@ void AMDemodGUI::on_audioMute_toggled(bool checked)
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMDemodGUI::on_copyAudioToUDP_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_copyAudioToUDP = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
|
||||
{
|
||||
/*
|
||||
@@ -194,14 +188,11 @@ void AMDemodGUI::onMenuDialogCalled(const QPoint &p)
|
||||
dialog.exec();
|
||||
|
||||
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_title = m_channelMarker.getTitle();
|
||||
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
displayUDPAddress();
|
||||
|
||||
applySettings();
|
||||
}
|
||||
@@ -296,7 +287,6 @@ void AMDemodGUI::displaySettings()
|
||||
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
setWindowTitle(m_channelMarker.getTitle());
|
||||
displayUDPAddress();
|
||||
|
||||
blockApplySettings(true);
|
||||
|
||||
@@ -314,16 +304,10 @@ void AMDemodGUI::displaySettings()
|
||||
|
||||
ui->audioMute->setChecked(m_settings.m_audioMute);
|
||||
ui->bandpassEnable->setChecked(m_settings.m_bandpassEnable);
|
||||
ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP);
|
||||
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
void AMDemodGUI::displayUDPAddress()
|
||||
{
|
||||
ui->copyAudioToUDP->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_settings.m_udpAddress).arg(m_settings.m_udpPort));
|
||||
}
|
||||
|
||||
void AMDemodGUI::leaveEvent(QEvent*)
|
||||
{
|
||||
m_channelMarker.setHighlighted(false);
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void displaySettings();
|
||||
void displayUDPAddress();
|
||||
|
||||
void leaveEvent(QEvent*);
|
||||
void enterEvent(QEvent*);
|
||||
@@ -71,7 +70,6 @@ private slots:
|
||||
void on_volume_valueChanged(int value);
|
||||
void on_squelch_valueChanged(int value);
|
||||
void on_audioMute_toggled(bool checked);
|
||||
void on_copyAudioToUDP_toggled(bool copy);
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDialogCalled(const QPoint& p);
|
||||
void handleInputMessages();
|
||||
|
||||
@@ -177,19 +177,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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -35,9 +35,6 @@ void AMDemodSettings::resetToDefaults()
|
||||
m_volume = 2.0;
|
||||
m_audioMute = false;
|
||||
m_bandpassEnable = false;
|
||||
m_copyAudioToUDP = false;
|
||||
m_udpAddress = "127.0.0.1";
|
||||
m_udpPort = 9999;
|
||||
m_rgbColor = QColor(255, 255, 0).rgb();
|
||||
m_title = "AM Demodulator";
|
||||
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;
|
||||
|
||||
@@ -29,9 +29,6 @@ struct AMDemodSettings
|
||||
Real m_volume;
|
||||
bool m_audioMute;
|
||||
bool m_bandpassEnable;
|
||||
bool m_copyAudioToUDP;
|
||||
QString m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
Serializable *m_channelMarker;
|
||||
|
||||
@@ -16,15 +16,11 @@ Use the wheels to adjust the frequency shift in Hz from the center frequency of
|
||||
|
||||
Average total power in dB relative to a +/- 1.0 amplitude signal received in the pass band.
|
||||
|
||||
<h3>3: Audio mute</h3>
|
||||
<h3>3: Audio mute and audio output select</h3>
|
||||
|
||||
Use this button to toggle audio mute for this channel. The button will light up in green if the squelch is open. This helps identifying which channels are active in a multi-channel configuration.
|
||||
Left click on this button to toggle audio mute for this channel. The button will light up in green if the squelch is open. This helps identifying which channels are active in a multi-channel configuration.
|
||||
|
||||
<h3>4: UDP output</h3>
|
||||
|
||||
Copies audio output to UDP. Audio is set at fixed level and is muted by the mute button (13) and squelch (9) is also applied. Output is mono S16LE samples.
|
||||
|
||||
UDP address and send port are specified in the basic channel settings. See: [here](https://github.com/f4exb/sdrangel/blob/master/sdrgui/readme.md#6-channels)
|
||||
If you right click on it it will open a dialog to select the audio output device.
|
||||
|
||||
<h3>5: Level meter in dB</h3>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user