Changeset 6668

Show
Ignore:
Timestamp:
06/20/09 12:55:39 (15 months ago)
Author:
dbaelde
Message:

Remove the "strict" parameter of random(), replacing random(strict=true)
by the new operator rotate(). This is probably clearer.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/src/operators/switch.ml

    r6527 r6668  
    455455 
    456456let () = 
    457     Lang.add_operator "random" ~category:Lang.TrackProcessing 
     457  let add name strict descr weight_descr = 
     458    Lang.add_operator name ~descr ~category:Lang.TrackProcessing 
    458459      (common @ 
    459460       [ "weights", Lang.list_t Lang.int_t, Some (Lang.list []), 
    460          Some "Weights of the children in the choice." ; 
    461          "strict", Lang.bool_t, Some (Lang.bool false), 
    462          Some "Do not use random but cycle over the uniform distribution." ; 
     461         Some weight_descr ; 
    463462         "", Lang.list_t Lang.source_t, None, None ]) 
    464       ~descr:"At the beginning of every track, select a random ready child." 
    465463      (fun p _ -> 
    466464         let children = Lang.to_source_list (List.assoc "" p) in 
     
    473471             Utils.make_list (List.length children) 1 
    474472         in 
    475          let strict = Lang.to_bool (List.assoc "strict" p) in 
    476473         let children = 
    477474           if List.length weights <> List.length children then 
     
    488485         in 
    489486           new random ~replay_meta strict ts children) 
     487  in 
     488    add "random" false 
     489      "At the beginning of every track, select a random ready child." 
     490      "Weights of the children (padded with 1), defining for each child \ 
     491       the probability that it is selected." ; 
     492    add "rotate" true 
     493      "Rotate between the sources." 
     494      "Weights of the children (padded with 1), defining for each child \ 
     495       how many tracks are played from it per round, if that many are \ 
     496       actually available."