From 45ea4ed243500f729ca650627d87996206007ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 31 Jan 2021 15:46:58 +0100 Subject: [PATCH] SoapySDR: Support native formats that reports diffrent fullrange values --- .../samplesource/soapysdrinput/soapysdrinputthread.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/samplesource/soapysdrinput/soapysdrinputthread.cpp b/plugins/samplesource/soapysdrinput/soapysdrinputthread.cpp index 298d91f6d..b37986482 100644 --- a/plugins/samplesource/soapysdrinput/soapysdrinputthread.cpp +++ b/plugins/samplesource/soapysdrinput/soapysdrinputthread.cpp @@ -100,11 +100,13 @@ void SoapySDRInputThread::run() qDebug("SoapySDRInputThread::run: format: %s fullScale: %f", format.c_str(), fullScale); - if ((format == "CS8") && (fullScale == 128.0)) { // 8 bit signed - native + // Older version of soapy and it's plugins were incorrectly reporting + // (1 << n) instead (1 << n) - 1. Accept both values. + if ((format == "CS8") && (fullScale == 127.0 || fullScale == 128.0)) { // 8 bit signed - native m_decimatorType = Decimator8; - } else if ((format == "CS16") && (fullScale == 2048.0)) { // 12 bit signed - native + } else if ((format == "CS16") && (fullScale == 2047.0 || fullScale == 2048.0)) { // 12 bit signed - native m_decimatorType = Decimator12; - } else if ((format == "CS16") && (fullScale == 32768.0)) { // 16 bit signed - native + } else if ((format == "CS16") && (fullScale == 32767.0 || fullScale == 32768.0 )) { // 16 bit signed - native m_decimatorType = Decimator16; } else { // for other types make a conversion to float m_decimatorType = DecimatorFloat;