const MediaAliasName='MyMp3'; procedure TMainFrm.MySetAudio(Value:byte); var SetAs,retstr:string; begin case Value of 1: begin mcisendstring('set all audio all on',nil,0,handle); SetAs:='stereo'; n7.Checked :=true; if FrmDisplayScr.visible then FrmDisplayScr.n7.Checked :=true; lbSoundLR.Caption :='立体声'; end; 2: begin mcisendstring('set all audio all on',nil,0,handle); SetAs:='left' ; n8.Checked :=true; if FrmDisplayScr.visible then FrmDisplayScr.n8.Checked :=true; lbSoundLR.Caption :='左声道'; end; 3: begin mcisendstring('set all audio all on',nil,0,handle); SetAs:='right'; n9.checked :=true; if FrmDisplayScr.visible then FrmDisplayScr.n9.Checked :=true; lbSoundLR.Caption :='右声道'; end ; 4: begin mcisendstring('set all audio all on',nil,0,handle); SetAs:='average'; lbSoundLR.Caption :='平均'; end; 5: begin lbSoundLR.Caption :='静音'; mcisendstring('set all audio all off',nil,0,handle); n10.Checked :=true; if FrmDisplayScr.Visible then FrmDisplayScr.n10.Checked :=true; exit; end; end;
if fileopened then begin retstr:= AudioSource(MediaAliasName,SetAs ); if retstr<>'ok' then showinformation(retstr); end; end; if fileopened then begin retstr:= AudioSource(MediaAliasName,SetAs ); if retstr<>'ok' then showinformation(retstr); end; end;
//设置音频输入源的声道转换 {说明: source:可以是left(左声道),right(右声道),average(平均),stereo(立体声)} function AudioSource(AliasName:String; Source:String):String; begin cmd := 'Setaudio ' + AliasName + ' source to ' + Source; dwReturn := mciSendString(pchar(cmd), nil, 0, 0); If Not (dwReturn = 0) Then begin ret:=@MCIReturn; mciGetErrorString (dwReturn, ret, 128); Result := ret; Exit; End; Result := 'ok'; end;