Skip to content

Added shim to fix portmidi break #2863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src_c/cython/pygame/pypm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ cdef extern from "portmidi.h":
PmDeviceID inputDevice,
void *inputDriverInfo,
long bufferSize,
long (*PmPtr) (), # long = PtTimestamp
PmTimeProcPtr time_proc, # long = PtTimestamp
void *time_info)

PmError Pm_OpenOutput(PortMidiStream** stream,
PmDeviceID outputDevice,
void *outputDriverInfo,
long bufferSize,
#long (*PmPtr) (), # long = PtTimestamp
PmTimeProcPtr time_proc, # long = PtTimestamp
void *time_info,
long latency)
Expand Down Expand Up @@ -521,6 +520,11 @@ cdef class Output:
while Pt_Time() == cur_time:
pass

# in commit 64314cc3d1a6fdddfc6ff5408a3f83af685b8cea
# portmidi changed the signature of Pt_Time from `PMEXPORT PtTimestamp Pt_Time()` to `PMEXPORT PtTimestamp Pt_Time(void)`
# this change is significant in that no args in a C function declaration is treated differently than void
cdef PtTimestamp pgCompat_Pt_Time(void* arg) noexcept:
return Pt_Time()

cdef class Input:
"""Represents an input MIDI stream device.
Expand All @@ -542,7 +546,7 @@ cdef class Input:
self.debug = 0

err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
&Pt_Time, NULL)
&pgCompat_Pt_Time, NULL)
if err < 0:
raise Exception(Pm_GetErrorText(err))

Expand Down
Loading