• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using MIDIThruConnection.h
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using MIDIThruConnection.h


  • Subject: Re: Using MIDIThruConnection.h
  • From: Geoff <email@hidden>
  • Date: Thu, 25 Sep 2003 10:04:29 +1000

Thanks Doug, I at least know I'm getting good at squeezing this stuff out of header files. I can't see that you're example is doing anything significant that mine is not doing so I remain baffled.

I'm running 10.2.6 and I've tried this on a 400MHz G3 Laptop and 450MHz G4 Tower. I have a FastLane-USB MIDI Interface with two ports and the correct driver is installed. A JV-80 is connected to Port A and a JV-1010 is connected to Port B. I can MIDISend to either port as destinations and my read proc works fine when I'm connected to either port as sources.

I've pasted in the code below from a complete compact example to isolate the problem from the rest of my work. Create a nib based Carbon app in PB, completely empty main.c and then paste in this code. The includes can go in the provided prefix file.

BTW I notice you haven't signed in as a client. I found that if I forgot to do that the property name strings weren't initialised. Does the call to MIDIThruConnectionParamsInitialize suffice to trigger this?

Note that in my code source 0 is Port A, the JV-80 and destination 1 is Port B, the JV-1010. The JV-80 has a keyboard and the JV-1010 is just a small box and I want to thru the keyboard output.

Cheers Geoff %^>

#include <Carbon/Carbon.h>
#include <CoreMIDI/CoreMIDI.h>

OSStatus SetThroughConnect(MIDIEndpointRef iFromRef, MIDIEndpointRef iToRef, MIDIThruConnectionRef* oThroughRef);

int main(int argc, char* argv[])
{
IBNibRef vNibRef;
MIDIEndpointRef vSource;
MIDIEndpointRef vDestination;
OSStatus vError;
MIDIThruConnectionRef vConnection;

vError = CreateNibReference(CFSTR("main"), &vNibRef);
require_noerr(vError, CantGetNibRef);

vError = SetMenuBarFromNib(vNibRef, CFSTR("MenuBar"));
require_noerr(vError, CantSetMenuBar);

DisposeNibReference(vNibRef);

vSource = MIDIGetSource(0);
vDestination = MIDIGetDestination(1);
vError = SetThroughConnect(vSource, vDestination, &vConnection);
require_noerr(vError, CantConnect);

RunApplicationEventLoop();

CantConnect:
CantSetMenuBar:
CantGetNibRef:

return vError;
}

OSStatus SetThroughConnect(MIDIEndpointRef iFromRef, MIDIEndpointRef iToRef, MIDIThruConnectionRef* oThroughRef)
{
OSStatus vError;
MIDIThruConnectionParams vParams;
CFDataRef vDataRef;

MIDIThruConnectionParamsInitialize(&vParams);
vParams.numSources = 1;
vParams.sources[0].endpointRef = iFromRef;
vParams.numDestinations = 1;
vParams.destinations[0].endpointRef = iToRef;
vDataRef = CFDataCreate(NULL, (unsigned char*)&vParams, sizeof(MIDIThruConnectionParams));
vError = MIDIThruConnectionCreate(NULL, vDataRef, oThroughRef);
CFRelease(vDataRef);

return vError;
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Using MIDIThruConnection.h (From: Doug Wyatt <email@hidden>)

  • Prev by Date: Re: AudioConverterFillComplexBuffer question
  • Next by Date: Re: Audio MIDI setup
  • Previous by thread: Re: Using MIDIThruConnection.h
  • Next by thread: Retrieving Waveform Information from Audio Files
  • Index(es):
    • Date
    • Thread