Hi,
Thanks for your reply. I didn't knew about IAC driver. I'll try that
in order to be able to do a quick prototyping schema.
However, I really would like to implement my own driver. I suppose
by the answer that programmaticly create a midi driver in runtime is
not possible.
I have been trying to understand what is the order of the calls in the SampleUSBMIDIDriver, as well as reading carefully all the method in MIDIDriver header in Apple Resources documentation.
I have started my driver experiences from the SampleUSBMIDI driver, but instead of extending USBVendorMIDIDriver i'm extendind MIDIDriver directly.
I have implemented all the methods of the MIDI Driver interface:
For all of them i'm doing a printf to see if they got called.
The only one called is the constructor itself.
How can I see this? I'm manually starting MIDI server and that is coming out on the output. Another try i have mad was to start a program that uses MIDI so see if my device was getting listed, because I have added this code to the constructor:
printf("Starting MIDI driver\n");
MIDIDeviceRef dev;
MIDIEntityRef ent;
//UInt16 devProduct = USBToHostWord(inUSBDevice->GetDeviceDescriptor()->idProduct);
CFStringRef boxName = CFSTR("MyProductName");
MIDIDeviceCreate(Self(),
boxName,
CFSTR("Acme"), // manufacturer name
boxName,
&dev);
// make entity for each port, with 1 source, 1 destination
for (int port = 1; port <= 2; ++port) {
char portname[64];
if (2 > 1)
sprintf(portname, "Port %d", port);
else
CFStringGetCString(boxName, portname, sizeof(portname), kCFStringEncodingMacRoman);
CFStringRef str = CFStringCreateWithCString(NULL, portname, 0);
MIDIDeviceAddEntity(dev, str, false, 1, 1, &ent);
CFRelease(str);
}
But nothing appeared. However, when I closed the program, the driver was deconstructed.
I was expecting a call to
FindDevices since it says on the docs the following:
This is only called for version 1 drivers. The server is requesting that the driver detect the devices which are present.
But then other question arises.... and if this is a not a version 1 driver? Well, i'm kind of lost here! The documentation is also a little vague about this.
Basicly I wanted to ask two things:
- What is the next method do be called by the MIDI Server to the registered driver?
- What should I do in my constructor?
If anyone could give me some ideas here I would be very grateful.
Thanks,
With my best regards,
Nuno Santos
On 06/01/2011 08:54 AM, Robert Bocquier wrote:
Le 31/05/2011 21:02, email@hidden a écrit :
Date: Tue, 31 May 2011 00:15:06 +0100
From: Nuno Santos <email@hidden>
Subject: Create MIDI device programmaticly without a MIDIDriver bundle
installed
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=us-ascii
Hi,
Is it possible to programmatically create a MIDIDriver from an application, without having to create a driver bundle and put >it on /System/Library/Extensions/AppleMIDI?
I want to create a small service that receives UDP packets and injects them on a CoreMIDI device but i'm quite reluctant >having to create a driver for this. The only sample I found in developer resources is USBMIDIDriver sample which is very >oriented to device and in that case it makes all the sense the installation of the common driver.
Hi Nuno,
FWIW, you could use an IAC driver within "Audio MIDI Setup".
You can name such a driver as you wish, and it's very easy to use.
Best,