use mmSystem;
type TChannel=(cLeft,cRight,cBoth);
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 TForm1.Setchannel(Channel:TChannel);
var
S: MCI_DGV_SETAUDIO_PARMS ;
Err:integer;
Buf:array[0..100] of char;
begin
Err:=mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_SET_OFF ,integer(@s));
if(Err<>0)then
begin
mciGetErrorString(err,buf,sizeof(buf) );
ShowMessage('Set Audio Off Failed!');
ShowMessage(buf);
end;
Case Channel of
cLeft : S.dwValue:=MCI_DGV_SETAUDIO_SOURCE_LEFT;
cRight: S.dwValue:=MCI_DGV_SETAUDIO_SOURCE_RIGHT;
cBoth : S.dwValue:=MCI_DGV_SETAUDIO_SOURCE_STEREO;
end;
S.dwItem:=MCI_DGV_SETAUDIO_SOURCE;
Err:=mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_DGV_SETAUDIO_VALUE or MCI_DGV_SETAUDIO_ITEM ,integer(@s));
if(Err<>0)then
begin
mciGetErrorString(err,buf,sizeof(buf) );
ShowMessage('Set Channel Failed!');
ShowMessage(buf);
end;
Err:=mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_SET_ON ,integer(@s));
if(Err<>0)then
begin
mciGetErrorString(err,buf,sizeof(buf) );
ShowMessage('Set Audio On Failed!');
ShowMessage(buf);
end;
end;