M
Max M
Trying to write realtime midi in Windows I am using ctypes. So I have
written a small wrapper for winmm.dll
It partly works. I get this error when I try to run it:
Traceback (most recent call last):
File "E:\maxm\pys\MIDI-R~1\x.py", line 203, in ?
print winmm.midiOutGetDevCaps(deviceID, caps, sizeof(caps))
File "E:\maxm\pys\MIDI-R~1\x.py", line 133, in __getattr__
return getattr(self._winmm, attr)
File "C:\pytyons\Python23\Lib\site-packages\ctypes\__init__.py", line
316, in __getattr__
func = self._StdcallFuncPtr(name, self)
AttributeError: function 'midiOutGetDevCaps' not found
But the documentation says that the midiOutGetDevCaps() should exist in
the dll.
It calls the midiOutGetNumDevs() function in the dll nicely, wich is why
I find it to be strange problem.
Does anybody have a clue? It's my first try at ctypes, so I am a bit
lost here.
regards Max M
#################################3
# The code
from ctypes import *
MAXPNAMELEN = 32
class MIDIOUTCAPS(Structure):
_fields_ = [
("wMid", c_int), # WORD
("wPid", c_int), # WORD
("vDriverVersion", c_long), # MMVERSION
("szPname", c_char * MAXPNAMELEN), # CHAR
("wTechnology", c_int), # WORD
("wVoices", c_int), # WORD
("wNotes", c_int), # WORD
("wChannelMask", c_int), # WORD
("dwSupport", c_long), # DWORD
]
class Winmm:
"""A *very* thin wrapper over WINMM.DLL
"""
def __init__(self):
self._winmm = windll.WINMM
def __getattr__(self, attr):
return getattr(self._winmm, attr)
if __name__ == '__main__':
caps = MIDIOUTCAPS()
winmm = Winmm()
numDevs = winmm.midiOutGetNumDevs()
for deviceID in range(-1, numDevs):
print winmm.midiOutGetDevCaps(deviceID, caps, sizeof(caps))
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
written a small wrapper for winmm.dll
It partly works. I get this error when I try to run it:
Traceback (most recent call last):
File "E:\maxm\pys\MIDI-R~1\x.py", line 203, in ?
print winmm.midiOutGetDevCaps(deviceID, caps, sizeof(caps))
File "E:\maxm\pys\MIDI-R~1\x.py", line 133, in __getattr__
return getattr(self._winmm, attr)
File "C:\pytyons\Python23\Lib\site-packages\ctypes\__init__.py", line
316, in __getattr__
func = self._StdcallFuncPtr(name, self)
AttributeError: function 'midiOutGetDevCaps' not found
But the documentation says that the midiOutGetDevCaps() should exist in
the dll.
It calls the midiOutGetNumDevs() function in the dll nicely, wich is why
I find it to be strange problem.
Does anybody have a clue? It's my first try at ctypes, so I am a bit
lost here.
regards Max M
#################################3
# The code
from ctypes import *
MAXPNAMELEN = 32
class MIDIOUTCAPS(Structure):
_fields_ = [
("wMid", c_int), # WORD
("wPid", c_int), # WORD
("vDriverVersion", c_long), # MMVERSION
("szPname", c_char * MAXPNAMELEN), # CHAR
("wTechnology", c_int), # WORD
("wVoices", c_int), # WORD
("wNotes", c_int), # WORD
("wChannelMask", c_int), # WORD
("dwSupport", c_long), # DWORD
]
class Winmm:
"""A *very* thin wrapper over WINMM.DLL
"""
def __init__(self):
self._winmm = windll.WINMM
def __getattr__(self, attr):
return getattr(self._winmm, attr)
if __name__ == '__main__':
caps = MIDIOUTCAPS()
winmm = Winmm()
numDevs = winmm.midiOutGetNumDevs()
for deviceID in range(-1, numDevs):
print winmm.midiOutGetDevCaps(deviceID, caps, sizeof(caps))
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science