I'm guessing, but s_midi_mmio.c has
static HMIDIOUT hMidiOut[MAXMIDIOUTDEV]; /* output device */
Declaring the array static here makes it visible only to the functions in the file s_midi_mmio.c
Martin
Padraig Kitterick wrote:
Padraig Kitterick wrote:
What I would like to be able to do is to use the device which is selected in PD's midi settings. I've searched the lists but can't seem to find anything related to this. Could anyone tell me how I do this?
That's exactly the device you get when you read/write midi. Am I missing something?
That's what I expected too but no matter what I tried it would never send the midi sysex messages. However, if I added midiOutOpen() and midiOutClose() functions (which I shouldn't have to do as PD will have already opened the midi device) it worked fine.
At first I thought it was because the code was in an external but today I patched the 0.37-1test6 branch and the behaviour was the same: sending the messages without first opening the device didn't work. I had to explicitly open and close the device, which also requires I specify a device number...
As far as I can tell, it all comes down to the midi device handle. Calling the midiOutOpen() sets up the handle to that particular midi device. When I patched the source I made sure I was using the same handle as the other midi functions in the source too so it should work fine.
Just to let you know: the sys_putmidibyte() function which is implemented in 0.37-1test6 is a very similar function (using midiOutShortMsg() instead of midiOutLongMsg()) and it doesn't work either. My guess is that both are using the wrong device handle, or that the handle hasn't been set.