restore live switching capability for fft compression
This commit is contained in:
parent
c89394822a
commit
d869c5ee2d
17
owrx/fft.py
17
owrx/fft.py
@ -52,17 +52,26 @@ class SpectrumThread(SdrSourceEventClient):
|
|||||||
self.props.wireProperty("samp_rate", self.dsp.setSampleRate),
|
self.props.wireProperty("samp_rate", self.dsp.setSampleRate),
|
||||||
self.props.wireProperty("fft_fps", self.dsp.setFps),
|
self.props.wireProperty("fft_fps", self.dsp.setFps),
|
||||||
self.props.wireProperty("fft_voverlap_factor", self.dsp.setVOverlapFactor),
|
self.props.wireProperty("fft_voverlap_factor", self.dsp.setVOverlapFactor),
|
||||||
self.props.wireProperty("fft_compression", self.dsp.setCompression),
|
self.props.wireProperty("fft_compression", self._setCompression),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if self.sdrSource.isAvailable():
|
||||||
|
self.dsp.setReader(self.sdrSource.getBuffer().getReader())
|
||||||
|
|
||||||
|
def _setCompression(self, compression):
|
||||||
|
if self.reader:
|
||||||
|
self.reader.stop()
|
||||||
|
try:
|
||||||
|
self.dsp.setCompression(compression)
|
||||||
|
except ValueError:
|
||||||
|
# expected since the compressions have different formats
|
||||||
|
pass
|
||||||
|
|
||||||
buffer = Buffer(self.dsp.getOutputFormat())
|
buffer = Buffer(self.dsp.getOutputFormat())
|
||||||
self.dsp.setWriter(buffer)
|
self.dsp.setWriter(buffer)
|
||||||
self.reader = buffer.getReader()
|
self.reader = buffer.getReader()
|
||||||
threading.Thread(target=self.dsp.pump(self.reader.read, self.sdrSource.writeSpectrumData)).start()
|
threading.Thread(target=self.dsp.pump(self.reader.read, self.sdrSource.writeSpectrumData)).start()
|
||||||
|
|
||||||
if self.sdrSource.isAvailable():
|
|
||||||
self.dsp.setReader(self.sdrSource.getBuffer().getReader())
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self.dsp is None:
|
if self.dsp is None:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user