Re: Changing the transfer speed to a USB to MIDI interface
Re: Changing the transfer speed to a USB to MIDI interface
- Subject: Re: Changing the transfer speed to a USB to MIDI interface
- From: Doug Wyatt <email@hidden>
- Date: Tue, 14 Feb 2006 14:04:20 -0800
On Feb 14, 2006, at 5:31, Anders Gärder wrote:
Doug Wyatt wrote:
On Feb 13, 2006, at 2:30, Anders Gärder wrote:
Hello,
I am working on designing a USB to MIDI interface that uses
the built in usbmidi drivers in OSX and XP.
The interface can negotiate a higher than MIDI speed when
connected to a
compatible hardware synthesizer, up to 10 times the speed.
We are writing our own transfer utility, C6, to transfer bulk
data (samples and SysEx).
I am trying to use the following functions to set the speed of
the driver
gDest = MIDIGetDestination(target);
MIDIObjectSetIntegerProperty
(gDest,kMIDIPropertyMaxSysExSpeed,speed);
There are two pieces of code in CoreMIDI that look at this property:
MIDISendSysex.
MIDIFlushOutput
The driver does not look at the property; throttling is better
done at a higher level.
It works but I only seem to be able to set this property once.
What happens if you try to set it a second time?
It remains set to the previous value, that is, I can only set it once.
Do I have to reset something else first? Or is
MIDIObjectSetIntegerProperty all I should have to call?
This program works for me...
#include <CoreFoundation/CoreFoundation.h>
#include <CoreMIDI/CoreMIDI.h>
void SetGetSpeed(MIDIEndpointRef ep, SInt32 speed)
{
MIDIObjectSetIntegerProperty(ep, kMIDIPropertyMaxSysExSpeed, speed);
SInt32 speed2 = 0;
MIDIObjectGetIntegerProperty(ep, kMIDIPropertyMaxSysExSpeed, &speed2);
printf("%d -> %d\n", (int)speed, (int)speed2);
}
int main (int argc, const char * argv[])
{
MIDIEndpointRef ep = MIDIGetDestination(0);
CFStringRef name = NULL;
MIDIObjectGetStringProperty(ep, kMIDIPropertyDisplayName, &name);
CFShow(name);
SInt32 speed = 0;
MIDIObjectGetIntegerProperty(ep, kMIDIPropertyMaxSysExSpeed, &speed);
printf("original: %d\n", speed);
SetGetSpeed(ep, 10000);
SetGetSpeed(ep, 20000);
SetGetSpeed(ep, 30000);
return 0;
}
For you, does it work for some endpoints and not others?
Can I change it dynamically?
Yes.
Or do I have to set it to the highest value I plan to use and
then use a timer to portion out the SysEx data?
If you use MIDISendSysex, it will use a timer based on the current
value of the property. If you use MIDISend, then you're
responsible for not sending data too quickly.
Interesting, MIDISend might be the way to do it then, but
MIDISendSysex was attractively simple to use.
In the interests of simplicity I'd hope you can get the changing of
the property to work so that you can use MIDISendSysEx. I'm curious
to isolate the problem with setting the maximum speed, so if you can
investigate further I'd appreciate it.
What driver owns the endpoint? Is this your driver or are you using
the USB class driver or something else? If it's your driver, be aware
that CoreMIDI does set the property to a default value of 3125 for
newly-created endpoints.
Doug
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden