• 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
MyMIDINotifyProc not getting called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MyMIDINotifyProc not getting called


  • Subject: MyMIDINotifyProc not getting called
  • From: Pier <email@hidden>
  • Date: Wed, 25 Sep 2013 18:17:02 +0800

Hi all, 

I have the following code where I want the function MyMIDINotifyProc to be called to notify me of changes to the midi devices connected to the iOS devices. 
However, strangely it is never called when i connect or disconnect devices - what could be the problem here? 

Thank you. Help much appreciated. 

Pier. 

void MyMIDINotifyProc (const MIDINotification  *message, void *refCon) {
printf("MIDI Notify, messageId=%d,", (int)message->messageID);
     
}

/* csound MIDI input open callback, sets the device for input */ 
static int MidiInDeviceOpen(CSOUND *csound, void **userData, const char *dev)
{

    

    int k = 0;
    //6counter++;
    endpoints = 0;

    

    CFStringRef name = NULL, cname = NULL, pname = NULL;
    CFStringEncoding defaultEncoding = CFStringGetSystemEncoding();
    MIDIClientRef mclient = NULL;
    MIDIPortRef mport = NULL;
    MIDIEndpointRef endpoint;
    MIDIdata *mdata = (MIDIdata *) malloc(DSIZE*sizeof(MIDIdata));
    OSStatus ret;
    cdata *refcon = (cdata *) malloc(sizeof(cdata));
    memset(mdata, 0, sizeof(MIDIdata)*DSIZE);
    refcon->mdata = mdata;
    refcon->p = 0;
    refcon->q = 0;
refcon->pnot = refcon->pchn = 0;


    cname = CFStringCreateWithCString(NULL, "my client", defaultEncoding);
    ret = MIDIClientCreate(cname, MyMIDINotifyProc, refcon, &mclient);

    

    if(!ret){
        /* MIDI output port */
        pname = CFStringCreateWithCString(NULL, "outport", defaultEncoding);
        ret = MIDIInputPortCreate(mclient, pname, ReadProc, refcon, &mport);
        if(!ret){
            /* sources, we connect to all available input sources */
            endpoints = MIDIGetNumberOfSources();
  csoundMessage(csound, "midi srcs %d\n", endpoints);
            midiDevicesArray = malloc(endpoints*sizeof(CFStringRef));

            

            for(k=0; k < endpoints; k++){
                endpoint = MIDIGetSource(k);
                void *srcRefCon = endpoint;
                MIDIPortConnectSource(mport, endpoint, srcRefCon);
                // insert into dictionary instead ?
                midiDevicesArray[k] = ConnectedEndpointName(endpoint);

                

            }
        }
    }
    refcon->mclient = mclient;
    *userData = (void*) refcon;
    if(name) CFRelease(name);
    if(pname) CFRelease(pname);
    if(cname) CFRelease(cname); 
    /* report success */
    return 0;
}



 _______________________________________________
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

  • Prev by Date: recording and playback independently with RemoteIO
  • Next by Date: Volume in db MatrixMixer
  • Previous by thread: recording and playback independently with RemoteIO
  • Next by thread: Volume in db MatrixMixer
  • Index(es):
    • Date
    • Thread