Trevor Haba wrote: > I'm looking for a way to use python to change the volume on windows. > After some googling the best I could come up with was this script I > got from a relatively ancient entry on this mailing list (I think it > was from 2005 or something). I'm using windows 7, and I would like it > to work on windows 8 if possible, though its not necessary. I don't > need to support any previous versions of windows.
Alas, the news is not good. The simple and easy-to-use winmm APIs are no longer supported. They still work in many cases, but the mapping from the winmm device numbering to the new audio API device numbering is mysterious, as you have learned, and there is no good recipe to find them that works on every system. The "blessed" method of adjusting the volume in the Vista-and-beyond audio world requires the use of COM. You fetch an IMMDeviceEnumerator interface, use that to fetch an IMMDevice for your device, then fetch an IAudioEndpoint interface and call SetMasterVolumeLevel to adjust the volume. That's not really very much code in C++ terms, BUT none of those interfaces have late-binding support, which means Python cannot use them. So, your only real choice is to write a Python extension in C++. Fortunately, using <boost/python.hpp>, that's not as hard as it used to be. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32