如果使用Delphi代码来设置选中录音控制中的混音? ( 积分: 300 )

  • 主题发起人 主题发起人
  • 开始时间 开始时间

Unregistered / Unconfirmed
GUEST, unregistred user!
不能调用Windows自带的工具。帖出完整代码即可。
 
cnpack里面的控件好像支持,lz可以看看先
 
cnpack只是一个Delphi辅助工具吧?有这样的代码吗?
 
constantine 帮我解决一个难题吧,请和我联系 qq:23678132 我必有酬谢
 
有什么问题帖出来比较好的。
 
录音机的?用sendkey发送按键消息
 
开口闭口要代码!
肯出MONEY,我QQ的代码都有!
onstantine已经给出思路了,自已不知道研究一下呀!
 
www.ysza.com 看我的屏幕录像机,有自行封装的单元
qq:171833017
 
cnpack中的确有一个组件,CnVolumeCtrl,不过,它是控制放音的音量,而不是录音的。
 
路过,顶一下先。
 
你找找 AMxier控件 这个东西可以用的。。。
 
AMxier我有,而且用它写了一个利用摄像头录像的小程序。需要这个控件的话联系我。
联系方式到 http://www.jn2008.cn/ 找。
 
我看过了AMixer,它的演示程序有误,并不能解决混音的问题。甚至不能解决音量控制的问题,主要是可以使系统的音量变为静音,却不能恢复。
 
{
Author:dedema
Date:2007.10.15
录音控制单元
MMTool方案
}
unit WaveInControlUnit;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ExtCtrls, StdCtrls, MMMixer, MMDesign, MMObj, MMSlider, MMMixCtl,
MMPanel, MMMixBlk, MMDIBCv, MMLevel, MMCmpMan, MMHook, MMDevice;

type
TWaveInControlForm = class(TForm)
Bevel1: TBevel;
MixerControl: TMMMixerControl;
DestLine: TMMAudioLine;
MMCompManager1: TMMCompManager;
SamplePanel: TPanel;
Panel3: TPanel;
AddPanel: TPanel;
MMMixerBlock1: TMMMixerBlock;
MMMixerBlockLevel2: TMMMixerBlockLevel;
MMMixerBlockLabel4: TMMMixerBlockLabel;
MMMixerBlockLabel6: TMMMixerBlockLabel;
MMMixerBlockSlider3: TMMMixerBlockSlider;
MMMixerBlockSlider4: TMMMixerBlockSlider;
MMMixerBlockCheck2: TMMMixerBlockCheck;
Bevel2: TBevel;
Bevel3: TBevel;
MixerDevice1: TMMMixerDevice;
AudioLine1: TMMAudioLine;
MixerControl1: TMMMixerControl;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure MMMixerBlockCheck2MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
procedure MMMixerBlockCheck2KeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
private
FCloned : TList;
FAddProps : Boolean;
FOrigHeight : Integer;

function CreateLineControls(LineId: TMMLineId;
MixerIndex: Integer;
PrevW : Integer ) : Integer ;
procedure ClearLineControls;
procedure UpdateLineControls;
procedure SetHeight;
procedure CreateParams(var Params: TCreateParams);
override;
procedure GetCurrentLines(Lines: TList);
public
end;


var
wicf:TWaveInControlForm;

implementation


{$R *.DFM}

function TWaveInControlForm.CreateLineControls( LineId : TMMLineId;
MixerIndex : Integer;
PrevW : Integer ) : Integer ;
var
Block : TMMMixerBlock;
PanelOuter, Panel: TPanel;
begin

PanelOuter := MMCompManager1.CloneComponent(SamplePanel) as TPanel;
Panel := PanelOuter.Controls[1] as TPanel;
Block := Panel.Controls[1] as TMMMixerBlock;
FCloned.Add(Panel);
Block.Line := TMMAudioLine.Create(Self);
FCloned.Add(Block.Line);
FCloned.Add(PanelOuter);
Block.Line.Mixer := MixerDevice1;
Block.Line.LineId := LineId;

if (MixerIndex <> 0) and (MixerControl.Available) then

Block.Mixer := MixerControl;

if MixerIndex = 0 then

(Block.Mute as TMMMixerBlockCheck).Caption := '&amp;全选'
else
if Block.MuteKind = mkSelect then

(Block.Mute as TMMMixerBlockCheck).Caption := '&amp;选择'
else

(Block.Mute as TMMMixerBlockCheck).Caption := '&amp;静音';

PanelOuter.Visible := True;
PanelOuter.TabOrder := 0;
Result := PrevW + PanelOuter.Left + PanelOuter.Width;
end;


procedure TWaveInControlForm.ClearLineControls;
var
i: Integer;
begin

LockWindowUpdate(Handle);
try
for i := 0 to FCloned.Count - 1do

begin

TComponent(FCloned).Free;
end;

finally
LockWindowUpdate(0);
end;

FCloned.Clear;
FAddProps := False;
end;


procedure TWaveInControlForm.FormShow(Sender: TObject);
begin

FOrigHeight := Height - AddPanel.Height;
UpdateLineControls;
end;




procedure TWaveInControlForm.GetCurrentLines(Lines: TList);
var
i : Integer;
begin

Lines.Clear;
if AudioLine1.LineId <> badLineId then

begin

Lines.Add(Pointer(AudioLine1.LineId));

for i := 0 to AudioLine1.Connections - 1do

Lines.Add(Pointer(TMMLineId(AudioLine1.Connection)));
end;

end;



//显示关键的连接器
procedure TWaveInControlForm.UpdateLineControls;
var
Lines : TList;
i, W : Integer;
begin

ClearLineControls;//清除
AudioLine1.ComponentType := ctDstWaveIn;//这时LineId发生改变
DestLine.LineId :=AudioLine1.LineId;
MixerControl.ControlType := ctMixer;

if not MixerControl.Available then

MixerControl.ControlType := ctMux;

Caption := DestLine.LineInfo.Name;
Application.Title := Caption;

Lines := TList.Create;
try
GetCurrentLines(Lines);
W := 0;
LockWindowUpdate(Handle);
try
for i := Lines.Count - 1do
wnto 0do

W := CreateLineControls(TMMLineId(Lines),i,W);

ClientWidth := W ;
{do
not show bevel }
SetHeight;

finally
LockWindowUpdate(0);
end;

finally
Lines.Free;
end;

end;


procedure TWaveInControlForm.FormCreate(Sender: TObject);
begin

FCloned := TList.Create;
end;



procedure TWaveInControlForm.SetHeight;
begin

Height := FOrigHeight;
end;


procedure TWaveInControlForm.CreateParams(var Params: TCreateParams);
begin

inherited CreateParams(Params);
Params.Style := Params.Style and not WS_SIZEBOX;
end;


procedure TWaveInControlForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin

Action:=caFree;
FCloned.Free;

wicf:=nil;
end;


procedure TWaveInControlForm.MMMixerBlockCheck2MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin

if TMMMixerBlockCheck(Sender).Checked then

begin

Abort;
end;

end;



procedure TWaveInControlForm.MMMixerBlockCheck2KeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin

if TMMMixerBlockCheck(Sender).Checked then

begin

Abort;
end;

end;


end.
 
多人接受答案了。
 
后退
顶部