BASS_ChannelSetPosition doesn't work for tail part (BASS_ATTRIB_TAIL)

Started by suathd,

suathd

I have to add some silence part to end of stream.
I applied BASS_ChannelSetAttribute with BASS_ATTRIB_TAIL.
It works fine.
BASS_ChannelGetPosition works successfully for tail part (silence part) also.

Unfortunatelly, user cannot navigate through silence part.

BASS_ChannelSetPosition doesn't work for silence part.


 


Ian @ un4seen

Indeed, it isn't currently possible to seek within the tail. BASS_ATTRIB_TAIL is primarily intended to allow reverb/echo effects to decay naturally instead of being cut-off at the end of a file, and effects get reset when seeking, so there'd be no nothing to hear when seeking in the tail. Are you using BASS_ATTRIB_TAIL for some other purpose?

If you happen to want to seek within the tail when already in it, then you could try adjusting BASS_ATTRIB_TAIL to simulate that, ie. make the tail end sooner or later.

suathd

Quote from: Ian @ un4seenAre you using BASS_ATTRIB_TAIL for some other purpose?

Yes.
Picture 1 shows an ordinary mixing from Track 1 to Track 2.



Picture 2 shows an extra-ordinary mixing from Track 1 to Track 2.
There is a Voice Track channel between them.



When I try to test from the Play Position, I need to use BASS_ChannelSetPosition on TAIL part.
When Tail Part is ended, Track 2 will start.

P.S: I can use BASS_ChannelSetSync on Voice Track for starting Track 2.
But it will make my current design too complicated.
Currently I disabled playing from the TAIL part.

 

Ian @ un4seen

Are you using BASSmix to mix the tracks? If not, perhaps you could try that. Using a mixer will ensure that each track starts at exactly the wanted position, which you can set via the BASS_Mixer_StreamAddChannelEx "start" parameter (or a mixtime BASS_POS_SYNC sync that calls BASS_Mixer_StreamAddChannel). Seeking would involve resetting each track to where it should be at the wanted position in the mix. Stop the mixer before doing that, so it isn't processed in the meantime:

BASS_ChannelStop(mixer);
// reset the mixer's sources here
BASS_ChannelStart(mixer);

suathd

I cannot use mixer for this purpose. It causes some delays while playing tracks.

if it is not easy to make BASS_ChannelSetPosition working for Tail part also, I will create may own tail (a dummy silent channel). But it will make my current codes too complicated and probably will cause some unexpected bugs.

P.S: I use mixer for just rendering tracks to single file and streaming to web.

thank you very much...

Ian @ un4seen

Quote from: suathdI cannot use mixer for this purpose. It causes some delays while playing tracks.

It is possible to avoid any delay/latency from the mixer by setting BASS_ATTRIB_BUFFER=0 on it to disable playback buffering, but note that may make it less resilient to any processing delays, eg. if a source decoder takes too long then you may hear a break/crack in the sound. The chances of that happening can be reduced by setting BASS_ASYNCFILE on the sources to enable async file reading. You could also enable multiple mixing threads via BASS_ATTRIB_MIXER_THREADS.