New Faustine tested by sin.dsp and fft.dsp.
[Faustine.git] / interpretor / types.ml
1
2 type index = int;;
3
4 type time = int;;
5
6 type basic = N of int
7 | R of float
8 | Vec of vector
9 | Zero
10 | Error
11 and vector = < size : int; nth : (index -> basic) >;;
12
13 class type vector_type =
14 object
15 method size : int
16 method nth : index -> basic
17 end;;
18
19 class type value_type =
20 object
21 method get : basic
22 method to_int : int
23 method to_float : float
24 method to_float_array : float array
25 method to_string : string
26 method normalize : unit
27 method add : value_type -> value_type
28 method neg : value_type
29 method sub : value_type -> value_type
30 method mul : value_type -> value_type
31 method recip : value_type
32 method div : value_type -> value_type
33 method zero : value_type
34 method floor : value_type
35 method int : value_type
36 method sin : value_type
37 method cos : value_type
38 method atan : value_type
39 method sqrt : value_type
40 method atan2 : value_type -> value_type
41 method _mod : value_type -> value_type
42 method larger : value_type -> value_type
43 method smaller : value_type -> value_type
44 end;;
45
46
47 type symbol = Add
48 | Sub
49 | Mul
50 | Div
51 | Pass
52 | Stop
53 | Mem
54 | Delay
55 | Floor
56 | Int
57 | Sin
58 | Cos
59 | Atan
60 | Atan2
61 | Sqrt
62 | Rdtable
63 | Mod
64 | Vectorize
65 | Vconcat
66 | Vpick
67 | Serialize
68 | Larger
69 | Smaller
70 | Prefix
71 | Select2
72 | Select3
73
74
75 type faust_exp =
76 Const of basic
77 | Ident of symbol
78 | Par of faust_exp * faust_exp
79 | Seq of faust_exp * faust_exp
80 | Rec of faust_exp * faust_exp
81 | Split of faust_exp * faust_exp
82 | Merge of faust_exp * faust_exp
83
84
85 class type signal_type =
86 object
87 method frequency : int
88 method at : time -> value_type
89 method add_memory : int -> unit
90 method add : signal_type -> signal_type
91 method neg : signal_type
92 method sub : signal_type -> signal_type
93 method mul : signal_type -> signal_type
94 method div : signal_type -> signal_type
95 method delay : signal_type -> signal_type
96 method mem : signal_type
97 method vectorize : signal_type -> signal_type
98 method serialize : signal_type
99 method vconcat : signal_type -> signal_type
100 method vpick : signal_type -> signal_type
101 method floor : signal_type
102 method int : signal_type
103 method sin : signal_type
104 method cos : signal_type
105 method atan : signal_type
106 method atan2 : signal_type -> signal_type
107 method sqrt : signal_type
108 method _mod : signal_type -> signal_type
109 method larger : signal_type -> signal_type
110 method smaller : signal_type -> signal_type
111 method rdtable : signal_type -> signal_type -> signal_type
112 method select2 : signal_type -> signal_type -> signal_type
113 method select3 : signal_type -> signal_type -> signal_type -> signal_type
114 method prefix : signal_type -> signal_type
115 end;;
116
117
118 class type beam_type =
119 object
120 method get : signal_type array
121 method width : int
122 method sub : int -> int -> beam_type
123 method cut : int -> beam_type * beam_type
124 method append : beam_type -> beam_type
125 method matching : int -> beam_type
126 method at : time -> value_type array
127 method output : int -> value_type array array
128 method frequency : int array
129 end;;
130
131
132 class type dimension_type =
133 object
134 method input : int
135 method output : int
136 method par : dimension_type -> dimension_type
137 method seq : dimension_type -> dimension_type
138 method split : dimension_type -> dimension_type
139 method merge : dimension_type -> dimension_type
140 method _rec : dimension_type -> dimension_type
141 end;;
142
143
144 class type process_type =
145 object
146 method exp : faust_exp
147 method dim : dimension_type
148 method delay : int
149 method eval : beam_type -> beam_type
150 end;;
151
152
153 class type io_type =
154 object
155 method read : string array -> beam_type
156 method write : int array -> value_type array array -> string array
157 end;;