I am trying to get a start on a simple plugin. It sends a MIDI note on
message when the inpputNote or inputVelocity changes. This is some
basic MIDI code that works in other circumstances but does not work at
all as a plug in. I guess i should be truthful, I am a C programmer
and so this is code that is 'ported' into Objective-C. I am hoping
that the problems are not related to my inexperience with Obj-C. But i
don't think i am doing anything too sophisticated.
Some more info. The code is generated from the basic QC Leopard XCODE
template. Most all of the other methods are empty other than the ones
recommended in the QC plugin developers guide
(attributesForPropertyPortWithKey, executionMode) which i'm pretty
sure i have right because it shows up as a processor and the input
ports are labelled correctly.
Has anyone else worked with MIDI in a QC plugin?
thanks
maury
- (BOOL) startExecution:(id<QCPlugInContext>)context
{
/*
Called by Quartz Composer when rendering of the composition starts:
perform any required setup for the plug-in.
Return NO in case of fatal failure (this will prevent rendering of
the composition to start).
*/
MIDIClientCreate(CFSTR("QC MIDITrigger Client"), NULL, NULL, &client);
MIDIOutputPortCreate(client, CFSTR("QC MIDITrigger Port"),
&outport);
return YES;
}
- (BOOL) execute:(id<QCPlugInContext>)context atTime:
(NSTimeInterval)time withArguments:(NSDictionary*)arguments
{
Byte noteOffMsg[3];
noteOffMsg[0] = kMidiMessage_NoteOn; // & self.systemChannel;
noteOffMsg[1] = lastNote;
noteOffMsg[2] = 0;
Byte noteOnMsg[3];
noteOnMsg[0] = kMidiMessage_NoteOn; // & self.systemChannel;
noteOnMsg[1] = self.inputNote;
noteOnMsg[2] = self.inputVelocity;
MIDIPacket *thePack;
MIDIPacketList thePackList;
MIDITimeStamp nowTime;
nowTime = AudioGetCurrentHostTime();
thePack = MIDIPacketListInit(&thePackList);
// send to all destinations
if (n > 0) {
for (i = n;i != 0; i--) {
currentDest = MIDIGetDestination(i);
thePack = MIDIPacketListAdd(&thePackList, sizeof(thePackList),
thePack, nowTime, 3, noteOffMsg);
MIDISend(outport, currentDest, &thePackList);
thePack = MIDIPacketListAdd(&thePackList, sizeof(thePackList),
thePack, nowTime, 3, noteOnMsg);
MIDISend(outport, currentDest, &thePackList);
}
}
return YES;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]