Changeset 6700

Show
Ignore:
Timestamp:
06/30/09 09:17:25 (14 months ago)
Author:
smimram
Message:

Saw synth.

Location:
trunk/liquidsoap/src/synth
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/src/synth/synth.ml

    r6698 r6700  
    9292 
    9393class square = object inherit simple (fun x -> let x = fst (modf x) in if x < 0.5 then 1. else -1.) end 
     94 
     95class saw = 
     96object 
     97  inherit simple 
     98    (fun x -> 
     99       let x = fst (modf x) in 
     100         if x < 0.5 then 
     101           4. *. x -. 1. 
     102         else 
     103           4. *. (1. -. x) -. 1. 
     104    ) 
     105    as super 
     106 
     107  method note_init n v = { (super#note_init n v) with simple_phase = 0.25 } 
     108end 
  • trunk/liquidsoap/src/synth/synth_op.ml

    r6696 r6700  
    8181       let src = Lang.to_source (f "") in 
    8282         new synth (new Synth.square :> Synth.synth) src 0) 
     83 
     84let () = 
     85  Lang.add_operator "synth.saw" 
     86    [ "", Lang.source_t, None, None ] 
     87    ~category:Lang.SoundSynthesis 
     88    ~descr:"Saw synthesiser." 
     89    (fun p _ -> 
     90       let f v = List.assoc v p in 
     91       let src = Lang.to_source (f "") in 
     92         new synth (new Synth.saw :> Synth.synth) src 0)