Re: MIDIPortConnectSource - connRefCon not passing
Re: MIDIPortConnectSource - connRefCon not passing
- Subject: Re: MIDIPortConnectSource - connRefCon not passing
- From: Charlie Roberts <email@hidden>
- Date: Thu, 08 Mar 2012 18:47:26 -0800
I might be missing something, but it looks like you're passing a
pointer to a locally declared variable as the userdata of your
readProc... that can't be good. Pass something on the heap that isn't
iterated in your for loop and you should be OK.
- Charlie
On Wed, Mar 7, 2012 at 5:59 PM, GW Rodriguez <email@hidden> wrote:
> After a break I've come back to this project with a fresh perspective. When
> I call MIDIPortConnectSource and pass a unique connRefCon it's not
> apparently passing for each endpoint. Here's my code:
>
> ItemCount count = MIDIGetNumberOfSources();
> for (Itemcount i=0; i<count; i++) {
> MIDIEndpointRef endpoint = MIDIGetSource(i);
> MIDIObjectGetStringProperty(endpoint,kMIDIPropertyName,
> &midiEndpointSourceName);
> NSLog(@"Source %lu: %@", i, midiEndpointSourceName);
>
> MIDIPortConnectSource(midiSourcePort, endpoint, (void*)&i);
> }
>
> Then my read proc:
>
> void SourceReadProc (const MIDIPacketList *pktlist,
> void *readProcRefCon,
> void *srcConnRefCon)
> {
> ItemCount *source = (ItemCount*) srcConnRefCon;
> NSLog(@"source: %lu", *source);
> }
>
> I've hooked up two different midi sources and I can find them both just
> fine. My first code reports that there are two sources and tells me their
> names. But my read proc says that the sources are from the first source even
> when I'm only sending data from the second source. I've tried three
> different data types when passing the connRefCon with no luck. I feel that
> my issue must be with the MIDIPortConnectSource.
>
> Any help or even troubleshooting ideas would be great. I wish that CoreMIDI
> had functions to query what's connected to ports so I could check that, but
> alas, there's not.
>
> -GW playbackrecordreinforce.net
>
>
>
> _______________________________________________
> 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
>
_______________________________________________
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