Examples Delphi

This article describes a simple way to set left and right channel volumes separately.
Changing Left and Right channel volumes separately:
By : Pooia Lalbakhsh
MS in Computer Engineering
These two procedures illustrated bellow set the volumes
of right and left channels separately.
Using Waveoutsetvolume from MMsystem you can set the wave out volme.
to do this you have to set the value into a Dword variable:
The 2 low order bytes : volume for the left channel which can be something
between 0 upto 65535
The 2 high order bytes : volume for the right channel which can be sonething
between 0 upto 65535
using these procedures you can set the channels separately:
uses MMsystem
Procedure Left_volume (value : Dword);
var Rvol, temp : Dword;
begin
waveoutgetvolume(WAVE_MAPPER, @temp);//returns the current volume
Rvol := hiword (temp);
asm
shl Rvol, 16
end;
Rvol := Rvol and $ffff0000;
waveoutsetvolume(WAVE_MAPPER, value or Rvol);
end;
Procedure Right_volume (value : Dword);
var Lvol, temp : Dword;
begin
waveoutgetvolume(WAVE_MAPPER, @temp);
Lvol := Loword (temp);
asm
shl value, 16
end;
value := value and $ffff0000;
waveoutsetvolume(WAVE_MAPPER, value or Lvol);
end;