Skip to content

Commit

Permalink
Merge pull request pygame-community#2863 from oddbookworm/fix-portmid…
Browse files Browse the repository at this point in the history
…i-compile-issue

Added shim to fix portmidi break
  • Loading branch information
MyreMylar authored May 24, 2024
2 parents 0d1e826 + 985514f commit 1aa950b
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit 1aa950b

Please sign in to comment.