Skip to content

Commit 1aa950b

Browse files
authored
Merge pull request pygame-community#2863 from oddbookworm/fix-portmidi-compile-issue
Added shim to fix portmidi break
2 parents 0d1e826 + 985514f commit 1aa950b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src_c/cython/pygame/pypm.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,13 @@ cdef extern from "portmidi.h":
106106
PmDeviceID inputDevice,
107107
void *inputDriverInfo,
108108
long bufferSize,
109-
long (*PmPtr) (), # long = PtTimestamp
109+
PmTimeProcPtr time_proc, # long = PtTimestamp
110110
void *time_info)
111111

112112
PmError Pm_OpenOutput(PortMidiStream** stream,
113113
PmDeviceID outputDevice,
114114
void *outputDriverInfo,
115115
long bufferSize,
116-
#long (*PmPtr) (), # long = PtTimestamp
117116
PmTimeProcPtr time_proc, # long = PtTimestamp
118117
void *time_info,
119118
long latency)
@@ -521,6 +520,11 @@ cdef class Output:
521520
while Pt_Time() == cur_time:
522521
pass
523522

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

525529
cdef class Input:
526530
"""Represents an input MIDI stream device.
@@ -542,7 +546,7 @@ cdef class Input:
542546
self.debug = 0
543547

544548
err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
545-
&Pt_Time, NULL)
549+
&pgCompat_Pt_Time, NULL)
546550
if err < 0:
547551
raise Exception(Pm_GetErrorText(err))
548552

0 commit comments

Comments
 (0)