Add normalisation switch option.

This commit is contained in:
Matthew Stratford 2021-09-30 19:12:26 +01:00
parent 896af0798b
commit 9dc0990514
4 changed files with 26 additions and 0 deletions

View file

@ -29,6 +29,14 @@ class FileManager:
current_process().name = process_title current_process().name = process_title
terminator = Terminator() 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_count = len(channel_from_q)
self.channel_received = None self.channel_received = None
self.last_known_show_plan = [[]] * self.channel_count 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. # If we've preloaded everything, get to work normalising tracks before playback.
def do_normalise(self): def do_normalise(self):
if self.normalisation_mode != "on":
return False
# Some channels still have files to preload, do nothing. # Some channels still have files to preload, do nothing.
if self.known_channels_preloaded != [True] * self.channel_count: if self.known_channels_preloaded != [True] * self.channel_count:
return False # Didn't normalise return False # Didn't normalise

View file

@ -71,6 +71,7 @@ class BAPSicleServer:
"myradio_api_tracklist_source": "", "myradio_api_tracklist_source": "",
"running_state": "running", "running_state": "running",
"tracklist_mode": "off", "tracklist_mode": "off",
"normalisation_mode": "on",
} }
player_to_q: List[Queue] = [] player_to_q: List[Queue] = []

View file

@ -48,6 +48,17 @@
Delayed tracklisting is 20s, to account for cueing with fader down.<br> Delayed tracklisting is 20s, to account for cueing with fader down.<br>
Fader Live means if a BAPS Controller is present with support, tracklists will trigger only if fader is up. Fader Live means if a BAPS Controller is present with support, tracklists will trigger only if fader is up.
</small></p> </small></p>
<br>
<label for="serial_port">Normalisation:</label>
<select class="form-control" name="normalisation_mode">
<label>Modes</label>
{% for mode in data.normalisation_modes %}
<option value="{{mode}}" {% if mode == data.state.normalisation_mode %}selected{% endif %}>{{ mode.capitalize() }}</option>
{% endfor %}
</select>
<p><small>
Normalisation requests significant CPU requirements, if you're finding the CPU usuage is too high / causing audio glitches, disable this feature.
</small></p>
<hr> <hr>
<input type="submit" class="btn btn-primary" value="Save & Restart Server"> <input type="submit" class="btn btn-primary" value="Save & Restart Server">
</form> </form>

View file

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