[PD-dev] MIDI output devices
Padraig Kitterick
padraigkitterick at oceanfree.net
Mon Feb 23 20:43:42 CET 2004
I agree. When I gave up on the external and patched the source I added
my own function sys_midisysexout() to s_midi_mmio.c, added the function
declaration to the s_stuff.h header file and added my sysexout object
next to the midiout object in x_midi.c
Technically I should then have access to the 'hMidiOut' handle, but I
only think that handle means something immediately after you call
midiOutOpen() within the same function. Otherwise it is just an empty
struct (this would also explain why sys_putmidibyte() isn't working either).
Obviously if I need to call midiOutOpen() I need a device number, which
is where the problem starts.
One thing I noticed: when you open pd's midi settings dialog it always
lists the currently selected output device first. I could use
midi_getdevs() to grab this first device id and use it in midiOutOpen().
Fingers crossed!
_Padraig
Martin Peach wrote:
> 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.
>
>
>
>
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://iem.at/cgi-bin/mailman/listinfo/pd-dev
>
>
More information about the Pd-dev
mailing list