Author Topic: BASS_FXSetParameters for fade out and fade in  (Read 636 times)

lumoraes

  • Posts: 22
begin
  pR.fTarget          :=0.20;
  pR.fCurrent         :=-1;
  pR.fTime            :=2;
  pR.lCurve           :=0;

  fx:= BASS_ChannelSetFX(strs[0], BASS_FX_VOLUME,1);
  BASS_FXSetParameters(fx,@pR);
end;

In the code above, there is a fade out of 2 seconds for volume 0.20, how do I go back to normal volume?.


I tried the code below but it didn't work

begin
  pR.fTarget          :=1;
  pR.fCurrent         :=-1;
  pR.fTime            :=2;
  pR.lCurve           :=0;

  fx:= BASS_ChannelSetFX(strs[0], BASS_FX_VOLUME,1);
  BASS_FXSetParameters(fx,@pR);
end;



MB_SOFT

  • Posts: 496
Re: BASS_FXSetParameters for fade out and fade in
« Reply #1 on: 4 Oct '22 - 12:04 »
why don't you use BASS_ChannelSlideAttribute ?

Ian @ un4seen

  • Administrator
  • Posts: 26108
Re: BASS_FXSetParameters for fade out and fade in
« Reply #2 on: 4 Oct '22 - 12:28 »
You shouldn't call BASS_ChannelSetFX again, but rather retain the handle from the first call and use it again in the second BASS_FXSetParameters call. Calling BASS_ChannelSetFX twice will give you two volume controls, and the first one will still be at 0.20 in your example.

lumoraes

  • Posts: 22
Re: BASS_FXSetParameters for fade out and fade in
« Reply #3 on: 4 Oct '22 - 14:44 »
Hey, thanks for the help.
A question, in the example what happens to the first identifier after the audio finishes being played?.
Is there a way to remove the effect after your team is applied?

Ian @ un4seen

  • Administrator
  • Posts: 26108
Re: BASS_FXSetParameters for fade out and fade in
« Reply #4 on: 4 Oct '22 - 16:20 »
Do you mean when the stream is freed, eg. you call BASS_StreamFree on it? If so, the "fx" handle will become invalid because all of the stream's resources (including effects) will be freed then. If you want to remove the volume effect before the stream is freed, you can use BASS_ChannelRemoveFX to do so.

lumoraes

  • Posts: 22
Re: BASS_FXSetParameters for fade out and fade in
« Reply #5 on: 5 Oct '22 - 13:00 »
Thanks for help

Another doubt:

In the parameters of BASS_FX_VOLUME_PARAM the Target field above 1 is gained, what is the limit? what would be the maximum value?.

Thanks


Ian @ un4seen

  • Administrator
  • Posts: 26108
Re: BASS_FXSetParameters for fade out and fade in
« Reply #7 on: 5 Oct '22 - 14:22 »
There is no limit, but note that high values may result in distortion.