FREObject closeInputDevice(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { int pointer = 0; FREGetObjectAsInt32(argv[0],&pointer); try { RtMidiIn *in = (RtMidiIn *)pointer; if(in->isPortOpen()) in->closePort(); removeDeviceIn(in); delete in; //printf("Num open midi devices %i\n",openMidiIn.size()); }catch(std::exception e) { printf("Error closing input device.\n"); } FREObject result; FRENewObjectFromBool(true,&result); return result; }
~NodeMidiInput() { in->closePort(); delete in; uv_mutex_destroy(&message_mutex); }
value rtmidi_in_closeport(value obj) { RtMidiIn *midiin = (RtMidiIn *)(intptr_t)val_float(obj); midiin->closePort(); return alloc_null(); }