From 9dc09905142ea4fd548920695e2fb3eef0960167 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Thu, 30 Sep 2021 19:12:26 +0100 Subject: [PATCH] Add normalisation switch option. --- file_manager.py | 12 ++++++++++++ server.py | 1 + ui-templates/config_server.html | 11 +++++++++++ web_server.py | 2 ++ 4 files changed, 26 insertions(+) diff --git a/file_manager.py b/file_manager.py index 06af766..df8ea47 100644 --- a/file_manager.py +++ b/file_manager.py @@ -29,6 +29,14 @@ class FileManager: current_process().name = process_title terminator = Terminator() + + self.normalisation_mode = server_config.get()["normalisation_mode"] + + if self.normalisation_mode != "on": + self.logger.log.info("Normalisation is disabled.") + else: + self.logger.log.info("Normalisation is enabled.") + self.channel_count = len(channel_from_q) self.channel_received = None self.last_known_show_plan = [[]] * self.channel_count @@ -211,6 +219,10 @@ class FileManager: # If we've preloaded everything, get to work normalising tracks before playback. def do_normalise(self): + + if self.normalisation_mode != "on": + return False + # Some channels still have files to preload, do nothing. if self.known_channels_preloaded != [True] * self.channel_count: return False # Didn't normalise diff --git a/server.py b/server.py index 82dde6e..aa08889 100644 --- a/server.py +++ b/server.py @@ -71,6 +71,7 @@ class BAPSicleServer: "myradio_api_tracklist_source": "", "running_state": "running", "tracklist_mode": "off", + "normalisation_mode": "on", } player_to_q: List[Queue] = [] diff --git a/ui-templates/config_server.html b/ui-templates/config_server.html index 6c9ee7f..20fd45d 100644 --- a/ui-templates/config_server.html +++ b/ui-templates/config_server.html @@ -48,6 +48,17 @@ Delayed tracklisting is 20s, to account for cueing with fader down.
Fader Live means if a BAPS Controller is present with support, tracklists will trigger only if fader is up.

+
+ + +

+ Normalisation requests significant CPU requirements, if you're finding the CPU usuage is too high / causing audio glitches, disable this feature. +


diff --git a/web_server.py b/web_server.py index 142db8a..ee80e33 100644 --- a/web_server.py +++ b/web_server.py @@ -190,6 +190,7 @@ def ui_config_server(request): "state": server_state.get(), "ser_ports": DeviceManager.getSerialPorts(), "tracklist_modes": ["off", "on", "delayed", "fader-live"], + "normalisation_modes": ["off", "on"], } return render_template("config_server.html", data=data) @@ -221,6 +222,7 @@ def ui_config_server_update(request): "myradio_api_tracklist_source") ) server_state.update("tracklist_mode", request.form.get("tracklist_mode")) + server_state.update("normalisation_mode", request.form.get("normalisation_mode")) return redirect("/restart")