MidicLientCreate notifyproc не вызываетсяIOS

Программируем под IOS
Ответить
Anonymous
 MidicLientCreate notifyproc не вызывается

Сообщение Anonymous »

У меня есть следующий код, где я хочу, чтобы функция Mymidinotifyproc была вызвана, чтобы уведомить меня о изменениях в устройствах MIDI, подключенных к устройствам iOS.
Однако, как ни странно, это никогда не вызывается, когда я подключаю или отключаю устройства - в чем может быть проблема? < /p>

Спасибо. Помогите очень ценить. < /p>

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;
}


Подробнее здесь: https://stackoverflow.com/questions/190 ... ing-called
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»