1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 07:35:47 -05:00

AM demod: removed RTP over UDP. Changed fixed volume factor depending on audio sample rate

This commit is contained in:
f4exb 2018-03-27 01:30:44 +02:00
parent c8a6bb71ba
commit 6887a7d61e
10 changed files with 41 additions and 40 deletions

View File

@ -463,5 +463,6 @@ void AMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
response.getAmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); response.getAmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
response.getAmDemodReport()->setSquelch(m_squelchOpen ? 1 : 0); response.getAmDemodReport()->setSquelch(m_squelchOpen ? 1 : 0);
response.getAmDemodReport()->setAudioSampleRate(m_audioSampleRate); response.getAmDemodReport()->setAudioSampleRate(m_audioSampleRate);
response.getAmDemodReport()->setChannelSampleRate(m_inputSampleRate);
} }

View File

@ -228,7 +228,7 @@ private:
} }
Real attack = (m_squelchCount - 0.05f * m_audioSampleRate) / (0.05f * m_audioSampleRate); 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) { if (m_settings.m_copyAudioToUDP) {
m_audioNetSink->write(demod * attack * 32768.0f); m_audioNetSink->write(demod * attack * 32768.0f);
} }

View File

@ -709,6 +709,9 @@ margin-bottom: 20px;
}, },
"audioSampleRate" : { "audioSampleRate" : {
"type" : "integer" "type" : "integer"
},
"channelSampleRate" : {
"type" : "integer"
} }
}, },
"description" : "AMDemod" "description" : "AMDemod"
@ -744,9 +747,6 @@ margin-bottom: 20px;
"copyAudioToUDP" : { "copyAudioToUDP" : {
"type" : "integer" "type" : "integer"
}, },
"copyAudioUseRTP" : {
"type" : "integer"
},
"udpAddress" : { "udpAddress" : {
"type" : "string" "type" : "string"
}, },
@ -18063,7 +18063,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-03-26T10:23:40.336+02:00 Generated 2018-03-27T01:15:44.809+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,8 +23,6 @@ AMDemodSettings:
type: integer type: integer
copyAudioToUDP: copyAudioToUDP:
type: integer type: integer
copyAudioUseRTP:
type: integer
udpAddress: udpAddress:
type: string type: string
udpPort: udpPort:
@ -46,4 +44,6 @@ AMDemodReport:
type: integer type: integer
audioSampleRate: audioSampleRate:
type: integer type: integer
channelSampleRate:
type: integer

View File

@ -23,8 +23,6 @@ AMDemodSettings:
type: integer type: integer
copyAudioToUDP: copyAudioToUDP:
type: integer type: integer
copyAudioUseRTP:
type: integer
udpAddress: udpAddress:
type: string type: string
udpPort: udpPort:
@ -46,4 +44,6 @@ AMDemodReport:
type: integer type: integer
audioSampleRate: audioSampleRate:
type: integer type: integer
channelSampleRate:
type: integer

View File

@ -709,6 +709,9 @@ margin-bottom: 20px;
}, },
"audioSampleRate" : { "audioSampleRate" : {
"type" : "integer" "type" : "integer"
},
"channelSampleRate" : {
"type" : "integer"
} }
}, },
"description" : "AMDemod" "description" : "AMDemod"
@ -744,9 +747,6 @@ margin-bottom: 20px;
"copyAudioToUDP" : { "copyAudioToUDP" : {
"type" : "integer" "type" : "integer"
}, },
"copyAudioUseRTP" : {
"type" : "integer"
},
"udpAddress" : { "udpAddress" : {
"type" : "string" "type" : "string"
}, },
@ -18063,7 +18063,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-03-26T10:23:40.336+02:00 Generated 2018-03-27T01:15:44.809+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -34,6 +34,8 @@ SWGAMDemodReport::SWGAMDemodReport() {
m_squelch_isSet = false; m_squelch_isSet = false;
audio_sample_rate = 0; audio_sample_rate = 0;
m_audio_sample_rate_isSet = false; m_audio_sample_rate_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
} }
SWGAMDemodReport::~SWGAMDemodReport() { SWGAMDemodReport::~SWGAMDemodReport() {
@ -48,6 +50,8 @@ SWGAMDemodReport::init() {
m_squelch_isSet = false; m_squelch_isSet = false;
audio_sample_rate = 0; audio_sample_rate = 0;
m_audio_sample_rate_isSet = false; m_audio_sample_rate_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
} }
void void
@ -55,6 +59,7 @@ SWGAMDemodReport::cleanup() {
} }
SWGAMDemodReport* SWGAMDemodReport*
@ -74,6 +79,8 @@ SWGAMDemodReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
} }
QString QString
@ -99,6 +106,9 @@ SWGAMDemodReport::asJsonObject() {
if(m_audio_sample_rate_isSet){ if(m_audio_sample_rate_isSet){
obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); obj->insert("audioSampleRate", QJsonValue(audio_sample_rate));
} }
if(m_channel_sample_rate_isSet){
obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
}
return obj; return obj;
} }
@ -133,6 +143,16 @@ SWGAMDemodReport::setAudioSampleRate(qint32 audio_sample_rate) {
this->m_audio_sample_rate_isSet = true; 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 bool
SWGAMDemodReport::isSet(){ SWGAMDemodReport::isSet(){
@ -141,6 +161,7 @@ SWGAMDemodReport::isSet(){
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;} if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
if(m_squelch_isSet){ isObjectUpdated = true; break;} if(m_squelch_isSet){ isObjectUpdated = true; break;}
if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;} if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break;}
}while(false); }while(false);
return isObjectUpdated; return isObjectUpdated;
} }

