Changeset 6689
- Timestamp:
- 06/25/09 10:51:20 (9 months ago)
- Files:
-
- 1 modified
-
trunk/liquidsoap/src/operators/noblank.ml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/operators/noblank.ml
r6527 r6689 54 54 end 55 55 56 class on_blank ~length ~threshold handlersource =56 class on_blank ~length ~threshold ~on_blank ~on_noise source = 57 57 object (self) 58 58 inherit operator [source] … … 75 75 if AFrame.is_partial ab || p0 > 0 then blank_len <- 0 else begin 76 76 self#check_blank ab p0 ; 77 if blank_len <= length then 78 in_blank <- false 79 else 77 if blank_len <= length then begin 78 if in_blank then begin 79 ignore (Lang.apply on_noise []) ; 80 in_blank <- false 81 end 82 end else 80 83 if not in_blank then begin 81 84 in_blank <- true ; 82 ignore (Lang.apply handler[])85 ignore (Lang.apply on_blank []) 83 86 end 84 87 end … … 232 235 ~category:Lang.TrackProcessing 233 236 ~descr:"Calls a given handler when detecting a blank." 234 (("",Lang.fun_t [] Lang.unit_t, None, None)::proto) 235 (fun p _ -> 236 let f = Lang.assoc "" 1 p in 237 (("", Lang.fun_t [] Lang.unit_t, None, 238 Some "Handler called when blank is detected."):: 239 ("on_noise",Lang.fun_t [] Lang.unit_t, 240 Some (Lang.val_cst_fun [] Lang.unit), 241 Some "Handler called when noise is detected."):: 242 proto) 243 (fun p _ -> 244 let on_blank = Lang.assoc "" 1 p in 245 let on_noise = Lang.assoc "on_noise" 1 p in 237 246 let p = List.remove_assoc "" p in 238 247 let length,threshold,s = extract p in 239 new on_blank ~length ~threshold fs) ;248 new on_blank ~length ~threshold ~on_blank ~on_noise s) ; 240 249 Lang.add_operator "skip_blank" 241 250 ~category:Lang.TrackProcessing
