*)
open Types;;
+open Basic;;
open Value;;
open Signal;;
open Beam;;
exception NotYetDone;;
exception Dimension_error of string;;
+exception Process_error of string;;
class dimension : int * int -> dimension_type =
fun (init : int * int) ->
class proc_const : faust_exp -> process_type =
fun (exp_init : faust_exp) ->
object (self)
- val exp = exp_init
- val dim =
- method evaluate = fun b1 ->
-
+ val _exp = exp_init
+ val _dim = new dimension (0,1)
+ val _delay = 0
+ val _const =
+ match exp_init with
+ | Const b -> b
+ | _ -> raise (Process_error "const process constructor.")
+
+ method exp = _exp
+ method dim = _dim
+ method delay = _delay
+ method const = _const
+
+ 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.")
end;;
-class exp_ident =
- object
- inherit expression
-
+class exp_ident : faust_exp -> process_type =
+ fun (exp_init : faust_exp) ->
+ object (self)
+ val _exp = exp_init
+ val _symbol =
+ match exp_init with
+ | Ident s -> s
+ | _ -> raise (Process_error "ident process constructor.")
+ val _dim = dimension_of_symbol _symbol
+ val _delay = 0
+
+
+ method exp = _exp
+ method dim = _dim
+ method delay = _delay
+ method const = _const
+
+ 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.")
end;;