MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI Yoke >> MIDI Yoke NT >> Sysex bug with Midi-yoke NT?
(Message started by: luigi on Jun 6th, 2002, 3:24am)

Title: Sysex bug with Midi-yoke NT?
Post by luigi on Jun 6th, 2002, 3:24am
I've installed MIDI-yoke NT under windows2000 professional: everything worked fine.
After this i've tried to use ports 1 and 2 to send some SYSEX messages between two applications: sometimes it works, sometimes not... :-[

This is what I have understood (maybe it's wrong...):
Using one small app by me, i've seen that the MIDIHDR structure of the SYSEX message arrives with the BytesRecordered field equal to zero: patching my app not to look to this field but searching for the 0xF7 terminator makes the system work again. So i suppose that, at least on my system, every app that is based on the BytesRecordered field will fail. By the way, Logic and SoundDiver seem to work, SyxmidLib don't.

Thank you for any help
     Luigi

Title: Re: Sysex bug with Midi-yoke NT?
Post by Jamie OConnell on Jun 7th, 2002, 4:40am
So you prepare these buffers in your app, hand them off to MIDI Yoke to use for SysEx messages, but when you get them back, the BytesRecorded field is set to 0?

Before I dig in...  You mentioned Sound Diver and Logic.  Does MIDI-OX seem to deal properly with these buffers as well?

What size are you making the buffers and how many of them are you handing off to MIDI Yoke?


Title: Re: Sysex bug with Midi-yoke NT?
Post by luigi on Jun 7th, 2002, 2:22pm
Thanks for your reply.

Yes, I meant exacltly that: if i dump something from "myapp" to Sounddiver everything is ok, but when i dump back the same data to "myapp" the dwBytesRecordered field is 0. The same "myapp" copied to a WindowsME machine (not using MidiYoke but the older Hubi's loopback) works fine.

Now I don't have a Logic to play with... but Sounddiver seems to work properly. Some strange delays in startup have disappered setting all the Yoke outputs to 1 in the win.ini, instead of 7 (what does it mean?)

I'm not a serious midi programmer so be patient if i say something stupid. ;-)  "myapp" is a little app, so now i have 1 1K buffer. The SYSEX i'm speaking of has variable lenght and it is from 50 to 100 bytes (yes, only 100 bytes..)

Bye
Luigi

Title: Re: Sysex bug with Midi-yoke NT?
Post by Jamie OConnell on Jun 8th, 2002, 2:25am

on 06/07/02 at 14:22:28, luigi wrote:
 "myapp" is a little app, so now i have 1 1K buffer. The SYSEX i'm speaking of has variable lenght and it is from 50 to 100 bytes (yes, only 100 bytes..)


I have no idea what the '7's are for in the Logic Win.INI setting?

I don't know if it is of consequence with the results you are seeing, but I strongly suggest you allocate and prepare 2 buffers at the absolute minimum.  With only a single buffer, you cannot keep the driver supplied with space for it to dump it's SysEx and you could (probably will) lose data.  With a 2 buffer system you have a ping-pong effect: where the driver will usually have the spare buffer to work with while your app is processing the filled one.  I say usually because you could still lose data if it is coming in too fast from Sound Diver or whoever.  With MIDI-OX we default to 16 buffers -- each 256 or 512 bytes.


Title: Re: Sysex bug with Midi-yoke NT?
Post by luigi on Jun 8th, 2002, 8:11am
I will try your suggestion with "myapp". But, i suppose that this improvement will allow good management of real life situations, where you have lot os SYSEX, note, controls, etc,  flowing around...
The problem I have seen arises with only 1 single dump, without anything else interfering: no data is loss (in this my simple test situation), only that MIDIHDR field is zero.
I can tell you that the same stuff works under WindowsME.

Any idea?
Thanks
Luigi

Title: Re: Sysex bug with Midi-yoke NT?
Post by Jamie OConnell on Jun 8th, 2002, 1:40pm
Again, I need to ask you if MIDI-OX receives a non-zero buffer?  This will at least indicate if there is a problem on your machine, as opposed to a problem with the driver.

I went and looked at the code.  The only time I set the dwBytesRecorded field to 0 is when buffers are being returned to the application (upon driver close or midiReset()), or when an error is encountered.  Are you checking the return codes for midiBufferAdd()? Possible error codes during midiBufferAdd():
MIDIERR_UNPREPARED    - the memory is not in fixed MME prepared memory.
MIDIERR_STILLPLAYING  - The buffer is already in the queue.

Otherwise dwBytesRecorded will be set either to the size of the full message or dwBufferLength (whichever is less).  If the buffer is too small to contain the full message, the rest is split into successive buffers.

Win 2000 and Win XP have a very different implementation of MME than Win 9x.  Things which might have worked under 9x may not under NT,2000,XP unless they are strictly correct.  This is especially true if you are using a different virtual driver.

So, does MIDI-OX receive your dump from MIDI Yoke OK?

Title: Re: Sysex bug with Midi-yoke NT?
Post by luigi on Jun 15th, 2002, 9:29am
MidiOX receives the dump correctly. When i send it back to "myapp", it receives good data but with the field=0. No errors are produced...

It's my fault? Where?

Luigi

Title: Re: Sysex bug with Midi-yoke NT?
Post by Jamie OConnell on Jun 15th, 2002, 2:41pm
There is no way I can tell you without more information.  I'm pretty busy, but if you want to send me the Source code in question, I'll try to find time to take a look.



MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.