Changeset 6693

Show
Ignore:
Timestamp:
06/28/09 23:03:17 (14 months ago)
Author:
smimram
Message:

Start experimenting a new idea: audio synthesis. Nothing to see for now though...

Location:
trunk/liquidsoap/src
Files:
3 added
4 modified
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/src/Makefile

    r6615 r6693  
    22SUBDIRS= operators sources tools formats protocols outputs io plugins stream \ 
    33         visualization lang analyze playlists ogg_formats video_converters \ 
    4          audio_converters 
     4         audio_converters synth 
    55 
    66DISTFILES = $(wildcard *.mli) Makefile \ 
     
    138138        request.ml source.ml root.ml \ 
    139139        stream/float_pcm_c.c stream/float_pcm.ml \ 
    140         stream/aFrame.ml stream/vFrame.ml 
     140        stream/aFrame.ml stream/vFrame.ml stream/mFrame.ml 
    141141 
    142142visualization = visualization/vumeter.ml \ 
     
    145145        $(if $(W_GL),visualization/vis_glvolume.ml) \ 
    146146        visualization/video_volume.ml 
     147 
     148synth = synth/keyboard.ml 
    147149 
    148150liquidsoap_sources= $(tools) SVN.ml audio_converter.ml $(stream) \ 
     
    156158        $(video_converters) $(audio_converters) \ 
    157159        $(ogg_utils) $(protocols) $(sources) $(operators) $(outputs) $(io) \ 
    158         $(analyze) $(playlists) $(visualization) $(formats) \ 
     160        $(analyze) $(playlists) $(visualization) $(synth) $(formats) \ 
    159161        shebang.ml \ 
    160162        lang/lang_builtins.ml \ 
     
    166168        -I tools -I lang -I playlists -I stream -I outputs -I formats \ 
    167169        -I video_converters -I sources -I operators -I io -I visualization \ 
    168         -I analyze -I ogg_formats -I audio_converters 
     170        -I analyze -I ogg_formats -I audio_converters -I synth 
    169171OCAML_LFLAGS= $(if $(BYTE),dynlink.cma) $(if $(W_RTP),-cclib -lortp) \ 
    170172                          $(if $(W_OPAL),-cclib -lopal) 
    171173DEP_OPTS= -I sources -I operators -I tools -I lang -I formats -I playlists \ 
    172174                  -I video_converters -I outputs -I io -I stream -I visualization \ 
    173                   -I analyze -I ogg_formats -I audio_converters 
     175                  -I analyze -I ogg_formats -I audio_converters -I synth 
    174176 
    175177liquidsoap_doc_sources= \ 
     
    186188        $(if $(W_OGG),ogg_encoder.ml ogg_demuxer.ml) \ 
    187189        stream/frame.ml stream/float_pcm.ml stream/aFrame.ml \ 
    188         stream/vFrame.ml stream/RGB.ml audio_converter.ml 
     190        stream/vFrame.ml stream/RGB.ml audio_converter.ml \ 
     191        stream/mFrame.ml 
    189192 
    190193top_srcdir=.. 
  • trunk/liquidsoap/src/stream/frame.ml

    r6448 r6693  
    2727type track_t = 
    2828  | Float_pcm_t of float_pcm_t 
    29   | Midi_t of Midi.header 
     29  | Midi_t 
    3030  | RGB_t 
    3131 
    3232type track = 
    3333  | Float_pcm of (float_pcm_t * float_pcm) 
    34   | Midi of (Midi.header * Midi.track ref) 
     34  | Midi of (int * Midi.event) list ref 
    3535  | RGB of RGB.t array 
    3636 
     
    6363      in 
    6464        Float_pcm (f, Array.create len 0.) 
    65   | Midi_t h -> 
    66       Midi (h, ref (Midi.create_track ())) 
     65  | Midi_t -> 
     66      Midi (ref (Midi.create_track ())) 
    6767  | RGB_t -> 
    6868      RGB (Array.init 
     
    9898let kind_of_track = function 
    9999  | Float_pcm (t, _) -> Float_pcm_t t 
    100   | Midi (h, _) -> Midi_t h 
     100  | Midi _ -> Midi_t 
    101101  | RGB _ -> RGB_t 
    102102 
     
    172172          let c x = int_of_float (float x *. r) in 
    173173            float_blit a (c src_pos) a' (c dst_pos) (c len) 
    174       | Midi (_,m), Midi (h,m') -> m' := !m 
     174      | Midi m, Midi m' -> m' := !m (* TODO: use parameters.... *) 
    175175      | RGB src, RGB dst -> 
    176176          (* TODO: handle offsets! *) 
  • trunk/liquidsoap/src/stream/frame.mli

    r6448 r6693  
    3939type track_t = 
    4040  | Float_pcm_t of float_pcm_t (** PCM data *) 
    41   | Midi_t of Midi.header (** MIDI data *) 
     41  | Midi_t (** MIDI data *) 
    4242  | RGB_t (** YUV video data *) 
    4343 
     
    4545type track = 
    4646  | Float_pcm of (float_pcm_t * float_pcm) (** PCM data *) 
    47   | Midi of (Midi.header * Midi.track ref) (** MIDI data *) 
     47  | Midi of (int * Midi.event) list ref (** MIDI data *) 
    4848  | RGB of RGB.t array (** YUV data as an array of frames *) 
    4949 
  • trunk/liquidsoap/src/stream/mFrame.ml

    r6030 r6693  
    11include Frame 
    2  
    3 let vot = Fmt.video_frames_of_ticks 
    4 let tov = Fmt.ticks_of_video_frames 
    5  
    6 let size t = vot (size t) 
    7 let position t = vot (position t) 
    8 let add_break t i = add_break t (tov i) 
    9  
    10 let set_metadata t i m = set_metadata t (tov i) m 
    11 let get_metadata t i = get_metadata t (tov i) 
    12  
    13 let get_rgb b = 
    14   let tracks = Array.to_list (Frame.get_tracks b) in 
    15   let ans = 
    16     List.fold_left 
    17       (fun l t -> 
    18          match t with 
    19            | RGB a -> a::l 
    20            | _ -> l 
    21       ) [] tracks in 
    22     Array.of_list ans 
  • trunk/liquidsoap/src/stream/mFrame.mli

    r6158 r6693  
    1 (** Video frame manipulation *) 
     1(** MIDI frame manipulation *) 
    22 
    33type t = Frame.t 
     
    1919val set_metadata     : t -> int -> metadata -> unit 
    2020val get_metadata     : t -> int -> metadata option 
    21  
    22 (** Get the contents of all video channels. *) 
    23 val get_rgb : t -> RGB.t array array 
  • trunk/liquidsoap/src/stream/midi.ml

    r6344 r6693  
    2626 
    2727type event = 
    28   | Note_off of int * int 
    29   | Note_on of int * int 
    30   | Aftertouch of int * int 
     28  | Note_off of int * float 
     29  | Note_on of int * float (** Note on: note number (A4 = 91), velocity (between 0 and 1). *) 
     30  | Aftertouch of int * float 
    3131  | Control_change of int * int 
    3232  | Patch of int