From 61144fa477f635e05342c9cddf5185d6b870c509 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 1 Feb 2022 13:33:51 -0500 Subject: [PATCH] allow input from file in disctap mode --- op25/gr-op25_repeater/apps/multi_rx.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/op25/gr-op25_repeater/apps/multi_rx.py b/op25/gr-op25_repeater/apps/multi_rx.py index f58253a..0e00fe0 100755 --- a/op25/gr-op25_repeater/apps/multi_rx.py +++ b/op25/gr-op25_repeater/apps/multi_rx.py @@ -124,7 +124,21 @@ class device(object): def init_audio(self, config): filename = config['args'].replace('audio:', '') - src = audio.source(self.sample_rate, filename) + if filename.startswith('file:'): + filename = filename.replace('file:', '') + repeat = False + s2f = blocks.short_to_float() + K = 1 / 32767.0 + src = blocks.multiply_const_ff(K) + throttle = blocks.throttle(gr.sizeof_short, self.sample_rate) # may be redundant in stdin case ? + if filename == '-': + fd = 0 # stdin + fsrc = blocks.file_descriptor_source(gr.sizeof_short, fd, repeat) + else: + fsrc = blocks.file_source(gr.sizeof_short, filename, repeat) + self.tb.connect(fsrc, throttle, s2f, src) + else: + src = audio.source(self.sample_rate, filename) gain = 1.0 if config['gains'].startswith('audio:'): gain = float(config['gains'].replace('audio:', ''))