View File

@ -50,6 +50,9 @@ public:
qint32 getAudioSampleRate(); qint32 getAudioSampleRate();
void setAudioSampleRate(qint32 audio_sample_rate); void setAudioSampleRate(qint32 audio_sample_rate);
qint32 getChannelSampleRate();
void setChannelSampleRate(qint32 channel_sample_rate);
virtual bool isSet() override; virtual bool isSet() override;
@ -63,6 +66,9 @@ private:
qint32 audio_sample_rate; qint32 audio_sample_rate;
bool m_audio_sample_rate_isSet; bool m_audio_sample_rate_isSet;
qint32 channel_sample_rate;
bool m_channel_sample_rate_isSet;
}; };
} }

View File

@ -42,8 +42,6 @@ SWGAMDemodSettings::SWGAMDemodSettings() {
m_bandpass_enable_isSet = false; m_bandpass_enable_isSet = false;
copy_audio_to_udp = 0; copy_audio_to_udp = 0;
m_copy_audio_to_udp_isSet = false; m_copy_audio_to_udp_isSet = false;
copy_audio_use_rtp = 0;
m_copy_audio_use_rtp_isSet = false;
udp_address = nullptr; udp_address = nullptr;
m_udp_address_isSet = false; m_udp_address_isSet = false;
udp_port = 0; udp_port = 0;
@ -74,8 +72,6 @@ SWGAMDemodSettings::init() {
m_bandpass_enable_isSet = false; m_bandpass_enable_isSet = false;
copy_audio_to_udp = 0; copy_audio_to_udp = 0;
m_copy_audio_to_udp_isSet = false; m_copy_audio_to_udp_isSet = false;
copy_audio_use_rtp = 0;
m_copy_audio_use_rtp_isSet = false;
udp_address = new QString(""); udp_address = new QString("");
m_udp_address_isSet = false; m_udp_address_isSet = false;
udp_port = 0; udp_port = 0;
@ -95,7 +91,6 @@ SWGAMDemodSettings::cleanup() {
if(udp_address != nullptr) { if(udp_address != nullptr) {
delete udp_address; delete udp_address;
} }
@ -131,8 +126,6 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&copy_audio_to_udp, pJson["copyAudioToUDP"], "qint32", ""); ::SWGSDRangel::setValue(&copy_audio_to_udp, pJson["copyAudioToUDP"], "qint32", "");
::SWGSDRangel::setValue(&copy_audio_use_rtp, pJson["copyAudioUseRTP"], "qint32", "");
::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString"); ::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString");
::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", ""); ::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
@ -178,9 +171,6 @@ SWGAMDemodSettings::asJsonObject() {
if(m_copy_audio_to_udp_isSet){ if(m_copy_audio_to_udp_isSet){
obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp)); 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("")){ if(udp_address != nullptr && *udp_address != QString("")){
toJsonValue(QString("udpAddress"), udp_address, obj, QString("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; 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* QString*
SWGAMDemodSettings::getUdpAddress() { SWGAMDemodSettings::getUdpAddress() {
return udp_address; return udp_address;
@ -329,7 +309,6 @@ SWGAMDemodSettings::isSet(){
if(m_audio_mute_isSet){ isObjectUpdated = true; break;} if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
if(m_bandpass_enable_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_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(udp_address != nullptr && *udp_address != QString("")){ isObjectUpdated = true; break;}
if(m_udp_port_isSet){ isObjectUpdated = true; break;} if(m_udp_port_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;} if(m_rgb_color_isSet){ isObjectUpdated = true; break;}

View File

@ -63,9 +63,6 @@ public:
qint32 getCopyAudioToUdp(); qint32 getCopyAudioToUdp();
void setCopyAudioToUdp(qint32 copy_audio_to_udp); void setCopyAudioToUdp(qint32 copy_audio_to_udp);
qint32 getCopyAudioUseRtp();
void setCopyAudioUseRtp(qint32 copy_audio_use_rtp);
QString* getUdpAddress(); QString* getUdpAddress();
void setUdpAddress(QString* udp_address); void setUdpAddress(QString* udp_address);
@ -103,9 +100,6 @@ private:
qint32 copy_audio_to_udp; qint32 copy_audio_to_udp;
bool m_copy_audio_to_udp_isSet; bool m_copy_audio_to_udp_isSet;
qint32 copy_audio_use_rtp;
bool m_copy_audio_use_rtp_isSet;
QString* udp_address; QString* udp_address;
bool m_udp_address_isSet; bool m_udp_address_isSet;