prevent a few errors from happening by changing the sequence
This commit is contained in:
parent
c7fbc8202b
commit
5db5cb9eae
19
owrx/dsp.py
19
owrx/dsp.py
|
|
@ -97,8 +97,6 @@ class ClientDemodulatorChain(Chain):
|
||||||
# it's expected and should be mended when swapping out the demodulator in the next step
|
# it's expected and should be mended when swapping out the demodulator in the next step
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.replace(1, demodulator)
|
|
||||||
|
|
||||||
if self.demodulator is not None:
|
if self.demodulator is not None:
|
||||||
self.demodulator.stop()
|
self.demodulator.stop()
|
||||||
|
|
||||||
|
|
@ -107,7 +105,6 @@ class ClientDemodulatorChain(Chain):
|
||||||
self.selector.setOutputRate(self._getSelectorOutputRate())
|
self.selector.setOutputRate(self._getSelectorOutputRate())
|
||||||
|
|
||||||
clientRate = self._getClientAudioInputRate()
|
clientRate = self._getClientAudioInputRate()
|
||||||
self.clientAudioChain.setInputRate(clientRate)
|
|
||||||
self.demodulator.setSampleRate(clientRate)
|
self.demodulator.setSampleRate(clientRate)
|
||||||
|
|
||||||
if isinstance(self.demodulator, DeemphasisTauChain):
|
if isinstance(self.demodulator, DeemphasisTauChain):
|
||||||
|
|
@ -116,12 +113,15 @@ class ClientDemodulatorChain(Chain):
|
||||||
self._updateDialFrequency()
|
self._updateDialFrequency()
|
||||||
self._syncSquelch()
|
self._syncSquelch()
|
||||||
|
|
||||||
outputRate = self.hdOutputRate if isinstance(self.demodulator, HdAudio) else self.outputRate
|
|
||||||
self.clientAudioChain.setClientRate(outputRate)
|
|
||||||
|
|
||||||
if self.metaWriter is not None and isinstance(demodulator, MetaProvider):
|
if self.metaWriter is not None and isinstance(demodulator, MetaProvider):
|
||||||
demodulator.setMetaWriter(self.metaWriter)
|
demodulator.setMetaWriter(self.metaWriter)
|
||||||
|
|
||||||
|
self.replace(1, demodulator)
|
||||||
|
|
||||||
|
self.clientAudioChain.setInputRate(clientRate)
|
||||||
|
outputRate = self.hdOutputRate if isinstance(self.demodulator, HdAudio) else self.outputRate
|
||||||
|
self.clientAudioChain.setClientRate(outputRate)
|
||||||
|
|
||||||
def stopDemodulator(self):
|
def stopDemodulator(self):
|
||||||
if self.demodulator is None:
|
if self.demodulator is None:
|
||||||
return
|
return
|
||||||
|
|
@ -135,6 +135,8 @@ class ClientDemodulatorChain(Chain):
|
||||||
self.demodulator.stop()
|
self.demodulator.stop()
|
||||||
self.demodulator = None
|
self.demodulator = None
|
||||||
|
|
||||||
|
self.setSecondaryDemodulator(None)
|
||||||
|
|
||||||
def _getSelectorOutputRate(self):
|
def _getSelectorOutputRate(self):
|
||||||
if isinstance(self.demodulator, FixedIfSampleRateChain):
|
if isinstance(self.demodulator, FixedIfSampleRateChain):
|
||||||
return self.demodulator.getFixedIfSampleRate()
|
return self.demodulator.getFixedIfSampleRate()
|
||||||
|
|
@ -167,7 +169,8 @@ class ClientDemodulatorChain(Chain):
|
||||||
|
|
||||||
clientRate = self._getClientAudioInputRate()
|
clientRate = self._getClientAudioInputRate()
|
||||||
self.clientAudioChain.setInputRate(clientRate)
|
self.clientAudioChain.setInputRate(clientRate)
|
||||||
self.demodulator.setSampleRate(clientRate)
|
if self.demodulator is not None:
|
||||||
|
self.demodulator.setSampleRate(clientRate)
|
||||||
|
|
||||||
self._updateDialFrequency()
|
self._updateDialFrequency()
|
||||||
self._syncSquelch()
|
self._syncSquelch()
|
||||||
|
|
@ -212,7 +215,7 @@ class ClientDemodulatorChain(Chain):
|
||||||
self.secondaryFftChain.setWriter(self.secondaryFftWriter)
|
self.secondaryFftChain.setWriter(self.secondaryFftWriter)
|
||||||
|
|
||||||
def _syncSquelch(self):
|
def _syncSquelch(self):
|
||||||
if not self.demodulator.supportsSquelch() or (self.secondaryDemodulator is not None and not self.secondaryDemodulator.supportsSquelch()):
|
if self.demodulator is not None and not self.demodulator.supportsSquelch() or (self.secondaryDemodulator is not None and not self.secondaryDemodulator.supportsSquelch()):
|
||||||
self.selector.setSquelchLevel(-150)
|
self.selector.setSquelchLevel(-150)
|
||||||
else:
|
else:
|
||||||
self.selector.setSquelchLevel(self.squelchLevel)
|
self.selector.setSquelchLevel(self.squelchLevel)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue