Hi,
In addition I tried to update to pygame 2.0.1 however it is the same.
you'll find here after the complete outcome on the terminal:
Python 3.8.2 (default, Nov 4 2020, 21:23:28)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame.midi
pygame 2.0.1 (SDL 2.0.14, Python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.midi.init()
>>> pygame.midi.get_count()
2
>>> pygame.midi.get_device_info(0)
(b'CoreMIDI', b'P\x8eriph\x8erique MIDI USB', 1, 0, 0)
>>> midiin1 = pygame.midi.Input(0)
>>> pygame.midi.get_device_info(0)
(b'CoreMIDI', b'P\x8eriph\x8erique MIDI USB', 1, 0, 1)
>>> midiin1.close()
>>> pygame.midi.get_device_info(0)
(b'CoreMIDI', b'P\x8eriph\x8erique MIDI USB', 1, 0, 1)
>>> midiin1 = pygame.midi.Input(0)
Traceback (most recent call last):
File "", line 1, in
File
"/Users/familleaupepin/Library/Python/3.8/lib/python/site-packages/pygame/midi.py",
line 287, in __init__
self._input = _pypm.Input(device_id, buffer_size)
File "src_c\cython\pygame\pypm.pyx", line 547, in
pygame.pypm.Input.__init__
Exception: b"PortMidi: `Invalid device ID'"
>>>
Sincerely,
Frédéric
Le samedi 9 janvier 2021 à 19:23:16 UTC+1, Frédéric AUPÉPIN a écrit :
> Hi,
>
> I’m a macOS user under Catalina (10.15.7) and I think there might be an
> issue related to the closure of a MIDI Input.
> I have currently Python 3.8.2 and Pygame 2.0.0 with SDL 2.0.12.
>
> The issue is following: if I close a MIDI input it is impossible to reopen
> one afterwards unless I exit Python.
> Here is what I did:
>
> import pygame.midi
> pygame.midi.init()
> pygame.midi.get_count() #to verify that there are MIDI devices
> pygame.midi.get_device_info(0) # verify information of the input (at list
> id 0 was my input) at verify that the input is available
> midiin1 = pygame.midi.Input(0) # everything is fine and can read
> midiin1.close()
> pygame.midi.get_device_info(0) # then it is stated that the device is
> still opened preventing to reopen an Input
> midiin1 = pygame.midi.Input(0) # will return error
>
>
> Sincerely,
>
> Frédéric
>
>