From 210163de0aa2c3c5b1cab4d9bf49dffcb07b716a Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 23 Sep 2024 12:05:27 +0200 Subject: [PATCH] Add option to use high-quality voice for ptt --- sbapp/main.py | 13 ++++++++++++- sbapp/sideband/core.py | 2 ++ sbapp/ui/layouts.py | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sbapp/main.py b/sbapp/main.py index 100d91a..6b8ea1a 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1811,7 +1811,11 @@ class SidebandApp(MDApp): return self.sideband.ui_started_recording() - self.audio_msg_mode = LXMF.AM_CODEC2_2400 + if self.sideband.config["hq_ptt"]: + self.audio_msg_mode = LXMF.AM_OPUS_OGG + else: + self.audio_msg_mode = LXMF.AM_CODEC2_2400 + self.message_attach_action(attach_type="audio", nodialog=True) if self.rec_dialog == None: self.message_init_rec_dialog() @@ -2755,6 +2759,10 @@ class SidebandApp(MDApp): self.sideband.config["block_predictive_text"] = self.settings_screen.ids.settings_block_predictive_text.active self.sideband.save_configuration() + def save_hq_ptt(sender=None, event=None): + self.sideband.config["hq_ptt"] = self.settings_screen.ids.settings_hq_ptt.active + self.sideband.save_configuration() + def save_print_command(sender=None, event=None): if not sender.focus: in_cmd = self.settings_screen.ids.settings_print_command.text @@ -2918,6 +2926,9 @@ class SidebandApp(MDApp): self.settings_screen.ids.settings_lxm_limit_1mb.active = self.sideband.config["lxm_limit_1mb"] self.settings_screen.ids.settings_lxm_limit_1mb.bind(active=save_lxm_limit_1mb) + self.settings_screen.ids.settings_hq_ptt.active = self.sideband.config["hq_ptt"] + self.settings_screen.ids.settings_hq_ptt.bind(active=save_hq_ptt) + self.settings_screen.ids.settings_debug.active = self.sideband.config["debug"] self.settings_screen.ids.settings_debug.bind(active=save_debug) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 5d346cd..c4a8938 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -526,6 +526,8 @@ class SidebandCore(): self.config["display_style_in_contact_list"] = False if not "lxm_limit_1mb" in self.config: self.config["lxm_limit_1mb"] = True + if not "hq_ptt" in self.config: + self.config["hq_ptt"] = False if not "input_language" in self.config: self.config["input_language"] = None diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index afe4f01..e332125 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -1678,6 +1678,22 @@ MDScreen: disabled: False active: False + MDBoxLayout: + orientation: "horizontal" + size_hint_y: None + padding: [0,0,dp(24),dp(0)] + height: dp(48) + + MDLabel: + text: "Use high-quality voice for PTT" + font_style: "H6" + + MDSwitch: + id: settings_hq_ptt + pos_hint: {"center_y": 0.3} + disabled: False + active: False + MDBoxLayout: orientation: "horizontal" size_hint_y: None