0b7cfde1aca567ba09ead295d0614f11bdff99ef
[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 of_float_array : float array -> value_type
26 method to_string : string
27 method normalize : unit
28 method add : value_type -> value_type
29 method neg : value_type
30 method sub : value_type -> value_type
31 method mul : value_type -> value_type
32 method recip : value_type
33 method div : value_type -> value_type
34 method zero : value_type
35 method floor : value_type
36 method int : value_type
37 method sin : value_type
38 method cos : value_type
39 method atan : value_type
40 method sqrt : value_type
41 method atan2 : value_type -> value_type
42 method _mod : value_type -> value_type
43 method larger : value_type -> value_type
44 method smaller : value_type -> value_type
45 method max : value_type -> value_type
46 method min : value_type -> value_type
47 end;;
48
49
50 type symbol = Add
51 | Sub
52 | Mul
53 | Div
54 | Pass
55 | Stop
56 | Mem
57 | Delay
58 | Floor
59 | Int
60 | Sin
61 | Cos
62 | Atan
63 | Atan2
64 | Sqrt
65 | Rdtable
66 | Mod
67 | Vectorize
68 | Vconcat
69 | Vpick
70 | Serialize
71 | Larger
72 | Smaller
73 | Max
74 | Min
75 | Prefix
76 | Select2
77 | Select3
78
79
80 type faust_exp =
81 Const of basic
82 | Ident of symbol
83 | Par of faust_exp * faust_exp
84 | Seq of faust_exp * faust_exp
85 | Rec of faust_exp * faust_exp
86 | Split of faust_exp * faust_exp
87 | Merge of faust_exp * faust_exp
88
89
90 class type rate_type =
91 object
92 method to_int : int
93 method to_float : float
94 method to_string : string
95 method num : int
96 method denom : int
97 method equal : rate_type -> bool
98 method mul : int -> rate_type
99 method div : int -> rate_type
100 end
101
102 class type signal_type =
103 object
104 method frequency : rate_type
105 method at : time -> value_type
106 method add_memory : int -> unit
107 method add : signal_type -> signal_type
108 method neg : signal_type
109 method sub : signal_type -> signal_type
110 method mul : signal_type -> signal_type
111 method div : signal_type -> signal_type
112 method delay : signal_type -> signal_type
113 method mem : signal_type
114 method vectorize : signal_type -> signal_type
115 method serialize : signal_type
116 method vconcat : signal_type -> signal_type
117 method vpick : signal_type -> signal_type
118 method floor : signal_type
119 method int : signal_type
120 method sin : signal_type
121 method cos : signal_type
122 method atan : signal_type
123 method atan2 : signal_type -> signal_type
124 method sqrt : signal_type
125 method _mod : signal_type -> signal_type
126 method larger : signal_type -> signal_type
127 method smaller : signal_type -> signal_type
128 method max : signal_type -> signal_type
129 method min : signal_type -> signal_type
130 method rdtable : signal_type -> signal_type -> signal_type
131 method select2 : signal_type -> signal_type -> signal_type
132 method select3 : signal_type -> signal_type -> signal_type -> signal_type
133 method prefix : signal_type -> signal_type
134 end;;
135
136 type matrix = float array array;;
137
138 type data = float array array array;;
139
140 class type beam_type =
141 object
142 method get : signal_type array
143 method width : int
144 method sub : int -> int -> beam_type
145 method cut : int -> beam_type * beam_type
146 method append : beam_type -> beam_type
147 method matching : int -> beam_type
148 method at : time -> value_type array
149 method output : int -> data
150 method frequency : rate_type array
151 end;;
152
153
154 class type dimension_type =
155 object
156 method input : int
157 method output : int
158 method par : dimension_type -> dimension_type
159 method seq : dimension_type -> dimension_type
160 method split : dimension_type -> dimension_type
161 method merge : dimension_type -> dimension_type
162 method _rec : dimension_type -> dimension_type
163 end;;
164
165
166 class type process_type =
167 object
168 method exp : faust_exp
169 method dim : dimension_type
170 method delay : int
171 method eval : beam_type -> beam_type
172 end;;
173
174
175 class type io_type =
176 object
177 method set : string -> string -> unit
178 method read : string array -> beam_type
179 method write : rate_type array -> data -> string array
180 end;;