Merge pull request #39 from UniversityRadioYork/mstratford/norm-switch
Add normalisation switch.
This commit is contained in:
commit
31532b67a0
4 changed files with 25 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -71,6 +71,7 @@ class BAPSicleServer:
|
|||
"myradio_api_tracklist_source": "",
|
||||
"running_state": "running",
|
||||
"tracklist_mode": "off",
|
||||
"normalisation_mode": "off",
|
||||
}
|
||||
|
||||
player_to_q: List[Queue] = []
|
||||
|
|
|
@ -48,6 +48,16 @@
|
|||
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.
|
||||
</small></p>
|
||||
<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. <code>ffmpeg</code> or <code>avconf</code> required.
|
||||
</small></p>
|
||||
<hr>
|
||||
<input type="submit" class="btn btn-primary" value="Save & Restart Server">
|
||||
</form>
|
||||
|
|
|
@ -196,6 +196,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)
|
||||
|
||||
|
@ -227,6 +228,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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue