fix dial frequencies
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
from pycsdr.modules import Reader
|
||||
from csdr.chain import Chain
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class BaseDemodulatorChain(Chain):
|
||||
def getFixedIfSampleRate(self):
|
||||
return None
|
||||
|
||||
def supportsSquelch(self):
|
||||
def supportsSquelch(self) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
@ -17,14 +13,20 @@ class SecondaryDemodulator(Chain):
|
||||
|
||||
class FixedAudioRateChain(ABC):
|
||||
@abstractmethod
|
||||
def getFixedAudioRate(self):
|
||||
def getFixedAudioRate(self) -> int:
|
||||
pass
|
||||
|
||||
|
||||
class FixedIfSampleRateChain(ABC):
|
||||
@abstractmethod
|
||||
def getFixedIfSampleRate(self):
|
||||
return self.fixedIfSampleRate
|
||||
def getFixedIfSampleRate(self) -> int:
|
||||
pass
|
||||
|
||||
|
||||
class DialFrequencyReceiver(ABC):
|
||||
@abstractmethod
|
||||
def setDialFrequency(self, frequency: int) -> None:
|
||||
pass
|
||||
|
||||
|
||||
# marker interface
|
||||
|
@ -1,14 +1,18 @@
|
||||
from csdr.chain.demodulator import SecondaryDemodulator, FixedAudioRateChain
|
||||
from csdr.chain.demodulator import SecondaryDemodulator, FixedAudioRateChain, DialFrequencyReceiver
|
||||
from owrx.audio.chopper import AudioChopper
|
||||
from pycsdr.modules import Agc, Convert
|
||||
from pycsdr.types import Format
|
||||
|
||||
|
||||
class AudioChopperDemodulator(SecondaryDemodulator, FixedAudioRateChain):
|
||||
class AudioChopperDemodulator(SecondaryDemodulator, FixedAudioRateChain, DialFrequencyReceiver):
|
||||
# TODO parser typing
|
||||
def __init__(self, mode: str, parser):
|
||||
workers = [Convert(Format.FLOAT, Format.SHORT), AudioChopper(mode, parser)]
|
||||
self.chopper = AudioChopper(mode, parser)
|
||||
workers = [Convert(Format.FLOAT, Format.SHORT), self.chopper]
|
||||
super().__init__(workers)
|
||||
|
||||
def getFixedAudioRate(self):
|
||||
return 12000
|
||||
|
||||
def setDialFrequency(self, frequency: int) -> None:
|
||||
self.chopper.setDialFrequency(frequency)
|
||||
|
Reference in New Issue
Block a user