Show all host APIs, but only allow selection of some.

This commit is contained in:
Matthew Stratford 2021-04-14 14:39:53 +01:00
parent c797647ebf
commit 6d36df7b43
2 changed files with 8 additions and 6 deletions

View file

@ -31,18 +31,18 @@ class DeviceManager:
host_apis = sd.query_hostapis()
devices: sd.DeviceList = cls._getAudioDevices()
valid_host_apis = []
for host_api_id in range(len(host_apis)):
if isWindows() and host_apis[host_api_id]["name"] not in WINDOWS_APIS:
continue
host_apis[host_api_id]["usable"] = False
else:
host_apis[host_api_id]["usable"] = True
host_api_devices = (device for device in devices if device["hostapi"] == host_api_id)
outputs: List[Dict] = list(filter(cls._isOutput, host_api_devices))
outputs = sorted(outputs, key=lambda k: k["name"])
valid_host_apis.append(host_apis[host_api_id])
valid_host_apis[-1]["output_devices"] = outputs
host_apis[host_api_id]["output_devices"] = outputs
return host_apis

View file

@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block content_inner %}
<h3 class="h5">Audio Outputs</h3>
<p><strong>Please note: Currently BAPSicle does not support choosing which Host API is used. This list is for reference.</strong></p>
<p><strong>Please note: Currently BAPSicle does not support choosing which Host API is used. Only supported options can be selected.</strong></p>
{% for host_api in data.outputs %}
<hr>
@ -9,11 +9,13 @@
<br>
<code>
{% for output in host_api.output_devices %}
{% if host_api.usable %}
Set for:
{% for channel in data.channels %}
<a href="/player/{{channel.channel}}/output/{{output.name}}">Channel {{channel.channel}}</a>
{% endfor %}
- {% if output.name %}{{output.name}}{% else %}System Default Output{% endif %}<br>
-
{% endif %}{% if output.name %}{{output.name}}{% else %}System Default Output{% endif %}<br>
{% endfor %}
</code>
{% endfor %}