1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

BFM demod: fixed squelch to be compatible with server mode

This commit is contained in:
f4exb 2018-05-29 00:14:45 +02:00
parent a8966789c0
commit f11cda633d
3 changed files with 34 additions and 22 deletions

View File

@ -145,26 +145,26 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_magsqCount++;
// m_movingAverage.feed(msq);
if(m_magsq >= m_squelchLevel) {
m_squelchState = m_settings.m_rfBandwidth / 20; // decay rate
}
if(m_squelchState > 0)
if (msq >= m_squelchLevel)
{
m_squelchState--;
//demod = phaseDiscriminator2(rf[i], msq);
demod = m_phaseDiscri.phaseDiscriminator(rf[i]);
if (m_squelchState < m_settings.m_rfBandwidth / 10) { // twice attack and decay rate
m_squelchState++;
}
}
else
{
if (m_squelchState > 0) {
m_squelchState--;
}
}
if (m_squelchState > m_settings.m_rfBandwidth / 20) { // squelch open
demod = m_phaseDiscri.phaseDiscriminator(rf[i]);
} else {
demod = 0;
}
if (!m_settings.m_showPilot)
{
if (!m_settings.m_showPilot) {
m_sampleBuffer.push_back(Sample(demod * SDR_RX_SCALEF, 0.0));
}
@ -179,8 +179,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_rdsDemod.process(cr.real(), bit))
{
if (m_rdsDecoder.frameSync(bit))
{
if (m_rdsDecoder.frameSync(bit)) {
m_rdsParser.parseGroup(m_rdsDecoder.getGroup());
}
}
@ -197,8 +196,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{
m_pilotPLL.process(demod, m_pilotPLLSamples);
if (m_settings.m_showPilot)
{
if (m_settings.m_showPilot) {
m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * SDR_RX_SCALEF, 0.0)); // debug 38 kHz pilot
}

View File

@ -543,12 +543,15 @@ void AudioDeviceManager::setOutputDeviceInfo(int outputDeviceIndex, const Output
if (!getOutputDeviceInfo(deviceName, oldDeviceInfo))
{
qDebug("AudioDeviceManager::setOutputDeviceInfo: unknown device %s", qPrintable(deviceName));
qInfo("AudioDeviceManager::setOutputDeviceInfo: unknown device %s", qPrintable(deviceName));
}
m_audioOutputInfos[deviceName] = deviceInfo;
if (m_audioOutputs.find(outputDeviceIndex) == m_audioOutputs.end()) { // no FIFO registered yet hence no audio output has been allocated yet
if (m_audioOutputs.find(outputDeviceIndex) == m_audioOutputs.end())
{
qWarning("AudioDeviceManager::setOutputDeviceInfo: index: %d device: %s no FIFO registered yet hence no audio output has been allocated yet",
outputDeviceIndex, qPrintable(deviceName));
return;
}
@ -575,6 +578,9 @@ void AudioDeviceManager::setOutputDeviceInfo(int outputDeviceIndex, const Output
audioOutput->setUdpUseRTP(deviceInfo.udpUseRTP);
audioOutput->setUdpChannelMode(deviceInfo.udpChannelMode);
audioOutput->setUdpChannelFormat(deviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo, deviceInfo.sampleRate);
qDebug("AudioDeviceManager::setOutputDeviceInfo: index: %d device: %s updated",
outputDeviceIndex, qPrintable(deviceName));
}
void AudioDeviceManager::unsetOutputDeviceInfo(int outputDeviceIndex)

View File

@ -301,6 +301,10 @@ def setupChannel(deviceset_url, options):
if r is None:
exit(-1)
# ======================================================================
def channelsReport(deviceset_url):
report = callAPI(deviceset_url + "/channels/report", "GET", None, None, "Get channels report")
# ======================================================================
def main():
@ -311,9 +315,6 @@ def main():
base_url = "http://%s/sdrangel" % options.address
deviceset_url = "/deviceset/%d" % options.device_index
if options.audio_name:
setup_audio(options)
if options.create:
r = callAPI("/deviceset", "POST", {"tx": 0}, None, "Add Rx device set")
if r is None:
@ -326,6 +327,13 @@ def main():
if r is None:
exit(-1)
if options.audio_name:
time.sleep(1)
setup_audio(options)
# if options.channel_id == "BFMDemod":
# channelsReport(deviceset_url)
except Exception, msg:
tb = traceback.format_exc()
print >> sys.stderr, tb