I'm not even sure if this fits into one question, but it is a single problem. I have an internet radio player written in Delphi XE, using the BASS library for audio streaming and playback. The application needs to run under Windows XP, Vista and 7.
Bass makes it easy to control global volume, but has no facility for muting sound, and in general it's a better idea to control volume on per-application basis.
Bass also makes it easy to control the volume of a "channel" (stream), but again there is no muting, and this isn't the proper per-application control, either. (The application volume control in Windows mixer is unaffected.)
I understand that for Vista and above I need ISimpleAudioVolume and/or IAudioEndpointVolume, but cannot find a Delphi implementation of these. So one part of the question is, does it exist as a 3rd party library?
Part two is, what's the proper way to to control volume and toggle mute (system-wide or per application) on XP, where these interfaces are not available?
Use this simple code to mute the main volume it works on my machine:
procedure TForm1.Button1Click(Sender: TObject);
var
i:Integer;
begin
for i:=0 to 100 do
begin
keybd_event($AE, MapVirtualKey($AE,0), 0, 0);
keybd_event($AE, MapVirtualKey($AE,0), KEYEVENTF_KEYUP, 0);
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With