pack the client audio processing into its own chain

This commit is contained in:
Jakob Ketterl
2021-07-25 19:31:56 +02:00
parent 223c2d1709
commit 99c7093a1a
5 changed files with 28 additions and 5 deletions

View File

@ -12,7 +12,6 @@ class Am(Chain):
AmDemod(),
DcBlock(),
agc,
Convert(Format.FLOAT, Format.SHORT),
]
super().__init__(*workers)

14
csdr/chain/clientaudio.py Normal file
View File

@ -0,0 +1,14 @@
from csdr.chain import Chain
from pycsdr.modules import AudioResampler, Convert, AdpcmEncoder
from pycsdr.types import Format
class ClientAudioChain(Chain):
def __init__(self, inputRate: int, clientRate: int, compression: str):
workers = []
if inputRate != clientRate:
workers += [AudioResampler(inputRate, clientRate)]
workers += [Convert(Format.FLOAT, Format.SHORT)]
if compression == "adpcm":
workers += [AdpcmEncoder()]
super().__init__(*workers)

View File

@ -13,6 +13,5 @@ class Fm(Chain):
Limit(),
NfmDeemphasis(sampleRate),
agc,
Convert(Format.FLOAT, Format.SHORT),
]
super().__init__(*workers)

View File

@ -10,7 +10,6 @@ class Ssb(Chain):
# empty chain as placeholder for the "last decimation"
Chain(),
Agc(Format.FLOAT),
Convert(Format.FLOAT, Format.SHORT),
]
super().__init__(*workers)