I’ve been trying to use the ctypes module to use FMOD, but I keep getting an error saying the function doesn’t exist. I already know about ctypes not liking C++ dll files. Anyone gotten FMOD to work with Python? Or do I have to add all those externs in the source and recompile it?
Hi, I wrote the pyFMOD at the uncassist site. It works great with fmodapi363win32. I’ll have to modify it to work with later versions.
The problems with names and ctypes is not a result of C++ but rather the lack of a .def file when the dll was built. The names aren’t mangled in the C++ way but rather have an underscore prepended and an integer related to the number of arugments appended to the end. Our pyFMOD wrapper takes that into account internally by manually mangling the name.
Indentation in the code is not a problem. Python allows any indentation, not just multiples of 4 or 8. The code happens to be indented by 2 but works fine.
You’ll need ctypes 0.62, the pyFMOD.py, and the fmod.dll. Then it’ll work fine. We’re using it in software we are developing for kids who are blind. We play wav files, midi’s, and mp3’s.
We wrote it for our own use. Sorry we haven’t gotten around to providing any doc yet.
[quote="Gary Bishop":kl5claje]You’ll need ctypes 0.62, the pyFMOD.py, and the fmod.dll. Then it’ll work fine. We’re using it in software we are developing for kids who are blind. We play wav files, midi’s, and mp3’s. [/quote:kl5claje]
Good man. Ok, I’ll downgrade FMOD and give it a try. If I can find that version…
I think you misunderstood. I can’t get FMOD to work at all. The ctypes module doesn’t play well with DLL files written with C++ because it mangles the function names. Meaning ctypes doesn’t find the function when I try and call it. One of the solutions for the C++ problem is to add a big extern list in the C++ source and recompile the DLL.
So the problem is either I’m not using ctypes correctly, or FMOD was written in C++. (I’m lazy. Haven’t looked at the source, yet…) Gimmie a break, though. After programming in Python, PHP, Perl and stuff for so long, C++ is tough to get used to.
So here’re my questions:
Has anyone ever user FMOD with Python?
…and can I see examples?
Eh, it’s alright. I know ctypes doesn’t like the C++ stuff unless I add an extern for each function I want to use. One major error I found with pyFMOD is that the tabbing is off by 2 spaces… So none of the functions in the wrapper actually work. I’ll just send them an email asking about it.
Please login first to submit.