Author Topic: Seperate control of speakers Problem  (Read 2965 times)

Slayers

  • Posts: 8
Seperate control of speakers Problem
« on: 26 Sep '11 - 00:35 »
Hey...

I want to set the Volume of each speaker separately. I code in Vb.Net

my current code :

Code: [Select]
Dim volfx As Integer = Bass.BASS_ChannelSetFX(frm_main.Stream, BASSFXType.BASS_FX_BFX_VOLUME, 0)
        Dim volparam As New BASS_BFX_VOLUME
        With volparam
            .lChannel = BASSFXChan.BASS_BFX_CHAN1
            .fVolume = num_sound_front_left.Value
        End With

        Bass.BASS_FXSetParameters(volfx, volparam)

Ive also tried to set "AddOn.Fx.BassFx.BASS_FX_GetVersion()" in form load event.
But still doesen´t work. How to figure it out ?

Ian @ un4seen

  • Administrator
  • Posts: 20424
Re: Seperate control of speakers Problem
« Reply #1 on: 26 Sep '11 - 16:53 »
Are the calls reporting success, ie. "volfx" is not 0 and BASS_FXSetParameters returns TRUE? If either call failed, please use BASS_ErrorGetCode to find out what went wrong.

Slayers

  • Posts: 8
Re: Seperate control of speakers Problem
« Reply #2 on: 26 Sep '11 - 19:40 »
Okay. Ive looked if the volfx is not 0 and no error Code is given. But i think the funktion doesn´t work correctly. If i set the Value to 0 to mute the Left speaker and if i want to Fade it slowly up. The value i set doesn´t have any effect.

Example :
I set it to 0 and then, i fade it from 0 to 0.1 , 0.2, 0.3 ...
But doesn´t has eny effect. But no error ist given and volfx is not 0

What i´m doing wrong  ???

Ian @ un4seen

  • Administrator
  • Posts: 20424
Re: Seperate control of speakers Problem
« Reply #3 on: 27 Sep '11 - 15:58 »
Are you calling BASS_ChannelSetFX again for each volume change? If so, that will be the cause of the problem, as all of the preceding volume effects will still be applied (unless you call BASS_ChannelRemoveFX to remove them). You should only call BASS_ChannelSetFX once (eg. store "volfx" in a global variable), and then just use BASS_FXSetParameters to change the parameters.

Another way that you can have separate left/right volume control is by using the BASS_ATTRIB_PAN attribute in combination with the BASS_ATTRIB_VOL attribute. Something 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);
}

Slayers

  • Posts: 8
Re: Seperate control of speakers Problem
« Reply #4 on: 29 Sep '11 - 07:09 »
Thx for your reply.

I don't want to set balance. I want to set the volume for each speaker separately.

Now I have got the next problem. I have my Handle declared globally. And the volfx variable for each speaker to. Now i save the value of each speaker (numeric up down) to a ini. But if I load the ini I can't load and set the fx params. I use the same function as I use to change it via num up down.

Why it doesn't work correct ?