private static extern int mciSendCommandStatus(int wDeviceID, int uMessage, int dwParam1, ref MCI_STATUS_PARMS dwParam2);
//returns whether MIDI device is playing a MIDI file private static bool IsPlayingMidi() { bool bResult = false; try { if (isOpen) { MCI_STATUS_PARMS mciStatusParms = new MCI_STATUS_PARMS(); mciStatusParms.dwItem = MCI_STATUS_MODE; if (mciSendCommandStatus(deviceID, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, ref mciStatusParms) != 0) throw new Exception("Failed to determine device status."); if (mciStatusParms.dwReturn == MCI_MODE_PLAY) bResult = true; } } catch (Exception e) { GameState.AppendToLog(e.Message + "\n" + e.StackTrace); bResult = false; } return bResult; }