(Moderator)
Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
Delphi 2006 Professional
|
Re: Tonausgabe komplett abschalten
15. Nov 2006, 07:22
ich hab den Ton bisher so abgeschalten in einem meiner Programme:
Delphi-Quellcode:
class function TDeskSwitcher.SetMute(AMute: Boolean): Boolean;
function GetMasterMute(AMixer: hMixerObj; var AMixerControl: TMixerControl): Boolean;
var LMixerLine: TMixerLine;
LMixerLineCtrls: TMixerLineControls;
begin
ZeroMemory(@LMixerLine, SizeOf(LMixerLine));
LMixerLine.cbStruct := SizeOf(LMixerLine);
LMixerLine.dwComponentType := MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if mixerGetLineInfo(AMixer, @LMixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) = MMSYSERR_NOERROR then
begin
ZeroMemory(@LMixerLineCtrls, SizeOf(LMixerLineCtrls));
LMixerLineCtrls.cbStruct := SizeOf(LMixerLineCtrls);
LMixerLineCtrls.dwLineID := LMixerLine.dwLineID;
LMixerLineCtrls.cControls := 2;
LMixerLineCtrls.dwControlType := MIXERCONTROL_CONTROLTYPE_MUTE;
LMixerLineCtrls.cbmxctrl := SizeOf(AMixerControl);
LMixerLineCtrls.pamxctrl := @AMixerControl;
result := MMSYSERR_NOERROR = mixerGetLineControls(AMixer, @LMixerLineCtrls, MIXER_GETLineCONTROLSF_ONEBYTYPE);
end else
result := False;
end;
var LMasterControl: TMixerControl;
LDetails: TMixerControlDetails;
LBoolDetails: TMixerControlDetailsBoolean;
begin
if GetMasterMute(0, LMasterControl) then
begin
with LDetails do
begin
cbStruct := SizeOf(LDetails);
dwControlID := LMasterControl.dwControlID;
cChannels := 1;
cMultipleItems := 0;
cbDetails := SizeOf(LBoolDetails);
paDetails := @LBoolDetails;
end;
LongBool(LBoolDetails.fValue) := AMute;
result := MMSYSERR_NOERROR = mixerSetControlDetails(0, @LDetails, MIXER_SETCONTROLDETAILSF_VALUE);
end else
result := False;
end;
Jens Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
|
|
Zitat
|