restore DRM functionality
This commit is contained in:
14
owrx/drm.py
Normal file
14
owrx/drm.py
Normal file
@ -0,0 +1,14 @@
|
||||
from csdr.module import PopenModule
|
||||
from pycsdr.types import Format
|
||||
|
||||
|
||||
class DrmModule(PopenModule):
|
||||
def getInputFormat(self) -> Format:
|
||||
return Format.COMPLEX_FLOAT
|
||||
|
||||
def getOutputFormat(self) -> Format:
|
||||
return Format.SHORT
|
||||
|
||||
def getCommand(self):
|
||||
# dream -c 6 --sigsrate 48000 --audsrate 48000 -I - -O -
|
||||
return ["dream", "-c", "6", "--sigsrate", "48000", "--audsrate", "48000", "-I", "-", "-O", "-"]
|
@ -13,6 +13,7 @@ from csdr.chain.clientaudio import ClientAudioChain
|
||||
from csdr.chain.analog import NFm, WFm, Am, Ssb
|
||||
from csdr.chain.digiham import DigihamChain, Dmr, Dstar, Nxdn, Ysf
|
||||
from csdr.chain.m17 import M17Chain
|
||||
from csdr.chain.drm import Drm
|
||||
from csdr.chain.fft import FftChain
|
||||
from csdr.chain.digimodes import AudioChopperDemodulator, PacketDemodulator, PocsagDemodulator
|
||||
from pycsdr.modules import Buffer, Writer
|
||||
@ -444,6 +445,8 @@ class DspManager(Output, SdrSourceEventClient):
|
||||
return Nxdn(self.props["digital_voice_codecserver"])
|
||||
elif demod == "m17":
|
||||
return M17Chain()
|
||||
elif demod == "drm":
|
||||
return Drm()
|
||||
|
||||
def setDemodulator(self, mod):
|
||||
demodulator = self._getDemodulator(mod)
|
||||
|
37
owrx/m17.py
37
owrx/m17.py
@ -1,42 +1,13 @@
|
||||
from csdr.module import AutoStartModule
|
||||
from csdr.module import PopenModule
|
||||
from pycsdr.types import Format
|
||||
from subprocess import Popen, PIPE
|
||||
import threading
|
||||
|
||||
|
||||
class M17Module(AutoStartModule):
|
||||
def __init__(self):
|
||||
self.process = None
|
||||
super().__init__()
|
||||
|
||||
class M17Module(PopenModule):
|
||||
def getInputFormat(self) -> Format:
|
||||
return Format.SHORT
|
||||
|
||||
def getOutputFormat(self) -> Format:
|
||||
return Format.SHORT
|
||||
|
||||
def start(self):
|
||||
self.process = Popen(["m17-demod"], stdin=PIPE, stdout=PIPE)
|
||||
threading.Thread(target=self.pump(self.reader.read, self.process.stdin.write)).start()
|
||||
threading.Thread(target=self.pump(self.process.stdout.read, self.writer.write)).start()
|
||||
|
||||
def stop(self):
|
||||
if self.process is not None:
|
||||
self.process.terminate()
|
||||
self.process.wait()
|
||||
self.process = None
|
||||
self.reader.stop()
|
||||
|
||||
def pump(self, read, write):
|
||||
def copy():
|
||||
while True:
|
||||
data = None
|
||||
try:
|
||||
data = read()
|
||||
except ValueError:
|
||||
pass
|
||||
if data is None or isinstance(data, bytes) and len(data) == 0:
|
||||
break
|
||||
write(data)
|
||||
|
||||
return copy
|
||||
def getCommand(self):
|
||||
return ["m17-demod"]
|
||||
|
Reference in New Issue
Block a user