uses MMSystem
private
{ Private-Deklarationen }
BackupVolumes: array[0..MAX_COMP_TYPES] of DWord;
const
ComponentTypes: array[0..MAX_COMP_TYPES] of DWord =
(MIXERLINE_COMPONENTTYPE_DST_FIRST, MIXERLINE_COMPONENTTYPE_DST_UNDEFINED,
MIXERLINE_COMPONENTTYPE_DST_DIGITAL, MIXERLINE_COMPONENTTYPE_DST_LINE,
MIXERLINE_COMPONENTTYPE_DST_MONITOR, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,
MIXERLINE_COMPONENTTYPE_DST_HEADPHONES, MIXERLINE_COMPONENTTYPE_DST_TELEPHONE,
MIXERLINE_COMPONENTTYPE_DST_WAVEIN, MIXERLINE_COMPONENTTYPE_DST_VOICEIN,
MIXERLINE_COMPONENTTYPE_DST_LAST, MIXERLINE_COMPONENTTYPE_SRC_FIRST,
MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED, MIXERLINE_COMPONENTTYPE_SRC_DIGITAL,
MIXERLINE_COMPONENTTYPE_SRC_LINE, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE,
MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER, MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC,
MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE, MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER,
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY,
MIXERLINE_COMPONENTTYPE_SRC_ANALOG, MIXERLINE_COMPONENTTYPE_SRC_LAST);
//
function GetMixerControlID(CompType: DWORD): DWORD;
var
mxl: MIXERLINE;
mxc: MIXERCONTROL;
mxlc: MIXERLINECONTROLS;
begin
Result := 0;
mxl.cbStruct := SizeOf(mxl);
mxl.dwComponentType := CompType;
if (mixerGetLineInfo(0, @mxl, MIXER_GETLINEINFOF_COMPONENTTYPE) = MMSYSERR_NOERROR) then
begin
mxlc.cbStruct := SizeOf(mxlc);
mxlc.dwLineID := mxl.dwLineID;
mxlc.dwControlType := MIXERCONTROL_CONTROLTYPE_VOLUME;
mxlc.cControls := mxl.cControls;
mxlc.cbmxctrl := sizeof(mxc);
mxlc.pamxctrl := @mxc;
if (mixerGetLineControls(0, @mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE) = MMSYSERR_NOERROR) then
Result := mxc.dwControlID;
end;
end;
function SetVolume(ID, Value: DWord): Boolean;
var
Volume: array[0..1] of TMixerControlDetails_Unsigned;
mxcd: TMixerControlDetails;
begin
Volume[0].dwValue := Value;
Volume[1].dwValue := Value;
with mxcd Do
begin
cbStruct := SizeOf(mxcd);
dwControlID := ID;
cChannels := 2;
cMultipleItems := 0;
cbDetails := SizeOf(TMixerControlDetails_Unsigned) * 2;
paDetails := @Volume;
Result := (mixerSetControlDetails(0, @mxcd, MIXER_SETCONTROLDETAILSF_VALUE) = MMSYSERR_NOERROR);
end;
end;
function GetVolume(ID: DWord): DWord;
var
Volume: array[0..1] of TMixerControlDetails_Unsigned;
mxcd: TMixerControlDetails;
begin
Result := 0;
with mxcd Do
begin
cbStruct := SizeOf(mxcd);
dwControlID := ID;
cChannels := 2;
cMultipleItems := 0;
cbDetails := SizeOf(TMixerControlDetails_Unsigned) * 2;
paDetails := @Volume;
end;
if (mixerGetControlDetails(0, @mxcd, MIXER_GETCONTROLDETAILSF_VALUE) = MMSYSERR_NOERROR) then
begin
Result := Volume[0].dwValue;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MixerCtrlID: DWord;
begin
MixerCtrlID := GetMixerControlID(ComponentTypes[ComboBox1.ItemIndex]);
SetVolume(MixerCtrlID, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
MixerCtrlID: DWord;
begin
MixerCtrlID := GetMixerControlID(ComponentTypes[ComboBox1.ItemIndex]);
Label1.Caption := IntToStr(GetVolume(MixerCtrlID));
Trackbar1.Position := 65535 - GetVolume(MixerCtrlID);
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
Edit1.Text := IntToStr(65535 - Trackbar1.Position);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
MixerCtrlID: DWord;
begin
ComboBox1.ItemIndex := 5;
for i := 0 to Length(BackupVolumes) - 1 do
begin
MixerCtrlID := GetMixerControlID(ComponentTypes[i]);
BackUpVolumes[i] := GetVolume(MixerCtrlID);
end;
end;
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Edit1.Text <> '' then Trackbar1.Position := 65535 - StrToInt(Edit1.Text);
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
i: Integer;
MixerCtrlID: DWord;
begin
for i := 0 to Length(BackupVolumes) - 1 do
begin
MixerCtrlID := GetMixerControlID(ComponentTypes[i]);
SetVolume(MixerCtrlID, BackUpVolumes[i]);
end;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
ShowMessage('Mixer is now resetting all volume levels to the initial values when Mixer was started!');
end;
Volume Control Replacement Api
Abonnieren
Posts (Atom)
Beliebte Posts
-
Network Source Code Update Source Code Network Update : https://asciigen.blogspot.com/p/network.html Send Message 1.0 Source Server Client ...
-
Windows Key Sniffer 0.82 - Update 08/2024 Der Windows Key Sniffer hat mir im Laufe der Zeit viel Arbeit erspart und unterstützt, viele Wi...
-
Windows Defender Bypass Version 0.75 - Update 11/2024 Den Windows 10-eigenen Virenschutz Defender kann man auf mehreren Wegen abschalten,...
-
ASCii GIF Animator Update Version 0.68 (32 bit) - 11/2024 Bei dieser überarbeiteten Version ist die Kompatibilität zu den verschiedenen GIF...
-
MD5 Hacker v.0.26 - Update 08.2024 MD5 Hashs sollten eigentlich nicht entschlüsselt werden können. Jedoch gibt es Tools, mit welchen auch ...
-
Host Editor Version 0.64 - Update 11/2024 Hosts File Editor allows for the easy editing of host files and backup creation. Create your own h...
-
Dir Sniffer Version 0.08 - Update 08/2024 Dir Sniffer ist ein kleines aber nützliches Tool um herauszufinden, was ihr Programm auf ihrem...
-
Oldskool Font Generator v.0.29 - Update 11/2023 Das Tool stell 508 Bitmap Fonts zu Verfügung. Eigene Fonts können integriert werden, sie...
-
ASCii Text Creator v.0.24 - Update 11.2023 * Add BugFix Gui Move Message Send * Add 447 Figlet Font Pack * Fixed Invert Unicode Function * ...
Keine Kommentare:
Kommentar veröffentlichen