mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-23 20:58:42 -04:00
AM demod: removed UDP/RTP copy audio entirely
This commit is contained in:
parent
3b882e78b4
commit
28cb4e7c3c
doc/img
plugins/channelrx/demodam
amdemod.cppamdemod.hamdemodgui.cppamdemodgui.hamdemodgui.uiamdemodsettings.cppamdemodsettings.hreadme.md
sdrbase/resources/webapi/doc
swagger/sdrangel
api/swagger/include
code
Binary file not shown.
Before ![]() (image error) Size: 18 KiB After ![]() (image error) Size: 17 KiB ![]() ![]() |
Binary file not shown.
@ -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>
|
||||
|
||||
|
@ -744,15 +744,6 @@ margin-bottom: 20px;
|
||||
"type" : "integer",
|
||||
"description" : "use bandpass filter (1 for yes, 0 for no)"
|
||||
},
|
||||
"copyAudioToUDP" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"udpAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"udpPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"rgbColor" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -18054,7 +18045,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-03-28T09:34:59.109+02:00
|
||||
Generated 2018-03-28T09:46:11.248+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,12 +21,6 @@ AMDemodSettings:
|
||||
bandpassEnable:
|
||||
description: use bandpass filter (1 for yes, 0 for no)
|
||||
type: integer
|
||||
copyAudioToUDP:
|
||||
type: integer
|
||||
udpAddress:
|
||||
type: string
|
||||
udpPort:
|
||||
type: integer
|
||||
rgbColor:
|
||||
type: integer
|
||||
title:
|
||||
|
@ -21,12 +21,6 @@ AMDemodSettings:
|
||||
bandpassEnable:
|
||||
description: use bandpass filter (1 for yes, 0 for no)
|
||||
type: integer
|
||||
copyAudioToUDP:
|
||||
type: integer
|
||||
udpAddress:
|
||||
type: string
|
||||
udpPort:
|
||||
type: integer
|
||||
rgbColor:
|
||||
type: integer
|
||||
title:
|
||||
|
@ -744,15 +744,6 @@ margin-bottom: 20px;
|
||||
"type" : "integer",
|
||||
"description" : "use bandpass filter (1 for yes, 0 for no)"
|
||||
},
|
||||
"copyAudioToUDP" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"udpAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"udpPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"rgbColor" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -18054,7 +18045,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-03-28T09:34:59.109+02:00
|
||||
Generated 2018-03-28T09:46:11.248+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -40,12 +40,6 @@ SWGAMDemodSettings::SWGAMDemodSettings() {
|
||||
m_audio_mute_isSet = false;
|
||||
bandpass_enable = 0;
|
||||
m_bandpass_enable_isSet = false;
|
||||
copy_audio_to_udp = 0;
|
||||
m_copy_audio_to_udp_isSet = false;
|
||||
udp_address = nullptr;
|
||||
m_udp_address_isSet = false;
|
||||
udp_port = 0;
|
||||
m_udp_port_isSet = false;
|
||||
rgb_color = 0;
|
||||
m_rgb_color_isSet = false;
|
||||
title = nullptr;
|
||||
@ -70,12 +64,6 @@ SWGAMDemodSettings::init() {
|
||||
m_audio_mute_isSet = false;
|
||||
bandpass_enable = 0;
|
||||
m_bandpass_enable_isSet = false;
|
||||
copy_audio_to_udp = 0;
|
||||
m_copy_audio_to_udp_isSet = false;
|
||||
udp_address = new QString("");
|
||||
m_udp_address_isSet = false;
|
||||
udp_port = 0;
|
||||
m_udp_port_isSet = false;
|
||||
rgb_color = 0;
|
||||
m_rgb_color_isSet = false;
|
||||
title = new QString("");
|
||||
@ -91,11 +79,6 @@ SWGAMDemodSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
if(udp_address != nullptr) {
|
||||
delete udp_address;
|
||||
}
|
||||
|
||||
|
||||
if(title != nullptr) {
|
||||
delete title;
|
||||
}
|
||||
@ -124,12 +107,6 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&bandpass_enable, pJson["bandpassEnable"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(©_audio_to_udp, pJson["copyAudioToUDP"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
|
||||
@ -168,15 +145,6 @@ SWGAMDemodSettings::asJsonObject() {
|
||||
if(m_bandpass_enable_isSet){
|
||||
obj->insert("bandpassEnable", QJsonValue(bandpass_enable));
|
||||
}
|
||||
if(m_copy_audio_to_udp_isSet){
|
||||
obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp));
|
||||
}
|
||||
if(udp_address != nullptr && *udp_address != QString("")){
|
||||
toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString"));
|
||||
}
|
||||
if(m_udp_port_isSet){
|
||||
obj->insert("udpPort", QJsonValue(udp_port));
|
||||
}
|
||||
if(m_rgb_color_isSet){
|
||||
obj->insert("rgbColor", QJsonValue(rgb_color));
|
||||
}
|
||||
@ -247,36 +215,6 @@ SWGAMDemodSettings::setBandpassEnable(qint32 bandpass_enable) {
|
||||
this->m_bandpass_enable_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getCopyAudioToUdp() {
|
||||
return copy_audio_to_udp;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setCopyAudioToUdp(qint32 copy_audio_to_udp) {
|
||||
this->copy_audio_to_udp = copy_audio_to_udp;
|
||||
this->m_copy_audio_to_udp_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAMDemodSettings::getUdpAddress() {
|
||||
return udp_address;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setUdpAddress(QString* udp_address) {
|
||||
this->udp_address = udp_address;
|
||||
this->m_udp_address_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getUdpPort() {
|
||||
return udp_port;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setUdpPort(qint32 udp_port) {
|
||||
this->udp_port = udp_port;
|
||||
this->m_udp_port_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getRgbColor() {
|
||||
return rgb_color;
|
||||
@ -308,9 +246,6 @@ SWGAMDemodSettings::isSet(){
|
||||
if(m_volume_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_bandpass_enable_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_copy_audio_to_udp_isSet){ isObjectUpdated = true; break;}
|
||||
if(udp_address != nullptr && *udp_address != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_udp_port_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
|
||||
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
|
@ -60,15 +60,6 @@ public:
|
||||
qint32 getBandpassEnable();
|
||||
void setBandpassEnable(qint32 bandpass_enable);
|
||||
|
||||
qint32 getCopyAudioToUdp();
|
||||
void setCopyAudioToUdp(qint32 copy_audio_to_udp);
|
||||
|
||||
QString* getUdpAddress();
|
||||
void setUdpAddress(QString* udp_address);
|
||||
|
||||
qint32 getUdpPort();
|
||||
void setUdpPort(qint32 udp_port);
|
||||
|
||||
qint32 getRgbColor();
|
||||
void setRgbColor(qint32 rgb_color);
|
||||
|
||||
@ -97,15 +88,6 @@ private:
|
||||
qint32 bandpass_enable;
|
||||
bool m_bandpass_enable_isSet;
|
||||
|
||||
qint32 copy_audio_to_udp;
|
||||
bool m_copy_audio_to_udp_isSet;
|
||||
|
||||
QString* udp_address;
|
||||
bool m_udp_address_isSet;
|
||||
|
||||
qint32 udp_port;
|
||||
bool m_udp_port_isSet;
|
||||
|
||||
qint32 rgb_color;
|
||||
bool m_rgb_color_isSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user