| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
""" |
| 8 |
List available PortMidi ports. |
| 9 |
""" |
| 10 |
|
| 11 |
import os |
| 12 |
|
| 13 |
import mido |
| 14 |
|
| 15 |
|
| 16 |
def print_ports(heading, port_names): |
| 17 |
print(heading) |
| 18 |
for name in port_names: |
| 19 |
print(f" '{name}'") |
| 20 |
print() |
| 21 |
|
| 22 |
|
| 23 |
def main(): |
| 24 |
print() |
| 25 |
print_ports('Available input Ports:', mido.get_input_names()) |
| 26 |
print_ports('Available output Ports:', mido.get_output_names()) |
| 27 |
|
| 28 |
for name in ['MIDO_DEFAULT_INPUT', |
| 29 |
'MIDO_DEFAULT_OUTPUT', |
| 30 |
'MIDO_DEFAULT_IOPORT', |
| 31 |
'MIDO_BACKEND']: |
| 32 |
try: |
| 33 |
value = os.environ[name] |
| 34 |
print(f'{name}={value!r}') |
| 35 |
except LookupError: |
| 36 |
print(f'{name} not set.') |
| 37 |
print() |
| 38 |
print(f'Using backend {mido.backend.name}.') |
| 39 |
print() |
| 40 |
|
| 41 |
|
| 42 |
if __name__ == '__main__': |
| 43 |
main() |