unit fuego;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, mmSystem, ShellAPI;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
mic_an: TImage;
mic_aus: TImage;
procedure Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button3MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function SetMicrophoneVolumeMute(bMute: Boolean): Boolean;
var
hMix: HMIXER;
mxlc: MIXERLINECONTROLS;
mxcd: TMIXERCONTROLDETAILS;
vol: TMIXERCONTROLDETAILS_UNSIGNED;
mxc: MIXERCONTROL;
mxl: TMixerLine;
intRet: Integer;
nMixerDevs: Integer;
mcdMute: MIXERCONTROLDETAILS_BOOLEAN;
begin
// Check if Mixer is available
// Überprüfen, ob ein Mixer vorhanden ist
nMixerDevs := mixerGetNumDevs();
if (nMixerDevs < 1)
then
begin
Exit;
end;
// open the mixer
// Mixer öffnen
intRet := mixerOpen(@hMix, 0, 0, 0, 0);
if intRet = MMSYSERR_NOERROR
then
begin
mxl.dwComponentType := MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE;
mxl.cbStruct := SizeOf(mxl);
// mixerline info
intRet := mixerGetLineInfo(hMix, @mxl, MIXER_GETLINEINFOF_COMPONENTTYPE);
if intRet = MMSYSERR_NOERROR
then
begin
ZeroMemory(@mxlc, SizeOf(mxlc));
mxlc.cbStruct := SizeOf(mxlc);
mxlc.dwLineID := mxl.dwLineID;
mxlc.dwControlType := MIXERCONTROL_CONTROLTYPE_MUTE;
mxlc.cControls := 1;
mxlc.cbmxctrl := SizeOf(mxc);
mxlc.pamxctrl := @mxc;
// Get the mute control
// Mute control ermitteln
intRet := mixerGetLineControls(hMix, @mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
if intRet = MMSYSERR_NOERROR
then
begin
ZeroMemory(@mxcd, SizeOf(mxcd));
mxcd.cbStruct := SizeOf(TMIXERCONTROLDETAILS);
mxcd.dwControlID := mxc.dwControlID;
mxcd.cChannels := 1;
mxcd.cbDetails := SizeOf(MIXERCONTROLDETAILS_BOOLEAN);
mxcd.paDetails := @mcdMute;
mcdMute.fValue := Ord(bMute);
// set, unset mute
// Stumsschalten ein/aus
intRet := mixerSetControlDetails(hMix, @mxcd,
MIXER_SETCONTROLDETAILSF_VALUE);
{
mixerGetControlDetails(hMix, @mxcd,
MIXER_GETCONTROLDETAILSF_VALUE);
Result := Boolean(mcdMute.fValue);
}
Result := intRet = MMSYSERR_NOERROR;
if intRet <> MMSYSERR_NOERROR
then
ShowMessage('
SetControlDetails Error');
end
else
ShowMessage('
GetLineInfo Error');
end;
intRet := mixerClose(hMix);
end;
end;
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShellExecute(Application.Handle, '
open', PChar('
c:\programme\fms\alarm\ALARMLICHT.EXE'),
nil,
nil, sw_ShowNormal);
PlaySOUND(PChar('
hauptalarm.wav'),hInstance,snd_ASync );
SetMicrophoneVolumeMute(False);
mic_aus.Visible:=false;
end;
procedure TForm1.Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShellExecute(Application.Handle, '
open', PChar('
c:\programme\fms\alarm\ALARMLICHT.EXE'),
nil,
nil, sw_ShowNormal);
PlaySOUND(PChar('
kleinalarm.wav'),hInstance,snd_ASync );
SetMicrophoneVolumeMute(False);
mic_aus.Visible:=false;
end;
procedure TForm1.Button3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PlaySOUND(PChar('
hausdurchsage.wav'),hInstance,snd_ASync );
SetMicrophoneVolumeMute(False);
mic_aus.Visible:=false;
end;
procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
SetMicrophoneVolumeMute(True);
mic_aus.Visible:=true;
end;
procedure TForm1.Button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
SetMicrophoneVolumeMute(True);
mic_aus.Visible:=true;
end;
procedure TForm1.Button3MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
SetMicrophoneVolumeMute(True);
mic_aus.Visible:=true;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
SetMicrophoneVolumeMute(True);
mic_aus.Visible:=true;
end;
end.