| 50 | return self.winmm.midiOutGetNumDevs() |
| 51 | |
| 52 | def openDevice( |
| 53 | self, deviceNumber=-1 |
| 54 | ): # device -1 refers to the default set in midi mapper, usually a good choice |
| 55 | # it took me some experimentation to get this to work... |
| 56 | self.hmidi = c_void_p() |
| 57 | rc = self.winmm.midiOutOpen(byref(self.hmidi), deviceNumber, 0, 0, 0) |
| 58 | if rc != 0: |
| 59 | raise Win32MidiException( |
| 60 | "Error opening device, " |
| 61 | + self.midiOutOpenErrorCodes.get(rc, "Unknown error.") |
| 62 | ) |
| 63 | |
| 64 | def closeDevice(self): |
| 65 | rc = self.winmm.midiOutClose(self.hmidi) |