From 6188ba9a950c9e4013db2ad2853e8402333e377b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 18 Nov 2022 15:58:33 +0100 Subject: Lime output: handle different samplerates --- src/output/Lime.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/output/Lime.cpp b/src/output/Lime.cpp index 6f7eed5..593cddb 100644 --- a/src/output/Lime.cpp +++ b/src/output/Lime.cpp @@ -226,14 +226,9 @@ Lime::Lime(SDRDeviceConfig &config) : SDRDevice(), m_conf(config) throw runtime_error("Unsupported interpolate: " + to_string(m_interpolate)); } - if (m_conf.sampleRate != 2048000) - { - throw runtime_error("Lime output only supports native samplerate = 2048000"); - /* The buffer_size calculation below does not take into account resampling */ - } - // Frame duration is 96ms - size_t buffer_size = FRAME_LENGTH * m_interpolate * 10; // We take 10 Frame buffer size Fifo + const size_t samplerate_ratio = m_conf.sampleRate / 2048000; + const size_t buffer_size = FRAME_LENGTH * m_interpolate * samplerate_ratio * 10; // We take 10 Frame buffer size Fifo // Fifo seems to be round to multiple of SampleRate m_tx_stream.channel = m_channel; m_tx_stream.fifoSize = buffer_size; -- cgit v1.2.3