1
1
Fork 0
mirror of https://github.com/McSinyx/palace synced 2023-12-14 09:02:59 +01:00
palace/examples/palace-enum.py

46 lines
1.8 KiB
Python
Executable file

#!/usr/bin/env python3
# Enumerate available devices and show their capabilities
# Copyright (C) 2019, 2020 Nguyễn Gia Phong
#
# This file is part of palace.
#
# palace is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# palace is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with palace. If not, see <https://www.gnu.org/licenses/>.
from argparse import ArgumentParser
from palace import device_names, device_name_default, Device
parser = ArgumentParser()
parser.add_argument('device', type=Device, default='', nargs='?',
help='name of device to give extra info')
args = parser.parse_args()
with args.device:
names = device_names.copy()
for kind, default in device_name_default.items():
i = names[kind].index(default)
names[kind][i] += ' [DEFAULT]'
print('Available basic devices:', *names['basic'], sep='\n ')
print('\nAvailable devices:', *names['full'], sep='\n ')
print('\nAvailable capture devices:', *names['capture'], sep='\n ')
print(f'\nInfo of device "{args.device.name["full"]}":')
print('ALC version: {}.{}'.format(*args.device.alc_version))
efx = args.device.efx_version
if efx == (0, 0):
print('EFX not supported!')
else:
print('EFX version: {}.{}'.format(*efx))
print('Max auxiliary sends:', args.device.max_auxiliary_sends)