handle property changes on the fft thread

This commit is contained in:
Jakob Ketterl 2019-05-09 16:52:42 +02:00
parent 7550a6294e
commit 6eb37b989f
2 changed files with 18 additions and 13 deletions

View File

@ -251,16 +251,16 @@ class dsp:
return self.demodulator
def set_fft_size(self,fft_size):
#to change this, restart is required
self.fft_size=fft_size
self.restart()
def set_fft_fps(self,fft_fps):
#to change this, restart is required
self.fft_fps=fft_fps
self.restart()
def set_fft_averages(self,fft_averages):
#to change this, restart is required
self.fft_averages=fft_averages
self.restart()
def fft_block_size(self):
if self.fft_averages == 0: return self.samp_rate/self.fft_fps

View File

@ -105,19 +105,24 @@ class SpectrumThread(threading.Thread):
"csdr_dynamic_bufsize", "csdr_print_bufsizes", "csdr_through", "iq_server_port"
)
samp_rate = props["samp_rate"]
fft_size = props["fft_size"]
fft_fps = props["fft_fps"]
fft_voverlap_factor = props["fft_voverlap_factor"]
dsp = csdr.dsp()
dsp.nc_port = props["iq_server_port"]
dsp.set_demodulator("fft")
dsp.set_samp_rate(samp_rate)
dsp.set_fft_size(fft_size)
dsp.set_fft_fps(fft_fps)
dsp.set_fft_averages(int(round(1.0 * samp_rate / fft_size / fft_fps / (1.0 - fft_voverlap_factor))) if fft_voverlap_factor>0 else 0)
dsp.set_fft_compression(props["fft_compression"])
props.getProperty("samp_rate").wire(dsp.set_samp_rate)
props.getProperty("fft_size").wire(dsp.set_fft_size)
props.getProperty("fft_fps").wire(dsp.set_fft_fps)
props.getProperty("fft_compression").wire(dsp.set_fft_compression)
def set_fft_averages(key, value):
samp_rate = props["samp_rate"]
fft_size = props["fft_size"]
fft_fps = props["fft_fps"]
fft_voverlap_factor = props["fft_voverlap_factor"]
dsp.set_fft_averages(int(round(1.0 * samp_rate / fft_size / fft_fps / (1.0 - fft_voverlap_factor))) if fft_voverlap_factor>0 else 0)
props.collect("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages)
set_fft_averages(None, None)
dsp.csdr_dynamic_bufsize = props["csdr_dynamic_bufsize"]
dsp.csdr_print_bufsizes = props["csdr_print_bufsizes"]
dsp.csdr_through = props["csdr_through"]