aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-11-18 15:58:33 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-11-18 15:58:33 +0100
commit6188ba9a950c9e4013db2ad2853e8402333e377b (patch)
tree81783a352653083422bcecddeb409378b7fe8339 /src/output
parent56e046c3390a15aab4baddb502a490bb4505942a (diff)
downloaddabmod-6188ba9a950c9e4013db2ad2853e8402333e377b.tar.gz
dabmod-6188ba9a950c9e4013db2ad2853e8402333e377b.tar.bz2
dabmod-6188ba9a950c9e4013db2ad2853e8402333e377b.zip
Lime output: handle different samplerates
Diffstat (limited to 'src/output')
-rw-r--r--src/output/Lime.cpp9
1 files changed, 2 insertions, 7 deletions
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;