3

miditest.py

import sys, os, time, traceback
import ctypes
import pygame.midi
import winreg

pygame.midi.init()
try:
    print(pygame.midi.get_device_info(1))
    m = pygame.midi.Input(1)
    print('Device opened for testing. Use ctrl-c to quit.')
    while True:
        while m.poll():
            print(m.read(1))
        time.sleep(0.1)
except:
    m.close()
pygame.midi.quit()

This is part of the code of midi2vjoy, it is used to test midi input for later configuration. the line

m = pygame.midi.Input(1)

causes the output

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
(b'MMSystem', b'DDJ-200', 1, 0, 0)
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Current thread 0x00003b98 (most recent call first):
  File "D:\Python\Python38\lib\site-packages\pygame\midi.py", line 280 in __init__
  File "miditest.py", line 9 in <module>

as you can see before the error a midi device exists at that device index and it is an input device. The line 280 in midi.py is

self._input = _pypm.Input(device_id, buffer_size)
user4676310
  • 383
  • 1
  • 3
  • 12
  • 4
    I noticed you are using python 3.8 and pygame 1.9.6. Upgrade to pygame 2.0.0.dev6 with `pip install pygame==2.0.0.dev6`. Maybe it has nothing to do with this particular error but I think it's worth trying because I also had some errors with this combo of versions, and updating to this pygame version resolved it. – kaktus_car Apr 28 '20 at 12:06
  • 2
    @kaktus_car That actually solved the issue thanks a lot – user4676310 Apr 28 '20 at 12:38
  • Glad it did! You're welcome. – kaktus_car Apr 28 '20 at 13:56
  • @kaktuz_car you should add it as answer below :), solved it for me too! – ribbit Jun 28 '20 at 03:30

0 Answers0