From 6887a7d61ec9dd278885f364158fffeee6ed3a4d Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 27 Mar 2018 01:30:44 +0200 Subject: [PATCH] AM demod: removed RTP over UDP. Changed fixed volume factor depending on audio sample rate --- plugins/channelrx/demodam/amdemod.cpp | 1 + plugins/channelrx/demodam/amdemod.h | 2 +- sdrbase/resources/webapi/doc/html2/index.html | 8 +++---- .../webapi/doc/swagger/include/AMDemod.yaml | 4 ++-- .../sdrangel/api/swagger/include/AMDemod.yaml | 4 ++-- swagger/sdrangel/code/html2/index.html | 8 +++---- .../code/qt5/client/SWGAMDemodReport.cpp | 21 +++++++++++++++++++ .../code/qt5/client/SWGAMDemodReport.h | 6 ++++++ .../code/qt5/client/SWGAMDemodSettings.cpp | 21 ------------------- .../code/qt5/client/SWGAMDemodSettings.h | 6 ------ 10 files changed, 41 insertions(+), 40 deletions(-) diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 3b57e7bdd..405f943bb 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -463,5 +463,6 @@ void AMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) response.getAmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); response.getAmDemodReport()->setSquelch(m_squelchOpen ? 1 : 0); response.getAmDemodReport()->setAudioSampleRate(m_audioSampleRate); + response.getAmDemodReport()->setChannelSampleRate(m_inputSampleRate); } diff --git a/plugins/channelrx/demodam/amdemod.h b/plugins/channelrx/demodam/amdemod.h index 6c56bdaba..3fec30633 100644 --- a/plugins/channelrx/demodam/amdemod.h +++ b/plugins/channelrx/demodam/amdemod.h @@ -228,7 +228,7 @@ private: } Real attack = (m_squelchCount - 0.05f * m_audioSampleRate) / (0.05f * m_audioSampleRate); - sample = demod * attack * 2048 * m_settings.m_volume; + sample = demod * attack * (m_audioSampleRate/24) * m_settings.m_volume; if (m_settings.m_copyAudioToUDP) { m_audioNetSink->write(demod * attack * 32768.0f); } diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index d8f56b725..683a5ad7b 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -709,6 +709,9 @@ margin-bottom: 20px; }, "audioSampleRate" : { "type" : "integer" + }, + "channelSampleRate" : { + "type" : "integer" } }, "description" : "AMDemod" @@ -744,9 +747,6 @@ margin-bottom: 20px; "copyAudioToUDP" : { "type" : "integer" }, - "copyAudioUseRTP" : { - "type" : "integer" - }, "udpAddress" : { "type" : "string" }, @@ -18063,7 +18063,7 @@ except ApiException as e:
- Generated 2018-03-26T10:23:40.336+02:00 + Generated 2018-03-27T01:15:44.809+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml index 97eba819b..1aff73c5d 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml @@ -23,8 +23,6 @@ AMDemodSettings: type: integer copyAudioToUDP: type: integer - copyAudioUseRTP: - type: integer udpAddress: type: string udpPort: @@ -46,4 +44,6 @@ AMDemodReport: type: integer audioSampleRate: type: integer + channelSampleRate: + type: integer \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/include/AMDemod.yaml b/swagger/sdrangel/api/swagger/include/AMDemod.yaml index 97eba819b..1aff73c5d 100644 --- a/swagger/sdrangel/api/swagger/include/AMDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/AMDemod.yaml @@ -23,8 +23,6 @@ AMDemodSettings: type: integer copyAudioToUDP: type: integer - copyAudioUseRTP: - type: integer udpAddress: type: string udpPort: @@ -46,4 +44,6 @@ AMDemodReport: type: integer audioSampleRate: type: integer + channelSampleRate: + type: integer \ No newline at end of file diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index d8f56b725..683a5ad7b 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -709,6 +709,9 @@ margin-bottom: 20px; }, "audioSampleRate" : { "type" : "integer" + }, + "channelSampleRate" : { + "type" : "integer" } }, "description" : "AMDemod" @@ -744,9 +747,6 @@ margin-bottom: 20px; "copyAudioToUDP" : { "type" : "integer" }, - "copyAudioUseRTP" : { - "type" : "integer" - }, "udpAddress" : { "type" : "string" }, @@ -18063,7 +18063,7 @@ except ApiException as e:
- Generated 2018-03-26T10:23:40.336+02:00 + Generated 2018-03-27T01:15:44.809+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.cpp b/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.cpp index 145f21228..6ac567b1d 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.cpp @@ -34,6 +34,8 @@ SWGAMDemodReport::SWGAMDemodReport() { m_squelch_isSet = false; audio_sample_rate = 0; m_audio_sample_rate_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; } SWGAMDemodReport::~SWGAMDemodReport() { @@ -48,6 +50,8 @@ SWGAMDemodReport::init() { m_squelch_isSet = false; audio_sample_rate = 0; m_audio_sample_rate_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; } void @@ -55,6 +59,7 @@ SWGAMDemodReport::cleanup() { + } SWGAMDemodReport* @@ -74,6 +79,8 @@ SWGAMDemodReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", ""); + } QString @@ -99,6 +106,9 @@ SWGAMDemodReport::asJsonObject() { if(m_audio_sample_rate_isSet){ obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); } + if(m_channel_sample_rate_isSet){ + obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); + } return obj; } @@ -133,6 +143,16 @@ SWGAMDemodReport::setAudioSampleRate(qint32 audio_sample_rate) { this->m_audio_sample_rate_isSet = true; } +qint32 +SWGAMDemodReport::getChannelSampleRate() { + return channel_sample_rate; +} +void +SWGAMDemodReport::setChannelSampleRate(qint32 channel_sample_rate) { + this->channel_sample_rate = channel_sample_rate; + this->m_channel_sample_rate_isSet = true; +} + bool SWGAMDemodReport::isSet(){ @@ -141,6 +161,7 @@ SWGAMDemodReport::isSet(){ if(m_channel_power_db_isSet){ isObjectUpdated = true; break;} if(m_squelch_isSet){ isObjectUpdated = true; break;} if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;} + if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.h b/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.h index a03ef1633..b0000c43a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodReport.h @@ -50,6 +50,9 @@ public: qint32 getAudioSampleRate(); void setAudioSampleRate(qint32 audio_sample_rate); + qint32 getChannelSampleRate(); + void setChannelSampleRate(qint32 channel_sample_rate); + virtual bool isSet() override; @@ -63,6 +66,9 @@ private: qint32 audio_sample_rate; bool m_audio_sample_rate_isSet; + qint32 channel_sample_rate; + bool m_channel_sample_rate_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp index 00c8b5a9c..0315fd7fe 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.cpp @@ -42,8 +42,6 @@ SWGAMDemodSettings::SWGAMDemodSettings() { m_bandpass_enable_isSet = false; copy_audio_to_udp = 0; m_copy_audio_to_udp_isSet = false; - copy_audio_use_rtp = 0; - m_copy_audio_use_rtp_isSet = false; udp_address = nullptr; m_udp_address_isSet = false; udp_port = 0; @@ -74,8 +72,6 @@ SWGAMDemodSettings::init() { m_bandpass_enable_isSet = false; copy_audio_to_udp = 0; m_copy_audio_to_udp_isSet = false; - copy_audio_use_rtp = 0; - m_copy_audio_use_rtp_isSet = false; udp_address = new QString(""); m_udp_address_isSet = false; udp_port = 0; @@ -95,7 +91,6 @@ SWGAMDemodSettings::cleanup() { - if(udp_address != nullptr) { delete udp_address; } @@ -131,8 +126,6 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(©_audio_to_udp, pJson["copyAudioToUDP"], "qint32", ""); - ::SWGSDRangel::setValue(©_audio_use_rtp, pJson["copyAudioUseRTP"], "qint32", ""); - ::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString"); ::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", ""); @@ -178,9 +171,6 @@ SWGAMDemodSettings::asJsonObject() { if(m_copy_audio_to_udp_isSet){ obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp)); } - if(m_copy_audio_use_rtp_isSet){ - obj->insert("copyAudioUseRTP", QJsonValue(copy_audio_use_rtp)); - } if(udp_address != nullptr && *udp_address != QString("")){ toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString")); } @@ -267,16 +257,6 @@ SWGAMDemodSettings::setCopyAudioToUdp(qint32 copy_audio_to_udp) { this->m_copy_audio_to_udp_isSet = true; } -qint32 -SWGAMDemodSettings::getCopyAudioUseRtp() { - return copy_audio_use_rtp; -} -void -SWGAMDemodSettings::setCopyAudioUseRtp(qint32 copy_audio_use_rtp) { - this->copy_audio_use_rtp = copy_audio_use_rtp; - this->m_copy_audio_use_rtp_isSet = true; -} - QString* SWGAMDemodSettings::getUdpAddress() { return udp_address; @@ -329,7 +309,6 @@ SWGAMDemodSettings::isSet(){ 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(m_copy_audio_use_rtp_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;} diff --git a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h index 0ae295807..338106e48 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGAMDemodSettings.h @@ -63,9 +63,6 @@ public: qint32 getCopyAudioToUdp(); void setCopyAudioToUdp(qint32 copy_audio_to_udp); - qint32 getCopyAudioUseRtp(); - void setCopyAudioUseRtp(qint32 copy_audio_use_rtp); - QString* getUdpAddress(); void setUdpAddress(QString* udp_address); @@ -103,9 +100,6 @@ private: qint32 copy_audio_to_udp; bool m_copy_audio_to_udp_isSet; - qint32 copy_audio_use_rtp; - bool m_copy_audio_use_rtp_isSet; - QString* udp_address; bool m_udp_address_isSet;