diff --git a/devices/bladerf/CMakeLists.txt b/devices/bladerf/CMakeLists.txt index 8482f74ac..1d698cbdd 100644 --- a/devices/bladerf/CMakeLists.txt +++ b/devices/bladerf/CMakeLists.txt @@ -3,12 +3,14 @@ project(bladerfdevice) set(bladerfdevice_SOURCES devicebladerf.cpp devicebladerfvalues.cpp + devicebladerfshared.cpp ) set(bladerfdevice_HEADERS devicebladerf.h devicebladerfvalues.h devicebladerfparam.h + devicebladerfshared.h ) if (BUILD_DEBIAN) diff --git a/devices/bladerf/devicebladerfshared.cpp b/devices/bladerf/devicebladerfshared.cpp new file mode 100644 index 000000000..636318a00 --- /dev/null +++ b/devices/bladerf/devicebladerfshared.cpp @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2017 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "devicebladerfshared.h" + +const float DeviceBladeRFShared::m_sampleFifoLengthInSeconds = 0.25; +const int DeviceBladeRFShared::m_sampleFifoMinSize = 75000; // 300 kS/s knee +const int DeviceBladeRFShared::m_sampleFifoMinSize32 = 150000; // Fixed for interpolation by 32 diff --git a/devices/bladerf/devicebladerfshared.h b/devices/bladerf/devicebladerfshared.h new file mode 100644 index 000000000..4ad706744 --- /dev/null +++ b/devices/bladerf/devicebladerfshared.h @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2017 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef DEVICES_BLADERF_DEVICEHACKRFSHARED_H_ +#define DEVICES_BLADERF_DEVICEHACKRFSHARED_H_ + +#include "util/message.h" + +class DeviceBladeRFShared +{ +public: + static const float m_sampleFifoLengthInSeconds; + static const int m_sampleFifoMinSize; + static const int m_sampleFifoMinSize32; +}; + + +#endif /* DEVICES_BLADERF_DEVICEHACKRFSHARED_H_ */ diff --git a/devices/devices.pro b/devices/devices.pro index f6cc17a76..650455714 100644 --- a/devices/devices.pro +++ b/devices/devices.pro @@ -45,7 +45,8 @@ CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug !macx:SOURCES += bladerf/devicebladerf.cpp\ - bladerf/devicebladerfvalues.cpp + bladerf/devicebladerfvalues.cpp\ + bladerf/devicebladerfshared.cpp SOURCES += hackrf/devicehackrf.cpp\ hackrf/devicehackrfvalues.cpp\ @@ -57,7 +58,8 @@ CONFIG(MINGW64)SOURCES += limesdr/devicelimesdr.cpp\ !macx:HEADERS -= bladerf/devicebladerf.h\ bladerf/devicebladerfparam.h\ - bladerf/devicebladerfvalues.h + bladerf/devicebladerfvalues.h\ + bladerf/devicebladerfshared.h HEADERS += hackrf/devicehackrf.h\ hackrf/devicehackrfparam.h\ diff --git a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp index 5aac4c161..35f03e07a 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp +++ b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp @@ -23,6 +23,7 @@ #include "dsp/dspengine.h" #include "device/devicesinkapi.h" #include "device/devicesourceapi.h" +#include "bladerf/devicebladerfshared.h" #include "bladerfoutput.h" #include "bladerfoutputgui.h" @@ -243,10 +244,20 @@ bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool fo if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force) { - // FIFO size: - // 1 s length up to interpolation by 16 - // 2 s for interpolation by 32 - m_sampleSourceFifo.resize(settings.m_devSampleRate/(1<<(settings.m_log2Interp <= 4 ? settings.m_log2Interp : 4))); + int fifoSize; + + if (settings.m_log2Interp == 5) + { + fifoSize = DeviceBladeRFShared::m_sampleFifoMinSize32; + } + else + { + fifoSize = std::max( + (int) ((settings.m_devSampleRate/(1<