2021-08-31 20:46:11 +00:00
|
|
|
from csdr.chain.demodulator import SecondaryDemodulator, FixedAudioRateChain, DialFrequencyReceiver
|
2021-08-31 14:54:37 +00:00
|
|
|
from owrx.audio.chopper import AudioChopper
|
|
|
|
from pycsdr.modules import Agc, Convert
|
|
|
|
from pycsdr.types import Format
|
|
|
|
|
|
|
|
|
2021-08-31 20:46:11 +00:00
|
|
|
class AudioChopperDemodulator(SecondaryDemodulator, FixedAudioRateChain, DialFrequencyReceiver):
|
2021-08-31 14:54:37 +00:00
|
|
|
# TODO parser typing
|
|
|
|
def __init__(self, mode: str, parser):
|
2021-08-31 20:46:11 +00:00
|
|
|
self.chopper = AudioChopper(mode, parser)
|
|
|
|
workers = [Convert(Format.FLOAT, Format.SHORT), self.chopper]
|
2021-08-31 14:54:37 +00:00
|
|
|
super().__init__(workers)
|
|
|
|
|
|
|
|
def getFixedAudioRate(self):
|
|
|
|
return 12000
|
2021-08-31 20:46:11 +00:00
|
|
|
|
|
|
|
def setDialFrequency(self, frequency: int) -> None:
|
|
|
|
self.chopper.setDialFrequency(frequency)
|