MCPcopy Create free account
hub / github.com/bspaans/python-mingus / openDevice

Method openDevice

mingus/midi/win32midi.py:52–62  ·  view source on GitHub ↗
(
        self, deviceNumber=-1
    )

Source from the content-addressed store, hash-verified

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)

Callers 1

initMethod · 0.80

Calls 1

Win32MidiExceptionClass · 0.85

Tested by

no test coverage detected