Last week I posted a code snippet that showed how to change the master volume in Vista. That snippet doesn't really show the coolness that exists within the IAudioEndpointVolume interface.
One of my favorite features is the support for OSD's (On Screen Displays). To show it off, I write a tiny little OSD program that shows off just two of the APIs in question - VolumeStepUp and VolumeStepDown.
If you hit '+' and '-' it'll increase and decrease the volume, I also included a cheesy OSD so you can see the effects of the APIs.
Before people complain about how much code is here, this is the complete source file, and there's a lot more code to deal with the console than there is to deal with the volume.
This program's pretty simple right now, the next step is to add a bit of magic to it (metering).
There are still someone who can code in a proper language at Microsoft ;-)
I code in the language that best fits my task at hand, usually it's C++.
Too bad it won't compile in ASCII builds. No use of the _T* types or macros? For shame, Larry. For shame.
John, why on earth would want this to compile in 8 bit character mode? The compiler's default character set is now Unicode, and 8bit character sets carry with them a mountainous set of baggage.
If you want it to work in non unicode, the conversion is simple.
Just for the sake of completeness.
Will the Windows SDK headers ever ship without definitions for ASCII structs / functions? As you say there is not really any compelling use for ASCII these days aside from backwards compatibility, but how long is that going to be maintained?
John, the A functions won't go away, but all new APIs are unicode only.
Many of the new APIs are Vista-only and 9x is officially way way past its lifetime. (I'm ok with that, some things need to die.) So, if you want to use these new APIs in actual products, you'ld better hope your customers have all upgraded. ;)
Could you please show an example of implementing IAudioEndpointVolumeCallback? Not a full app, just the lines of code to create the interface and supply the OnNotify function, so I’ve got something to hand to RegisterControlChangeNotify? I will praise your name fulsomely.
(firstname.lastname@example.org if you want to comment without posting in your space)
Yesterday I posted a quick&dirty OSD (complete with cheesy text graphics). Today I'm going to add
Nice to see your code is color highlighted.
Hi Larry,i want to change the Mute status.
if (inputChar == '+')
No matter the Mute is on or off,the mute_status is 0,what is worry with this?
Larry,oh,it is my worry.
I can set the muting state .