static PyObject *teardown(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) /* no args */ return NULL; // exit gracefully snd_seq_disconnect_to(seq, readable_port, dest_client_id, 0); snd_seq_disconnect_from(seq, writable_port, dest_client_id, 0); snd_seq_close(seq); Py_INCREF(Py_None); return Py_None; }
void JVlibForm::disconnect_port() { if (seq && strlen(SEQ_dev)) { int err; ports = (snd_seq_addr_t *)realloc(ports, sizeof(snd_seq_addr_t)); err = snd_seq_parse_address(seq, &ports[0], SEQ_dev); if (err < 0) { QMessageBox::critical(this, "MIDI Player", QString("Invalid port%1\n%2") .arg(SEQ_dev) .arg(snd_strerror(err))); return; } // stop_sound(); err = snd_seq_disconnect_to(seq, 0, ports[0].client, ports[0].port); } // end if seq } // end disconnect_port
/************************************************************************** * modClose [internal] */ static DWORD modClose(WORD wDevID) { int ret = MMSYSERR_NOERROR; TRACE("(%04X);\n", wDevID); if (MidiOutDev[wDevID].midiDesc.hMidi == 0) { WARN("device not opened !\n"); return MMSYSERR_ERROR; } /* FIXME: should test that no pending buffer is still in the queue for * playing */ if (midiSeq == NULL) { WARN("can't close !\n"); return MMSYSERR_ERROR; } switch (MidiOutDev[wDevID].caps.wTechnology) { case MOD_FMSYNTH: case MOD_MIDIPORT: case MOD_SYNTH: snd_seq_disconnect_to(midiSeq, port_out, MidiOutDev[wDevID].addr.client, MidiOutDev[wDevID].addr.port); midiCloseSeq(); break; default: WARN("Technology not supported (yet) %d !\n", MidiOutDev[wDevID].caps.wTechnology); return MMSYSERR_NOTENABLED; } HeapFree(GetProcessHeap(), 0, MidiOutDev[wDevID].lpExtra); MidiOutDev[wDevID].lpExtra = 0; MidiOutDev[wDevID].bufsize = 0; if (MIDI_NotifyClient(wDevID, MOM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) { WARN("can't notify client !\n"); ret = MMSYSERR_INVALPARAM; } MidiOutDev[wDevID].midiDesc.hMidi = 0; return ret; }