Changing Left and Right channel volumes separately:

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;
   waveoutgetvolume(WAVE_MAPPER, @temp);//returns the current volume

   Rvol := hiword (temp);
     shl Rvol, 16
   Rvol := Rvol and $ffff0000;
   waveoutsetvolume(WAVE_MAPPER, value or Rvol);

Procedure Right_volume (value : Dword);
var Lvol, temp : Dword;
   waveoutgetvolume(WAVE_MAPPER, @temp);
   Lvol := Loword (temp);
     shl value, 16
   value := value and $ffff0000;
   waveoutsetvolume(WAVE_MAPPER, value or Lvol);


Share this article!

Follow us!

Find more helpful articles: