X-Git-Url: https://scm.cri.minesparis.psl.eu/git/Faustine.git/blobdiff_plain/23922b6f3a5f9813b822b4c60f05c8f2e384b070..7aa377f6b67020aa1dff235ebb100943375cac94:/interpretor/faustexp.ml?ds=sidebyside

diff --git a/interpretor/faustexp.ml b/interpretor/faustexp.ml
index 8ad37aa..ea50c66 100644
--- a/interpretor/faustexp.ml
+++ b/interpretor/faustexp.ml
@@ -7,6 +7,7 @@
 
 open Types;;
 open Basic;;
+open Symbol;;
 open Value;;
 open Signal;;
 open Beam;;
@@ -18,11 +19,11 @@ exception Process_error of string;;
 class dimension : int * int -> dimension_type = 
   fun (init : int * int) -> 
     object (self)
-      val dim_input = fst init
-      val dim_output = snd init
+      val _input = fst init
+      val _output = snd init
 
-      method input = dim_input
-      method output = dim_output
+      method input = _input
+      method output = _output
 
       method par : dimension_type -> dimension_type = 
 	fun dim -> 
@@ -115,7 +116,7 @@ class proc_const : faust_exp -> process_type =
       end;;
 
 
-class exp_ident : faust_exp -> process_type = 
+class proc_ident : faust_exp -> process_type = 
   fun (exp_init : faust_exp) ->
     object (self)
       val _exp = exp_init
@@ -123,21 +124,65 @@ class exp_ident : faust_exp -> process_type =
 	match exp_init with
 	| Ident s -> s
 	| _ -> raise (Process_error "ident process constructor.")
-      val _dim = dimension_of_symbol _symbol
-      val _delay = 0
-      
+
+      val _dim = new dimension (dimension_of_symbol _symbol)
+      val _delay = delay_of_symbol _symbol      
 
       method exp = _exp
       method dim = _dim
       method delay = _delay
-      method const = _const
+      method symb = _symbol
+
+      method private beam_of_ident : int -> signal_type -> beam_type = 
+	fun (n : int) ->
+	  fun (s, signal_type) ->
+	    if n = (self#dim)#input then 
+	      new beam [|s|]
+	    else raise (Process_error ("Ident " ^ string_of_symbol self#symb))
 
       method eval : beam_type -> beam_type = 
 	fun (input : beam_type) ->
-	  if input = [||] then
-	    new beam [| new signal 0 (fun t -> new value self#const)|]
-	  else
-	    raise (Process_error "proc_const accepts no input.")
+	  let n = Array.length input#get in
+	  match self#symb with
+	  | Pass -> self#beam_of_ident n input#get.(0)
+	  | Stop -> if n = 1 then new beam [||] 
+	            else raise (Process_error "Ident !")
+	  | Add -> self#beam_of_ident n ((input#get.(0))#add input#get.(1))
+	  | Sub -> self#beam_of_ident n ((input#get.(0))#sub input#get.(1))
+	  | Mul -> self#beam_of_ident n ((input#get.(0))#mul input#get.(1))
+	  | Div -> self#beam_of_ident n ((input#get.(0))#div input#get.(1))
+	  | Mem -> self#beam_of_ident n ((input#get.(0))#mem)
+	  | Delay -> self#beam_of_ident n ((input#get.(0))#delay input#get.(1))
+	  | Floor -> self#beam_of_ident n ((input#get.(0))#floor)
+	  | Int -> self#beam_of_ident n ((input#get.(0))#int)
+	  | Sin -> self#beam_of_ident n ((input#get.(0))#sin)
+	  | Cos -> self#beam_of_ident n ((input#get.(0))#cos)
+	  | Atan -> self#beam_of_ident n ((input#get.(0))#atan)
+	  | Atan2 -> self#beam_of_ident n ((input#get.(0))#atan2 input#get.(1))
+	  | Sqrt -> self#beam_of_ident n ((input#get.(0))#sqrt)
+	  | Rdtable -> self#beam_of_ident n 
+		((input#get.(1))#rdtable input#get.(0) input#get.(2))
+	  | Mod -> self#beam_of_ident n 
+		((input#get.(0))#_mod input#get.(1))
+	  | Vectorize -> self#beam_of_ident n 
+		((input#get.(0))#vectorzie input#get.(1))
+	  | Vconcat -> self#beam_of_ident n 
+		((input#get.(0))#vconcat input#get.(1))
+	  | Vpick -> self#beam_of_ident n 
+		((input#get.(0))#vpick input#get.(1))
+	  | Serialize -> self#beam_of_ident n 
+		(input#get.(0))#serialize
+	  | Larger -> self#beam_of_ident n 
+		((input#get.(0))#larger input#get.(1))
+	  | Smaller -> self#beam_of_ident n 
+		((input#get.(0))#smaller input#get.(1))
+	  | Prefix -> self#beam_of_ident n 
+		((input#get.(1))#prefix input#get.(0))
+	  | Selec2 -> self#beam_of_ident n 
+		((input#get.(0))#select2 input#get.(1) input#get.(2))
+	  | Select3 -> self#beam_of_ident n 
+		((input#get.(0))#select3 input#get.(1) 
+		   input#get.(2) input#get.(3))
       end;;