• 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: MIDIPortConnectSource - connRefCon not passing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >MIDIPortConnectSource - connRefCon not passing (From: GW Rodriguez <email@hidden>)

  • Prev by Date: Re: Changing the way the OS responds to a USB DAC
  • Next by Date: Re: Getting and setting the play time on a DefaultOutputUnit
  • Previous by thread: MIDIPortConnectSource - connRefCon not passing
  • Next by thread: Re: Getting and setting the play time on a DefaultOutputUnit
  • Index(es):
    • Date
    • Thread