Changeset 6707
- Timestamp:
- 07/01/09 14:15:47 (9 months ago)
- Location:
- trunk/liquidsoap/src
- Files:
-
- 4 modified
-
formats/midiformat.ml (modified) (3 diffs)
-
synth/synth.ml (modified) (1 diff)
-
synth/synth_op.ml (modified) (4 diffs)
-
visualization/midimeter.ml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/formats/midiformat.ml
r6705 r6707 310 310 (* Filling function. *) 311 311 let track = ref track in 312 let warn_channels = ref true in 312 313 let fill buf = 313 314 let m = MFrame.tracks buf in … … 319 320 while !track <> [] && !offset_in_buf < buflen do 320 321 let d,(c,e) = List.hd !track in 321 (* Printf.printf "delta: %d\n%!" d; *)322 322 offset_in_buf := !offset_in_buf + d; 323 323 if !offset_in_buf < buflen then … … 330 330 | Midi.Note_on _ 331 331 | Midi.Note_off _ -> 332 (* Printf.printf "EVENT (chan %d)!\n%!" c; *) 333 m.(c) := !(m.(c))@[!offset_in_buf, e] 332 ( 333 try 334 m.(c) := !(m.(c))@[!offset_in_buf, e] 335 with 336 | Invalid_argument _ -> 337 if !warn_channels then 338 ( 339 log#f 3 "Event on channel %d will be ignored, increase frame.midi.channels (this message is displayed only once)." c; 340 warn_channels := false 341 ) 342 ) 334 343 | _ -> () (* TODO *) 335 344 ) -
trunk/liquidsoap/src/synth/synth.ml
r6702 r6707 46 46 method note_on n v = 47 47 (* Limit the number of notes for now. TODO: parameter *) 48 if List.length notes > 16 then notes <- List.rev (List.tl (List.rev notes));48 (* if List.length notes > 16 then notes <- List.rev (List.tl (List.rev notes)); *) 49 49 notes <- (n, ref (self#note_init n v))::notes 50 50 -
trunk/liquidsoap/src/synth/synth_op.ml
r6701 r6707 34 34 method remaining = source#remaining 35 35 36 method is_ready = 37 source#is_ready 36 method is_ready = source#is_ready 38 37 39 38 method abort_track = source#abort_track … … 44 43 let evs = !evs in 45 44 source#get buf; 45 if blankify then AFrame.blankify buf offset (AFrame.size buf - offset); 46 46 let b = AFrame.get_float_pcm buf in 47 47 let position = AFrame.position buf in … … 69 69 [ 70 70 "channel", Lang.int_t, Some (Lang.int 0), Some "MIDI channel to handle."; 71 "volume", Lang.float_t, Some (Lang.float 0.3), Some " Volume.";71 "volume", Lang.float_t, Some (Lang.float 0.3), Some "Initial volume."; 72 72 "", Lang.source_t, None, None 73 73 ] … … 79 79 let volume = Lang.to_float (f "volume") in 80 80 let src = Lang.to_source (f "") in 81 new synth (obj ()) src chan volume) 81 new synth (obj ()) src chan volume); 82 Lang.add_operator ("synth.all." ^ name) 83 [ 84 "", Lang.source_t, None, None 85 ] 86 ~category:Lang.SoundSynthesis 87 ~descr:(descr ^ " It creates one synthesizer for each channel.") 88 (fun p _ -> 89 let f v = List.assoc v p in 90 let src = Lang.to_source (f "") in 91 let synths = Array.init (Fmt.midi_channels ()) (fun c -> 1, new synth (obj ()) src c 1.) in 92 let synths = Array.to_list synths in 93 new Add.add ~renorm:false synths 94 (fun _ -> ()) 95 (fun _ buf tmp -> RGB.add buf tmp) 96 ) 82 97 83 let () = register (fun () -> (new Synth.sine :> Synth.synth)) "sine" "Sine synthesi ser."84 let () = register (fun () -> (new Synth.square :> Synth.synth)) "square" "Square synthesi ser."85 let () = register (fun () -> (new Synth.saw :> Synth.synth)) "saw" "Saw synthesi ser."98 let () = register (fun () -> (new Synth.sine :> Synth.synth)) "sine" "Sine synthesizer." 99 let () = register (fun () -> (new Synth.square :> Synth.synth)) "square" "Square synthesizer." 100 let () = register (fun () -> (new Synth.saw :> Synth.synth)) "saw" "Saw synthesizer." -
trunk/liquidsoap/src/visualization/midimeter.ml
r6701 r6707 46 46 | _ -> "???" 47 47 in 48 Printf.printf "% d: %s.\n%!" c s48 Printf.printf "%02d: %s.\n%!" c s 49 49 ) !(m.(c)) 50 50 done
