allow input from file in disctap mode
This commit is contained in:
parent
b9752d54bf
commit
61144fa477
|
@ -124,6 +124,20 @@ class device(object):
|
||||||
|
|
||||||
def init_audio(self, config):
|
def init_audio(self, config):
|
||||||
filename = config['args'].replace('audio:', '')
|
filename = config['args'].replace('audio:', '')
|
||||||
|
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)
|
src = audio.source(self.sample_rate, filename)
|
||||||
gain = 1.0
|
gain = 1.0
|
||||||
if config['gains'].startswith('audio:'):
|
if config['gains'].startswith('audio:'):
|
||||||
|
|
Loading…
Reference in New Issue