From d04ab43977bea2cd08c87ef71238c53aa0f81dd1 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 29 May 2021 18:50:17 +0200 Subject: [PATCH] add ability to configure codecserver --- csdr/__init__.py | 15 +++++++++++++-- owrx/controllers/settings/decoding.py | 10 +++++++++- owrx/dsp.py | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/csdr/__init__.py b/csdr/__init__.py index ec51eca..23ffcf9 100644 --- a/csdr/__init__.py +++ b/csdr/__init__.py @@ -86,6 +86,7 @@ class Dsp(DirewolfConfigSubscriber): self.secondary_pipe_names = {"secondary_shift_pipe": Pipe.WRITE} self.secondary_offset_freq = 1000 self.unvoiced_quality = 1 + self.codecserver = None self.modification_lock = threading.Lock() self.output = output @@ -185,10 +186,10 @@ class Dsp(DirewolfConfigSubscriber): if which == "dmr": chain += [ "dmr_decoder --fifo {meta_pipe} --control-fifo {dmr_control_pipe}", - "mbe_synthesizer", + "mbe_synthesizer {codecserver_arg}", ] elif which == "ysf": - chain += ["ysf_decoder --fifo {meta_pipe}", "mbe_synthesizer -y"] + chain += ["ysf_decoder --fifo {meta_pipe}", "mbe_synthesizer -y {codecserver_arg}"] chain += ["digitalvoice_filter"] chain += [ "CSDR_FIXED_BUFSIZE=32 csdr agc_s16 --max 30 --initial 3", @@ -641,6 +642,15 @@ class Dsp(DirewolfConfigSubscriber): def get_unvoiced_quality(self): return self.unvoiced_quality + def set_codecserver(self, s): + if self.codecserver == s: + return + self.codecserver = s + self.restart() + + def get_codecserver_arg(self): + return "-s {}".format(self.codecserver) if self.codecserver else "" + def set_dmr_filter(self, filter): if self.has_pipe("dmr_control_pipe"): self.pipes["dmr_control_pipe"].write("{0}\n".format(filter)) @@ -754,6 +764,7 @@ class Dsp(DirewolfConfigSubscriber): output_rate=self.get_output_rate(), smeter_report_every=int(self.if_samp_rate() / 6000), unvoiced_quality=self.get_unvoiced_quality(), + codecserver_arg=self.get_codecserver_arg(), audio_rate=self.get_audio_rate(), wfm_deemphasis_tau=self.wfm_deemphasis_tau, ) diff --git a/owrx/controllers/settings/decoding.py b/owrx/controllers/settings/decoding.py index 7e72b8e..7387de5 100644 --- a/owrx/controllers/settings/decoding.py +++ b/owrx/controllers/settings/decoding.py @@ -1,8 +1,9 @@ from owrx.controllers.settings import SettingsFormController, SettingsBreadcrumb from owrx.form.section import Section -from owrx.form.input import CheckboxInput, NumberInput, DropdownInput, Js8ProfileCheckboxInput, MultiCheckboxInput, Option +from owrx.form.input import CheckboxInput, NumberInput, DropdownInput, Js8ProfileCheckboxInput, MultiCheckboxInput, Option, TextInput from owrx.form.input.wfm import WfmTauValues from owrx.form.input.wsjt import Q65ModeMatrix, WsjtDecodingDepthsInput +from owrx.form.input.converter import OptionalConverter from owrx.wsjt import Fst4Profile, Fst4wProfile from owrx.breadcrumb import Breadcrumb, BreadcrumbItem @@ -40,6 +41,13 @@ class DecodingSettingsController(SettingsFormController): infotext="Determines the quality, and thus the cpu usage, for the ambe codec used by digital voice" + " modes.
If you're running on a Raspberry Pi (up to 3B+) you should leave this set at 1", ), + TextInput( + "digital_voice_codecserver", + "Codecserver address", + infotext="Address of a remote codecserver instance (name[:port]). Leave empty to use local" + + " codecserver", + converter=OptionalConverter(), + ), CheckboxInput( "digital_voice_dmr_id_lookup", 'Enable lookup of DMR ids in the ' diff --git a/owrx/dsp.py b/owrx/dsp.py index a3acd2d..6df6544 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -72,6 +72,7 @@ class DspManager(Output, SdrSourceEventClient): "start_mod", "start_freq", "wfm_deemphasis_tau", + "digital_voice_codecserver", ), ) @@ -130,6 +131,7 @@ class DspManager(Output, SdrSourceEventClient): self.props.wireProperty("digital_voice_unvoiced_quality", self.dsp.set_unvoiced_quality), self.props.wireProperty("dmr_filter", self.dsp.set_dmr_filter), self.props.wireProperty("wfm_deemphasis_tau", self.dsp.set_wfm_deemphasis_tau), + self.props.wireProperty("digital_voice_codecserver", self.dsp.set_codecserver), self.props.filter("center_freq", "offset_freq").wire(set_dial_freq), ]