Author Topic: Transition effect songs  (Read 1089 times)

Sariman

  • Posts: 13
Transition effect songs
« on: 31 Oct '12 - 19:16 »
Hello! I want that when you switch songs on listbox, was the effect of damping plays songs in 3 seconds and fade songs with the same interval, help please, thanks in advance!

I'm from Russia, if not properly written, do not judge strictly, used a translator :)

Xero

  • Posts: 18
Re: Transition effect songs
« Reply #1 on: 1 Nov '12 - 05:19 »
You want to crossfade?
If so you can use a timer to to reduce the volume on one song, and to increase the volume of the other song.  :)

Sariman

  • Posts: 13
Re: Transition effect songs
« Reply #2 on: 1 Nov '12 - 12:37 »
Yes, I'm talking about the crossfader, the timer is much load on the system, and how to implement it through BASS_ChannelSlideAttribute?
« Last Edit: 1 Nov '12 - 13:16 by Sariman »

SoundMike

  • Posts: 331
Re: Transition effect songs
« Reply #3 on: 2 Nov '12 - 01:25 »
Just use something like this:

Code: [Select]
BASS_ChannelSlideAttribute(channel1, BASS_ATTRIB_VOL, -1, 3000);
BASS_ChannelSlideAttribute(channel2, BASS_ATTRIB_VOL, 1, 3000);

This will simultaneously fade out and stop channel1 and fade in channel2 to maximum volume. A volume setting of -1 (or any negative value) means "fade-out and then stop". A volume setting of 1 is full volume, so set this to your required volume in the range 0 to 1.

Sariman

  • Posts: 13
Re: Transition effect songs
« Reply #4 on: 2 Nov '12 - 13:01 »
It's clear, but Channel2 not loaded, what to do?

Ops2011

  • Guest
Re: Transition effect songs
« Reply #5 on: 2 Nov '12 - 15:30 »
Working with fade you need at least two Streams.
And previous, noticed message 'SoundMike' it fadeOut song for 3 seconds (and stop, free stream) and FadeIn for 3 seconds.
You must calculate if the song had reach end position minus 3 seconds.     
Not an easy task if you want it superb.
 

Sariman

  • Posts: 13
Re: Transition effect songs
« Reply #6 on: 2 Nov '12 - 15:47 »
Thank you, for sure someone is already implemented, are there any examples? to see how it is implemented.

SoundMike

  • Posts: 331
Re: Transition effect songs
« Reply #7 on: 3 Nov '12 - 00:32 »
Could you post what you've got so far? It will be easier for us to add to or change that.

The whole process does require some thought. After the normal BASS initialisation etc you will need to create a stream for each file you want to play, although you probably only need two streams created at any time - one stream for the currently playing file and the other stream for the next file to be played. After creating a stream, if you want 3-second cross-fades then get the channel length and set a channel sync position 3 seconds before the expected end. Set the volume initially to 0 (silent) for the 2nd and subsequent channels as they will be faded in for the cross-fade. Then start playing the first channel.

In the callback for your sync point (3 seconds before the end of the file), start playing the next channel and then issue the two slides to fade out the current channel (channel1 in the example) and fade in the new channel (channel2 in the example).