hi thanks for your guide now im using interactive.float to change the crossfade behaviour and works very well so far.is there any better way than this? 
count_jingle  = interactive.float("count_jingle",0.)
jingle_period = interactive.float("jingle_period",3.)

 def smart_crossfade (jingles, ~start_next=30.,~fade_in=3.,
    ~fade_out=3., ~width=2.,
    ~conservative=false,s)
   
      high   = -20.
      medium = -32.
      margin = 4.

      log = log(label="smart_crossfade")
      log("activate smart crossfade")

      def transition(jingles,a,b,ma,mb,sa,sb)
            if count_jingle() == 0. then
                log("jingle transition")
                add(normalize=false,[
                    fade.final(type="sin",duration=13.,sa),
                    sequence(merge=false,[blank(duration=14.),fade.in(type="sin",duration=16.,sb)]),
                    sequence(merge=false,[blank(duration=7.5),once(jingles)])
                ])               
            else
                log("normal transition")
               
                if
                  a <= medium and
                  b <= medium and
                  abs(a - b) <= margin
                then
                  log("Transition: crossed, fade-in, fade-out.")
                  add(normalize=false,[fade.out(type="sin", duration=3.,sa),sequence([blank(duration=25.),fade.in(type="sin", duration=3.,sb)])])
                elsif
                  b >= a + margin and a >= medium and b <= high
                then
                  log("Transition: crossed, fade-out.")
                  add(normalize=false,[fade.out(type="sin", duration=3.,sa),sequence([blank(duration=25.),sb])])
                elsif
                  b >= a + margin and a <= medium and b <= high
                then
                  log("Transition: crossed, no fade-out.")
                  add(normalize=false,[sa,sequence([blank(duration=25.),sb])])
                elsif
                  a >= b + margin and b >= medium and a <= high
                then
                  log("Transition: crossed, fade-in.")
                  add(normalize=false,[sa,sequence([blank(duration=25.),fade.in(type="sin", duration=3.,sb)])])
                else
                  log("No transition: just sequencing.")
                  sequence([sa, sb])
                end
           
            end
      end

      smart_cross(width=width, duration=start_next,
                  conservative=conservative,
                  transition(jingles),s)
    end



On Tue, May 25, 2010 at 2:47 PM, David Baelde <david.baelde@gmail.com> wrote:
Hi,

2010/5/23 budi prakosa <iyok@deadmediafm.org>:
>     songs_crossfade = smart_crossfade(conservative=true, songs)
>     songs_jingle = cross(crossjingle(jingles), songs)
>     radio = rotate(weights=[1,4],[jingles, songs])

This cannot work: After you crossfade in the first line, your stream
is made of a single continuous track. No more track limit, and hence,
no possibility to cross tracks or insert jingles between tracks.

You should try to use only one cross() operator. To achieve the
insertion of jingles, you could maintain the number of times your
crossing function has been called: 0, 1, 2, 3 (jingle), 4, 5, 6, 7
(jingle), etc. This can be done using interactive.string()/float() if
you're not using SVN, or real references otherwise.

I'm pretty sure this is a bit cryptic, but I don't have time for more
details. Feel free to ask more questions when you get stuck again.

Good luck,
--
David