Hi Roger,

1. PM_CHECK_ERRORS is defined in Windows portmidi.vcproj library. Maybe it should have different tragets for console and windows apps.

There are still places where there is no proper handling for non console applications, such as: pm_exit: fgets is called and jamms the application.

2. It appears that the sysex problem I experienced is now solved by adding the following:

assignment on line 902 in portmidi28aug06\pm_win\pmwinmm.c:

m->hdr->dwBufferLength = m->hdr->dwBytesRecorded = m->sysex_byte_count;

Before I added the fix of assigning the buffer size to m->hdr->dwBufferLength as well

A buffer of 1024 bytes was always sent, starting with the sysex buffer and 'junk' added to complete 1024 bytes. This could have been the cause to the MIDI sysex not to be always sent. I am still investigating this issue but after adding this fix things started to work a lot better.

I am still not sure if this is the only fix required since

midiOutPrepareHeader is called with a size of 1024 and

midiOutUnprepareHeader might now be called with the actual size of sysex sent... so it should be called to unprepare the original buffer size of 1024.

Thanks,

Oron


 


From:  [EMAIL PROTECTED]
Reply-To:  [email protected]
To:  [email protected]
Subject:  media_api Digest, Vol 28, Issue 3
Date:  Mon, 13 Nov 2006 12:00:06 -0800
>Send media_api mailing list submissions to
> [email protected]
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://www.create.ucsb.edu/mailman/listinfo/media_api
>or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
>
>You can reach the person managing the list at
> [EMAIL PROTECTED]
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of media_api digest..."
>
>
>Today's Topics:
>
>    1. portmidi exits, sysex, and code changes (Roger Dannenberg)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Sun, 12 Nov 2006 14:05:38 -0500
>From: Roger Dannenberg <[EMAIL PROTECTED]>
>Subject: [Media_api] portmidi exits, sysex, and code changes
>To: Oron Cherry <[EMAIL PROTECTED]>
>Cc: [email protected]
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Oron,
> Here are better answers to your 3 or 4 questions/comments:
>
>Yes, there is a call to exit() in *source code* portmidi.c, but this is
>only compiled if PM_CHECK_ERRORS is defined. This is the default in the
>makefiles because it's probably the right setting for development work.
>It's convenient because it catches and reports errors even if you don't
>explicitly check return values in your application. "Serious"
>applications and non-console Win32 apps should compile without
>PM_CHECK_ERRORS, check return values explicitly, and handle them.
>
>portmidi28aug06 is not the latest version. I can't check the website at
>the moment, but I think it's portmidi23oct06, and I restored some code
>that was somehow dropped from the portmidi17nov04 version. If there's
>still stuff missing, please let me know.
>
>The "huge buffer of 1024" should not really be a problem -- the buffers
>are passed around by reference (although perhaps there's a copy when you
>cross the kernel boundary?). I think it would be more of a problem to
>use small buffers in the case of large sysex messages. Allocating the
>right size for each message would incur heap allocation and free
>overhead, and could cause some serious real-time problems acquiring
>locks to a shared heap (as in the default thread-safe malloc()). I think
>there is far more overhead handling byte-by-byte delivery of even short
>sysex messages in the device driver than possibly copying up to 1024
>bytes for nothing, but I'm open to exploring any apparent performance
>problems.
>
>Finally, you said sometimes sysex messages are not delivered to the MIDI
>device. I've experienced synthesizers dropping sysex messages when they
>are sent at the full MIDI data rate, and portmidi does not try to
>throttle MIDI data rates. Another possible problem is internal buffer
>overflow: you should make sure the portmidi output buffer size passed to
>pm_OpenOutput() is large enough for the largest sysex message and you
>should check all return values for errors. If that doesn't help, let me
>know how to get portmidi to drop messages and I'll track down the
>problem. A good way to start is to use two machines -- one to send, and
>one to receive and check. The pm_test/sysex.exe program uses a similar
>idea, but sends to itself, and seems to work reliably.
>
>Thanks,
>Roger
>
>
>------------------------------
>
>_______________________________________________
>media_api mailing list
>[email protected]
>http://www.create.ucsb.edu/mailman/listinfo/media_api
>
>
>End of media_api Digest, Vol 28, Issue 3
>****************************************


Don't just search. Find. MSN Search Check out the new MSN Search!
_______________________________________________
media_api mailing list
[email protected]
http://www.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to