Roger,
When you change where lpData points to, you fiddle with whatever "magic"
happens you call midiOutPrepareHeader or midiInPrepareHeader.
-Ben Allison
> After a lot of travel, I'm back at work on PortMidi, especially for the
> sysex problems that have been reported. After trying many things, I
> produced the following code where I take what seems to be a perfectly good
> MIDIHDR pointing to sysex data. Note that the "DEBUG CODE" just copies the
> sysex data that's already in place. This works, but if I do everything but
> assigning the lpData pointer, it does not work. I'm testing sending to a
> MIDI Yoke device (MIDI Yoke is a device driver that creates virtual MIDI
> devices allowing applications to interconnect) and monitoring output with
> MIDI Ox (which has a MIDI monitor program) as well as with a new
> PortMidi-based MIDI monitor.
>
> Here's the code segment:
>
> m->hdr->dwBufferLength = m->sysex_byte_count;
>
> /* DEBUG CODE: */
> { int i; int len = m->hdr->dwBufferLength;
> char *newmsg = (char *) malloc(len);
> for (i = 0; i < len; i++) newmsg[i] = m->hdr->lpData[i];
> m->hdr->lpData = newmsg;
> }
>
> m->error = midiOutLongMsg(m->handle.out, m->hdr, sizeof(MIDIHDR));
> if (m->error) rslt = pmHostError;
>
> The block labeled DEBUG CODE just makes a copy of the sysex data, which is
> already on the heap. I've looked at lpData and the data itself with a
> debugger before and after the copy, and I've used the debugger to stop
> execution right after the return from midiOutLongMsg() to make sure
> nothing is corrupting the data, and everything looks ok. If I comment out
> just the "m->hdr->lpData = newmsg" line, this code does not work, so I'm
> really baffled. I suspect something else may be going on with the library,
> drivers, compiler settings, etc., but I can't imagine how just copying
> from one heap location to another could make any difference.
>
> Also, the code seems to work without the heap copy when the device is real
> hardware (a MidiMan 1x1 interface), so there seems to be some interaction
> with the MIDI-OX driver. I'm sending copies of this to midiox.com and my
> neighbor/windows guru, but if you have any suggestions or explanations or
> work-arounds (other than allocating and copying everything on the heap),
> please let me know.
>
> -Roger
>
>
>
> _______________________________________________
> media_api mailing list
> [email protected]
> http://www.create.ucsb.edu/mailman/listinfo/media_api
>
_______________________________________________
media_api mailing list
[email protected]
http://www.create.ucsb.edu/mailman/listinfo/media_api