/* opens a MIDI-Out device, returns handle */ int mididrv_out_open(void) { MMRESULT ret; log_message(mididrv_log, "Opening MIDI-Out device #%d", midi_out_dev); if (handle_out) { mididrv_out_close(); } if (midi_out_dev != -1) { ret = midiOutOpen(&handle_out, midi_out_dev, 0, 0, CALLBACK_NULL); if (ret != MMSYSERR_NOERROR) { log_error(mididrv_log, "Cannot open MIDI-Out device #%d!", midi_out_dev); handle_out = 0; return -1; } } else { handle_out = 0; return -1; } /* reset buffer */ out_index = 0; return (DWORD)handle_out; }
static void midi_suspend(void) { #ifdef DEBUG log_message(midi_log, "suspend"); #endif status = MIDI_STATUS_DEFAULT; intx = 0; if (fd_in >= 0) { mididrv_in_close(); } fd_in = -1; if (fd_out >= 0) { mididrv_out_close(); } fd_out = -1; alarm_unset(midi_alarm); alarm_active = 0; intx = 0; midi_set_int(midi_irq, midi_int_num, 0); irq = 0; }