先定义:
const
MCI_SETAUDIO= $873;
MCI_SETVIDEO=$0876;
MCI_DGV_SETAUDIO_SOURCE_LEFT=1;
MCI_DGV_SETAUDIO_SOURCE_STEREO=0;
MCI_DGV_SETAUDIO_SOURCE_RIGHT=2;
MCI_DGV_SETAUDIO_SOURCE=$4004;
MCI_DGV_SETAUDIO_VALUE=$01000000;
MCI_DGV_SETAUDIO_ITEM=$00800000;
type MCI_DGV_SETAUDIO_PARMS=record
dwCallback
WORD;
dwItem
WORD;
dwValue
WORD;
dwOver
WORD;
lpstrAlgorithm
Char;
lpstrQuality
Char;
end
再在程序中写下:
procedure TMainForm.VoiceControl(chanel
word);
var
t: MCI_DGV_SETAUDIO_PARMS
error:integer;
buf:array[0..1000] of char;
begin
//选声道
t.dwvalue:=chanel;
t.dwItem:=MCI_DGV_SETAUDIO_SOURCE;
error:=mciSendCommandMediaPlayer1.DeviceID,MCI_SETAUDIO,
MCI_DGV_SETAUDIO_VALUEor MCI_DGV_SETAUDIO_ITEM ,integer(@t));
if(error<>0)then
begin
mciGetErrorString(error,buf,sizeof(buf) );
ShowMessage(buf);
end;
end;