Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / documentation / code_VALMain.main.html
1 <html><head>
2 <link rel="stylesheet" href="style.css" type="text/css">
3 <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
4 <link rel="Start" href="index.html">
5 <link title="Index of types" rel=Appendix href="index_types.html">
6 <link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
7 <link title="Index of values" rel=Appendix href="index_values.html">
8 <link title="Index of modules" rel=Appendix href="index_modules.html">
9 <link title="Types" rel="Chapter" href="Types.html">
10 <link title="Parser" rel="Chapter" href="Parser.html">
11 <link title="Lexer" rel="Chapter" href="Lexer.html">
12 <link title="Value" rel="Chapter" href="Value.html">
13 <link title="Signal" rel="Chapter" href="Signal.html">
14 <link title="Faustexp" rel="Chapter" href="Faustexp.html">
15 <link title="Interpreter" rel="Chapter" href="Interpreter.html">
16 <link title="Preprocess" rel="Chapter" href="Preprocess.html">
17 <link title="Main" rel="Chapter" href="Main.html"><title>Main.main</title>
18 </head>
19 <body>
20 <code class="code"><span class="keyword">let</span>&nbsp;main&nbsp;()&nbsp;=&nbsp;<br>
21 <br>
22 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;ignore&nbsp;system&nbsp;alarm&nbsp;clock&nbsp;*)</span><br>
23 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;_&nbsp;=&nbsp;<span class="constructor">Sys</span>.signal&nbsp;<span class="constructor">Sys</span>.sigalrm&nbsp;<span class="constructor">Sys</span>.<span class="constructor">Signal_ignore</span>&nbsp;<span class="keyword">in</span><br>
24 <br>
25 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;set&nbsp;garbage&nbsp;collector&nbsp;*)</span><br>
26 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;_&nbsp;=&nbsp;set_GC&nbsp;()&nbsp;<span class="keyword">in</span><br>
27 <br>
28 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;read&nbsp;input&nbsp;wave&nbsp;files&nbsp;*)</span><br>
29 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;(input_rate_list,&nbsp;input_float_array_list)&nbsp;=&nbsp;read_input_wave&nbsp;<span class="constructor">Sys</span>.argv&nbsp;<span class="keyword">in</span><br>
30 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
31 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;select&nbsp;output&nbsp;type&nbsp;*)</span><br>
32 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;output_type&nbsp;=&nbsp;<span class="constructor">Sys</span>.argv.(1)&nbsp;<span class="keyword">in</span><br>
33 <br>
34 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">try</span><br>
35 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;preprocess&nbsp;*)</span><br>
36 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;dsp_file_route_string&nbsp;=&nbsp;(io_macro_to_string&nbsp;<span class="constructor">Dsp_Route_string</span>)&nbsp;^&nbsp;<span class="constructor">Sys</span>.argv.(2)&nbsp;<span class="keyword">in</span><br>
37 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;exp_string&nbsp;=&nbsp;<span class="constructor">Preprocess</span>.preprocess(dsp_file_route_string)&nbsp;<span class="keyword">in</span><br>
38 <br>
39 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;parsing&nbsp;*)</span><br>
40 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;exp_faust&nbsp;=&nbsp;exp_of_string&nbsp;exp_string&nbsp;<span class="keyword">in</span><br>
41 <br>
42 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;interpretation&nbsp;*)</span><br>
43 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;(output_channel_list,&nbsp;output_rate_list,&nbsp;output_float_array_list)&nbsp;=&nbsp;<br>
44 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interpreter&nbsp;exp_faust&nbsp;(input_rate_list,&nbsp;input_float_array_list)&nbsp;<span class="keyword">in</span><br>
45 <br>
46 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;make&nbsp;output&nbsp;wave&nbsp;files&nbsp;*)</span><br>
47 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span>&nbsp;output_type&nbsp;=&nbsp;<span class="string">"-wav"</span>&nbsp;<span class="keyword">then</span><br>
48 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;write_output_wave&nbsp;output_channel_list&nbsp;output_rate_list&nbsp;output_float_array_list<br>
49 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span>&nbsp;<span class="keyword">if</span>&nbsp;output_type&nbsp;=&nbsp;<span class="string">"-txt"</span>&nbsp;<span class="keyword">then</span><br>
50 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;write_output_txt&nbsp;output_channel_list&nbsp;output_float_array_list<br>
51 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span>&nbsp;raise&nbsp;(<span class="constructor">Invalid_argument</span>&nbsp;(<span class="string">"Unkown&nbsp;option:&nbsp;"</span>&nbsp;^&nbsp;output_type))<br>
52 <br>
53 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">with</span>&nbsp;<span class="constructor">NotYetDone</span>&nbsp;<span class="keywordsign">-&gt;</span><br>
54 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print_endline(<span class="string">"Operation&nbsp;not&nbsp;yet&nbsp;programed.."</span>)</code></body></html>