unit UMonitor_ON;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses MMSystem;
function GetMonitoring(
Mixer: hMixerObj;
var Control: TMixerControl): MMResult;
// Returns True on success
var
Line: TMixerLine;
Controls: TMixerLineControls;
begin
ZeroMemory(@Line, SizeOf(Line));
Line.cbStruct := SizeOf(Line);
Line.dwComponentType := MIXERLINE_COMPONENTTYPE_SRC_LINE;
//LineIN
Result := mixerGetLineInfo(Mixer, @Line,
MIXER_GETLINEINFOF_COMPONENTTYPE);
if Result = MMSYSERR_NOERROR
then
begin
ZeroMemory(@Controls, SizeOf(Controls));
Controls.cbStruct := SizeOf(Controls);
Controls.dwLineID := Line.dwLineID;
Controls.cControls := 1;
// Controls.dwControlType := MIXERCONTROL_CONTROLTYPE_MUTE;
Controls.dwControlType := MIXERCONTROL_CONTROLTYPE_ONOFF;
//checkbox Monitoring 1
Controls.cbmxctrl := SizeOf(Control);
Controls.pamxctrl := @Control;
Result := mixerGetLineControls(Mixer, @Controls,
MIXER_GETLINECONTROLSF_ONEBYTYPE);
end;
end;
procedure SetMonitoringValue(
Mixer: hMixerObj;
Value: Boolean);
var
Monitoring: TMixerControl;
Details: TMixerControlDetails;
BoolDetails: TMixerControlDetailsBoolean;
Code: MMResult;
begin
Code := GetMonitoring(0, Monitoring);
if Code = MMSYSERR_NOERROR
then
begin
with Details
do
begin
cbStruct := SizeOf(Details);
dwControlID := Monitoring.dwControlID;
cChannels := 1;
cMultipleItems := 0;
cbDetails := SizeOf(BoolDetails);
paDetails := @BoolDetails;
end;
LongBool(BoolDetails.fValue) := Value;
Code := mixerSetControlDetails(0, @Details,
MIXER_SETCONTROLDETAILSF_VALUE);
end;
if Code <> MMSYSERR_NOERROR
then
raise Exception.CreateFmt('
SetMonitoringValue failure, '+
'
multimedia system error #%d', [Code]);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Monitoring: TMixerControl;
Code: MMResult;
begin
SetMonitoringValue(0,True);
//TRUE=ON FALSE=OFF
end;
end.