const
MCI_SETAUDIO= $873;
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;
//类型定义
type MCI_DGV_SETAUDIO_PARMS=record
dwCallback
WORD;
dwItem
WORD;
dwValue
WORD;
dwOver
WORD;
lpstrAlgorithm
Char;
lpstrQuality
Char;
end;
TChannels=(Ch_Left,Ch_Right,Ch_Stereo,Ch_Mono);
procedure SwitchChinnel(MPlayer:TMediaplayer;ChSet:TChannels);
var
s: MCI_DGV_SETAUDIO_PARMS ;
begin
mciSendCommand(MPlayer.DeviceID,MCI_SETAUDIO,MCI_SET_OFF,integer(@s));
case ChSet of
ch_stereo:
s.dwValue:=MCI_DGV_SETAUDIO_SOURCE_STEREO;
//立体声用这句
ch_left:
s.dwValue:=MCI_DGV_SETAUDIO_SOURCE_LEFT;
//右声道源
ch_right:
s.dwValue:=MCI_DGV_SETAUDIO_SOURCE_RIGHT;
//右声道源
end;
mciSendCommand(MPlayer.DeviceID,MCI_SETAUDIO, MCI_DGV_SETAUDIO_VALUE ,integer(@s));
mciSendCommand(MPlayer.DeviceID,MCI_SETAUDIO, MCI_SET_ON,integer(@s));
end;
procedure TForm1.B1Click(Sender: TObject);
begin
SwitchChinnel(MPlayer,ch_left);
end;
procedure TForm1.B2Click(Sender: TObject);
begin
SwitchChinnel(MPlayer,ch_right);
end;
procedure TForm1.B3Click(Sender: TObject);
begin
SwitchChinnel(MPlayer,ch_stereo);
end;