int midiCleanUp() { /* * do not catch errors when disposing ports * MIDIClientDispose should normally dispose the ports attached to it * but clean up the pointers in case */ int i = 0; for (i=0; i<gNumMIDIOutPorts; ++i) { MIDIPortDispose(gMIDIOutPort[i]); gMIDIOutPort[i] = 0; } gNumMIDIOutPorts = 0; for (i=0; i<gNumMIDIInPorts; ++i) { MIDIPortDispose(gMIDIInPort[i]); gMIDIInPort[i] = 0; } gNumMIDIInPorts = 0; if (gMIDIClient) { if( MIDIClientDispose(gMIDIClient) ) { post( "Error: failed to dispose MIDIClient\n" ); return errFailed; } gMIDIClient = 0; } return errNone; }
void CoreMidiDriver::close() { OSStatus err = noErr; err = MIDIPortDisconnectSource( h2InputRef, cmH2Src ); err = MIDIPortDispose( h2InputRef ); //err = MIDIPortDisconnectSource( h2OutputRef, cmH2Dst ); //err = MIDIPortDispose( h2OutputRef ); err = MIDIClientDispose( h2MIDIClient ); }
void CloseMIDIHarware() { if (MIDIHardware) { OSStatus MIDIErr = MIDIEndpointDispose(MADMIDIKeyboardEndRef); MIDIErr = MIDIClientDispose(MADMIDICliRef); MADMIDICliRef = 0L; MADMIDIPortInRef = 0L; } MIDIHardware = false; }
//------------------------------------------------------------------------ void TJackSynchro::Close() { RemoveAllBusses(); if (fClient) jack_client_close(fClient); if (fDestination) MIDIEndpointDispose(fDestination); if (fSource) MIDIEndpointDispose(fSource); if (fMidiClient) MIDIClientDispose(fMidiClient); }
MidiEnumeratorPrivate::~MidiEnumeratorPrivate() { qDebug() << Q_FUNC_INFO; while (m_outputDevices.isEmpty() == false) delete m_outputDevices.takeFirst(); while (m_inputDevices.isEmpty() == false) delete m_inputDevices.takeFirst(); if (m_client != 0) MIDIClientDispose(m_client); m_client = 0; }
void MIDIDriverCoreMidi::close() { for (int i = 0; i < connected_sources.size(); i++) { MIDIEndpointRef source = connected_sources[i]; MIDIPortDisconnectSource(port_in, source); } connected_sources.clear(); if (port_in != 0) { MIDIPortDispose(port_in); port_in = 0; } if (client != 0) { MIDIClientDispose(client); client = 0; } }
LONG CoreAudio_MIDIRelease(void) { TRACE("\n"); if (MIDIIn_NumDevs > 0) { CFMessagePortRef messagePort; /* Stop CFRunLoop in MIDIIn_MessageThread */ messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, MIDIInThreadPortName); CFMessagePortSendRequest(messagePort, 1, NULL, 0.0, 0.0, NULL, NULL); CFRelease(messagePort); DeleteCriticalSection(&midiInLock); } if (wineMIDIClient) MIDIClientDispose(wineMIDIClient); /* MIDIClientDispose will close all ports */ HeapFree(GetProcessHeap(), 0, sources); HeapFree(GetProcessHeap(), 0, destinations); return DRV_SUCCESS; }
MidiDriver_CoreMIDI::~MidiDriver_CoreMIDI() { if (mClient) MIDIClientDispose(mClient); mClient = 0; }
int main(int argc, char *argv[]) { OSStatus err = noErr; // Set up signaling stuff first signal(SIGHUP, &quit); signal(SIGINT, &quit); signal(SIGILL, &quit); signal(SIGTRAP, &quit); signal(SIGABRT, &quit); signal(SIGEMT, &quit); signal(SIGFPE, &quit); signal(SIGBUS, &quit); signal(SIGSEGV, &quit); signal(SIGPIPE, &quit); signal(SIGALRM, &quit); signal(SIGTERM, &quit); signal(SIGURG, &quit); char path[MAX_PATH], tmp[MAX_PATH]; if(getPluginBundleDir(DEF_BUNDLE_STRING, tmp)) { snprintf(path, MAX_PATH, "%s%c%s%c%s%s", tmp, DEF_DELIMITER, DEF_RESOURCE_PATH, DEF_DELIMITER, DEF_PRODUCT, DEF_EXTENSION); } #if USE_PC_MIDI /* MIDIClientRef mc; if(MIDIClientCreate(CFSTR(DEF_PRODUCT), NULL, NULL, &mc) != noErr) { printf("Could not initialize MIDI subsystem\n"); } printf("%d extern devices, %d devs\n", MIDIGetNumberOfDevices()); for(int i = 0; i < MIDIGetNumberOfDevices(); ++i) { MIDIDeviceRef dev = MIDIGetDevice(i); printf("Device %d has %d entities\n", i, MIDIDeviceGetNumberOfEntities(dev)); for(int j = 0; j < MIDIDeviceGetNumberOfEntities(dev); ++j) { MIDIEntityRef entity = MIDIDeviceGetEntity(dev, j); CFPropertyListRef props; MIDIObjectGetProperties(entity, &props, true); printf("Entity has %d prop keys\n", CFDictionaryGetCount((CFDictionaryRef)props)); int size = CFDictionaryGetCount((CFDictionaryRef)props); const void **keys = (const void **)malloc (sizeof(void *) * size); const void **vals = (const void **)malloc (sizeof(void *) * size); CFDictionaryGetKeysAndValues((CFDictionaryRef)props, keys, vals); for(int k = 0; k < size; ++k) { printf("KEY: %s' - VAL: %s\n", CFStringGetCStringPtr((CFStringRef)keys[i], 0), "hi"); } free(keys); free(vals); } } MIDIClientDispose(mc); */ #endif vstLoader *plug = new vstLoader(); if(!plug->setPath(path)) { return 1; } else { plug->setName(); } if(!plug->loadPlugin()) { delete plug; return 1; } if(!plug->initialize()) { delete plug; return 1; } // Set up time info for the plug _TIME.samplePos = 0; _TIME.sampleRate = DEF_SAMPLE_RATE; _TIME.nanoSeconds = 0; _TIME.ppqPos = 0; _TIME.tempo = DEF_TEMPO; _TIME.barStartPos = 0; _TIME.cycleStartPos = 0; _TIME.cycleEndPos = 0; _TIME.timeSigNumerator = DEF_TIMESIG_NUMER; _TIME.timeSigDenominator = DEF_TIMESIG_DENOM; _TIME.smpteOffset = 0; _TIME.smpteFrameRate = 0; _TIME.samplesToNextClock = 0; _TIME.flags = 0; // Set other plugin environment variables if(!plug->setSampleRate(DEF_SAMPLE_RATE)) { return 1; } if(!plug->setBlocksize(DEF_BLOCKSIZE)) { return 1; } // Initialize midi stuff MIDIClientRef mc; if(MIDIClientCreate(CFSTR(DEF_PRODUCT), NULL, NULL, &mc) != noErr) { debug(LOG_ERROR, "Could not initialize MIDI subsystem"); } MIDIPortRef port; err = MIDIInputPortCreate(mc, CFSTR(DEF_PRODUCT), processMidi, plug, &port); MIDIEndpointRef endpoint = MIDIGetSource(0); err = MIDIPortConnectSource(port, endpoint, NULL); int result = 0; pthread_t run_thread; result = pthread_create(&run_thread, NULL, runPluginLoop, (void*)plug); openEditor(plug->getPluginPtr()); pthread_kill(run_thread, SIGINT); MIDIPortDisconnectSource(port, endpoint); MIDIClientDispose(mc); delete plug; return 0; }
void Midi_CoreMidi::stop() { MIDIClientDispose(mcli); }
MIDIClient::~MIDIClient() { MIDIClientDispose(client); MIDIPortDispose(inPort); MIDIPortDispose(outPort); }
MidiInputDeviceCoreMidi::~MidiInputDeviceCoreMidi() { if (hCoreMidiClient) { MIDIClientDispose(hCoreMidiClient); } }
JNIEXPORT jint JNICALL Java_com_apple_audio_CAObjectManagement_MIDIClientDispose (JNIEnv *, jclass, jint client) { return (jint)MIDIClientDispose((MIDIClientRef)client); }