Author Topic: How to set volume(left,right)  (Read 251 times)

udo

  • Posts: 29
How to set volume(left,right)
« on: 10 Jan '17 - 17:41 »
Hello,

how can i implement volume-balance?
I see at BassAsio i can use BassAsio.BASS_ASIO_ChannelSetVolume(false, channelNo, volume);
But how about BassWasapi and Bass?

thanks

Ian @ un4seen

  • Administrator
  • Posts: 20499
Re: How to set volume(left,right)
« Reply #1 on: 11 Jan '17 - 15:20 »
The BASS_ATTRIB_PAN attribute is a balance control. If you would like to have separate left and right volume controls (like with BASS_ASIO_ChannelSetVolume), it is possible to implement that by using a combination of BASS_ATTRIB_VOL and BASS_ATTRIB_PAN settings, like this:

Code: [Select]
BOOL SetLeftRightVol(DWORD handle, float left, float right)
{
float vol, pan;
if (left==right) {
vol=left;
pan=0;
} else if (left>right) {
vol=left;
pan=-1+(right/left);
} else {
vol=right;
pan=1-(left/right);
}
return BASS_ChannelSetAttribute(handle, BASS_ATTRIB_VOL, vol)
&& BASS_ChannelSetAttribute(handle, BASS_ATTRIB_PAN, pan);
}

udo

  • Posts: 29
Re: How to set volume(left,right)
« Reply #2 on: 12 Jan '17 - 22:05 »
Thank you very much  :)