DSP_StreamCopy volume slides not included.

Started by Chris Oakley,

Chris Oakley

Why when I create a copy of a stream using DSP_StreamCopy() is the volume not copied?

When I do BASS_ChannelSlideAttribute, the slide happens on the source, but not on the copy.

Ian @ un4seen

The BASS_ATTRIB_VOL setting isn't applied in a channel's DSP processing but rather when generating the final mix (of all playing channels), so indeed it won't be present in a DSP_StreamCopy. You could apply the same BASS_ATTRIB_VOL setting to the copy too. If you would like to have a volume control that is applied in the DSP phase then you can use the BASS_ATTRIB_VOLDSP option instead, or if you would also like it to slide over time then the BASS_FX_VOLUME effect may be a better (smoother) option.

Chris Oakley

I thought about applying the same slide to the copy, but I've no idea how I could synchronize that.

I can't see in the documentation how you would use BASS_FX_VOLUME to create a slide.

Ian @ un4seen

Quote from: Chris OakleyI thought about applying the same slide to the copy, but I've no idea how I could synchronize that.

Perhaps you could just call BASS_ChannelSlideAttribute on both the source and copy? Another possibility is using this currently undocumented sync type:

#define BASS_SYNC_ATTRIB 13

The sync gets triggered whenever an attribute is changed (including by a slide), with the attribute's type in the SYNCPROC "data" parameter. You could have the SYNCPROC apply the attribute change on the copy too. This sync type is always "mixtime", so there's no need to specify the BASS_SYNC_MIXTIME flag, but you might do so anyway for clarity.

Quote from: Chris OakleyI can't see in the documentation how you would use BASS_FX_VOLUME to create a slide.

You would set the effect's "fTarget" parameter to the final volume level and the "fTime" parameter to the duration (in seconds) of the slide. For example:

BASS_FX_VOLUME_PARAM param = { volume, -1, time, 0 };
BASS_FXSetParameters(volfx, param);

Please see the BASS_FX_VOLUME_PARAM documentation for more info on it.

Chris Oakley

Thanks Ian. I looked the documentation for the BASS_FX but couldn't see a way to tell if there was a transition in progress, like the BASS_ChannelIsSliding property.

Ian @ un4seen

You can check if a BASS_FX_VOLUME effect is transitioning by calling BASS_FXGetParameters on it and comparing the "fTarget" and "fCurrent" values. Note that will be ahead of what's heard during playback due to buffering (see BASS_CONFIG_BUFFER/BASS_ATTRIB_BUFFER), ie. it may say a transition is finished while you're still hearing it.