Hello William,
PortMidi is a nuisance. I do Pygame development on a Ubuntu derived
Gnu/Linux distribution, and had to build a custom PortMidi library for
use with Pygame.
Lenard Lindstrom
On 13-11-01 01:52 AM, William Heatley wrote:
Python: 2.7.4
PyGame: 1.9.1release
OS: Ubuntu 13.04
Problem:
Any call to the pygame.midi functions which cause PortMidi to return
an error, will cause the entire program to exit (at the C level; no
exceptions reach Python). In the PortMidi interface code, "pm_errmsg"
calls prompt_and_exit. This appears to be because PM_CHECK_ERRORS is
defined. I don't believe it should be. Not defining it will cause
the interface code to return the error codes back to Python, instead
of just printing and exiting.
Suggested Solution:
Do not define PM_CHECK_ERRORS.
Reproduction:
# There must be an input midi device at index 1
# This will cause the porgram to exit immediately, no Exception.
import pygame, pygame.midi
pygame.init ()
pygame.midi.init ()
inp = pygame.midi.Input (1)
inp2 = pygame.midi.Input (1)
~William