Skip Menu |

This queue is for tickets about the Win32API-MIDI CPAN distribution.

Report information
The Basics
Id: 104791
Status: open
Priority: 0/
Queue: Win32API-MIDI

People
Owner: Nobody in particular
Requestors: HAYASHI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.05
Fixed in: (no value)



Subject: MIDI input does not work
I have some reports, "MIDI input function does not work. It causes crash after receiving MIDI message." I developed this module in 2002 or 2003. At that time all test including t/midiin.t worked. But I confiremed MIDI input don't work. I tried to debug it but could not make it work. I welcome a fix for this issue. Thanks.
I found the cause. Something about the callback coming from a different thread. perlguts says to call the PERL_SET_CONTEXT macro before anything else. I made these additions to midi.xs, and it stopped crashing: ///////////////////* PerlInterpreter *perl_context; static void CALLBACK midiInProc_wrapper( ... ) { PERL_SET_CONTEXT(perl_context); dSP; ENTER; SAVETMPS; ... midiInOpen( ... ) CODE: { perl_context = Perl_get_context(); switch (dwFlags) { case CALLBACK_NULL: ... *////////////////// I'm sure there's a better way to set perl_context and probably do other things, but since I don't know C/C++ or XS, this is all I could hack out. On Fri May 29 22:46:34 2015, HAYASHI wrote: Show quoted text
> I have some reports, "MIDI input function does not work. It causes > crash after receiving MIDI message." > > I developed this module in 2002 or 2003. At that time all test > including t/midiin.t worked. > > But I confiremed MIDI input don't work. I tried to debug it but could > not make it work. > > I welcome a fix for this issue. > > Thanks.
Thank you for your report. Show quoted text
> I found the cause. Something about the callback coming from a > different thread. perlguts says to call the PERL_SET_CONTEXT macro > before anything else.
This might make sense to me. When I developed this module, Perl was single threaded by default. Show quoted text
> I made these additions to midi.xs, and it stopped crashing:
Do you mean all tests including the MIDI input test passes by adding two lines? I don't have any environment to test this module. I don't have MIDI device now. It it works on your environment, I am happy to release a patched version. Thanks.